Question Lister Scheduled Tasks serveur distant

Plus d'informations
il y a 11 ans 11 mois #11479 par brutosaure
Ok, je pensais pas pouvoir utilsier count.
Cat quand je fais un

[code:1]$tasks | gm [/code:1]

Il n'apparait pas

Mais juste

[code:1]$tasks | gm


TypeName: System.__ComObject#{9c86f320-dee3-4dd1-b972-a303f26b061e}

Name MemberType Definition
----

GetInstances Method IRunningTaskCollection GetInstances (int)
GetRunTimes Method void GetRunTimes (_SYSTEMTIME, _SYSTEMTIME, uint, _SYSTEMTIME)
GetSecurityDescriptor Method string GetSecurityDescriptor (int)
Run Method IRunningTask Run (Variant)
RunEx Method IRunningTask RunEx (Variant, int, int, string)
SetSecurityDescriptor Method void SetSecurityDescriptor (string, int)
Stop Method void Stop (int)
Definition Property ITaskDefinition Definition () {get}
Enabled Property bool Enabled () {get} {set}
LastRunTime Property Date LastRunTime () {get}
LastTaskResult Property int LastTaskResult () {get}
Name Property string Name () {get}
NextRunTime Property Date NextRunTime () {get}
NumberOfMissedRuns Property int NumberOfMissedRuns () {get}
Path Property string Path () {get}
State Property _TASK_STATE State () {get}
Xml Property string Xml () {get}
[/code:1]

Donc comment lister ce genre de méthode si elle n'apparait pas avec gm ?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 11 ans 11 mois #11480 par brutosaure
Merci,

J'ai fait comme ceçi

[code:1]foreach($EachTasks in $Tasks)
{
[xml]$EachTasksFormatXml = $EachTasks.xml
#$EachTasksFormatXmlEnabled = $EachTasksFormatXml.Task.Settings.Enabled
if($EachTasksFormatXml.Task.Settings.Enabled -eq \"true\"«»)
{
Write-Host Server: $Server
Write-Host Name: $EachTasks.Name
if($EachTasksFormatXml.Task.RegistrationInfo.Date.Author)
{
write-host Author: $EachTasksFormatXml.Task.RegistrationInfo.Date.Author
}
else
{
write-host Author: $EachTasksFormatXml.Task.RegistrationInfo.Author
}
write-host StartBoundary: $EachTasksFormatXml.Task.Triggers.CalendarTrigger.Startboundary
write-host UserRunning: $EachTasksFormatXml.Task.Principals.Principal.UserId
write-host Command: $EachTasksFormatXml.Task.Actions.Exec.Command
write-host Arguments: $EachTasksFormatXml.Task.Actions.Exec.Arguments `n
}
}[/code:1]

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 11 ans 11 mois #11489 par Gaga

Ok, je pensais pas pouvoir utilsier count.

Car quand je fais un


[code:1] $tasks | gm [/code:1]


Il n'apparait pas


Quand tu fais [code:1]$tasks | gm[/code:1] ça te donne les membres des objets contenus dans ta variable $tasks et non de $tasks. Pour voir réellement les membres de ton objet $tasks faut faire [code:1],tasks | gm[/code:1]
Tu obtiendras :


[code:1] TypeName: System.__ComObject#{86627eb4-42a7-41e4-a4d9-ac33a72f2d52}

Name MemberType Definition
----

Item ParameterizedProperty IRegisteredTask Item (Variant) {get}
Count Property int Count () {get}
_NewEnum Property IUnknown _NewEnum () {get}[/code:1]

On dirait une collection d'objet ...... aprés ça me dépasse un peu ..... si y a des pros qui passent par là pour nous éclairer un peu plus !!

Pour illustrer par un exemple plus parlant :
[code:1]$tableau=\"un\",\"deux\"[/code:1]

[code:1]$tableau | gm

TypeName: System.String

Name MemberType Definition
----

Clone Method System.Object Clone()
CompareTo Method int CompareTo(System.Object value), int ....
Contains Method bool Contains(string value)[/code:1]

[code:1],$tableau | gm

TypeName: System.Object[]

Name MemberType Definition
----

Count AliasProperty Count = Length
Address Method System.Object&, mscorlib, Versio
Clone Method System.Object Clone()[/code:1]

$tableau contient des objets de type [string]
$tableau est de type [array]

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 6 ans 11 mois #23430 par hays
Bonjour,

je regarde un peu votre script et je cherche a modifier le compte utilisateur et mot de passe associé à la taches planifiées. est-ce que vous avez tenter de faire ça ?

ma problématique et que j'ai pas mal de taches planifiées et cela me bloque pour le changement de mot de passe de l'administrateur du domaine.

avez vous un début de piste que je pourrais exploiter ?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 6 ans 11 mois #23442 par Philippe
salut n3m0

regarde la commande Set-ScheduledTask
les paramètres password et user en particulier

si tu veux plus d'aide la dessus ouvre un nouveau sujet stp et si possible propose un script comme base de travail ;) merci

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 6 ans 11 mois #23458 par hays
Merci pour votre réponse :) je vais regarder si ça fonction sur un PS 2.0

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.086 secondes
Propulsé par Kunena