Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Liste détaillé de toutes les taches planifiées sur tous les serv eu

3 réponses
Avatar
Lyes
Bonjour,

Je voudrais savoir si qqun a un script qui fait l'inventaire détaillé de
toutes les taches planifiées (compte,planification,command,path du job,date
de création,derniere/prochaine execution...) sur tous les serveurs 2000 2003
et 2008.
Serait il possible qu'il recherche dans l'AD tous les serveurs avec ces 3
OS et recense tour à tour les taches planifiées de chacun?
J'ai 200 serveurs à sonder et j'ai pas envie de passer sur chacun pour le
faire car il m'ont donné bcp de boulot à faire et y a peut être une
possibilité de recrutement à la fin du stage (j'aimerai réussi ce gros
chantier de restructuration d'active directory/exchange car c'est super
intéressant) .

Merci beaucoup à vous tous .

Lyes

3 réponses

Avatar
gollum123
On 21 fév, 01:33, Lyes wrote:
Bonjour,

Je voudrais savoir si qqun  a un script qui fait l'inventaire détaill é de
toutes les taches planifiées (compte,planification,command,path du job, date
de création,derniere/prochaine execution...) sur tous les serveurs 2000 2003
et 2008.
Serait il possible qu'il recherche dans l'AD tous les serveurs avec ces  3
OS et recense tour à tour les taches planifiées de chacun?
J'ai 200 serveurs à sonder et j'ai pas envie de passer sur chacun pour le
faire car il m'ont donné bcp de boulot à faire et y a peut être une
possibilité de recrutement à la fin du stage (j'aimerai réussi ce g ros
chantier de restructuration d'active directory/exchange car c'est super
intéressant) .  

Merci beaucoup à vous tous .

Lyes




Bonjour,

voici un vbscript qui fait cela, mais je ne l'ai jamais testé sur
Windows 2008:
strComputer = "."

Set oDomain = GetObject("WinNT://MONDOMAINWINDOWS")
Set objShell = CreateObject ("wscript.shell")
on error resume next
Dim objGroup
strGroupSID = "S-1-5-32-544" ' Well Known SID of the group

oDomain.Filter = Array("computer")
For Each oComputer In oDomain

If IsConnectible(oComputer.Name, 1, 50) Then
'-----------------------
err.number = 0
Set objWMIService = GetObject("winmgmts:" & oComputer.Name & "root
cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_Group WHERE SID = '" & strGroupSID & "'")

if err.number = 0 then

For Each objItem in colItems

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" & oComputer.Name & "root
cimv2")

Set colScheduledJobs = objWMIService.ExecQuery _
("Select * from Win32_ScheduledJob")

For Each objJob in colScheduledJobs
Wscript.Echo "On: " & oComputer.Name
''''Wscript.Echo "Caption: " & objJob.Caption
Wscript.Echo "Command: " & objJob.Command
'''Wscript.Echo "Days of Month: " & objJob.DaysOfMonth
'''Wscript.Echo "Days of Week: " & objJob.DaysOfWeek
Wscript.Echo "Description: " & objJob.Description
'''Wscript.Echo "Elapsed Time: " & objJob.ElapsedTime
''''Wscript.Echo "Install Date: " & objJob.InstallDate
''''Wscript.Echo "Interact with Desktop: " &
objJob.InteractWithDesktop
''''Wscript.Echo "Job ID: " & objJob.JobID
Wscript.Echo "Job Status: " & objJob.JobStatus
Wscript.Echo "Name: " & objJob.Name
''''Wscript.Echo "Notify: " & objJob.Notify
Wscript.Echo "Owner: " & objJob.Owner
''''Wscript.Echo "Priority: " & objJob.Priority
'''Wscript.Echo "Run Repeatedly: " & objJob.RunRepeatedly
'''Wscript.Echo "Start Time: " & objJob.StartTime
Wscript.Echo "Status: " & objJob.Status
'''Wscript.Echo "Time Submitted: " & objJob.TimeSubmitted
'''''Wscript.Echo "Until Time: " & objJob.UntilTime
Next
Next

Else
wscript.echo oComputer.name & ": probleme de securite: acces refuse"
End if


Else
wscript.echo oComputer.name & ": pas present sur le réseau"

End if
Next

Function IsConnectible(sHost, iPings, iTO)

If iPings = "" Then iPings = 2
If iTO = "" Then iTO = 750


Const OpenAsASCII = 0
Const FailIfNotExist = 0
Const ForReading = 1


Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
sTempFile = sTemp & "runresult.tmp"

oShell.run "%comspec% /c ping.exe -n " & iPings & " -w " & iTO & " "
& sHost & ">" & sTempFile, 0 , True

Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, FailIfNotExist,
OpenAsASCII)


sResults = fFile.ReadAll
fFile.Close
oFSO.DeleteFile(sTempFile)


Select Case InStr(sResults,"TTL=")
Case 0 IsConnectible = False
Case Else IsConnectible = True
End Select
End Function

Cordialement,
Mathieu CHATEAU
http://www.lotp.fr
Avatar
Lyes
Bonjour Mathieu,

Je viens de lancer le script que tu m'as donné sur un dc et je m'apperçois
qu'il va sonder tous les objets ordinateurs
[oDomain.filter=array("computer")] de l'AD et j'aimerai restreindre cette
recherche aux seuls ordinateurs exécutant un OS serveur.
Sais tu comment je peux faire pour filtrer en fonction de ce critère?
De plus peux tu m'expliquer pourquoi dans le ColItem
tu filtres les SID des groupes administrators locaux ("Select * from
Win32_Group WHERE SID = '" & strGroupSID & "'") ?
Si je te poses cette question c'est parce que je souhaite aussi (et
surtout) sonder les contrôleurs de domaines sur lesquels ce compte de groupe
n'existe pas.


"" wrote:

On 21 fév, 01:33, Lyes wrote:
> Bonjour,
>
> Je voudrais savoir si qqun a un script qui fait l'inventaire détaillé de
> toutes les taches planifiées (compte,planification,command,path du job,date
> de création,derniere/prochaine execution...) sur tous les serveurs 2000 2003
> et 2008.
> Serait il possible qu'il recherche dans l'AD tous les serveurs avec ces 3
> OS et recense tour à tour les taches planifiées de chacun?
> J'ai 200 serveurs à sonder et j'ai pas envie de passer sur chacun pour le
> faire car il m'ont donné bcp de boulot à faire et y a peut être une
> possibilité de recrutement à la fin du stage (j'aimerai réussi ce gros
> chantier de restructuration d'active directory/exchange car c'est super
> intéressant) .
>
> Merci beaucoup à vous tous .
>
> Lyes


Bonjour,

voici un vbscript qui fait cela, mais je ne l'ai jamais testé sur
Windows 2008:
strComputer = "."

Set oDomain = GetObject("WinNT://MONDOMAINWINDOWS")
Set objShell = CreateObject ("wscript.shell")
on error resume next
Dim objGroup
strGroupSID = "S-1-5-32-544" ' Well Known SID of the group

oDomain.Filter = Array("computer")
For Each oComputer In oDomain

If IsConnectible(oComputer.Name, 1, 50) Then
'-----------------------
err.number = 0
Set objWMIService = GetObject("winmgmts:" & oComputer.Name & "root
cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_Group WHERE SID = '" & strGroupSID & "'")

if err.number = 0 then

For Each objItem in colItems

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" & oComputer.Name & "root
cimv2")

Set colScheduledJobs = objWMIService.ExecQuery _
("Select * from Win32_ScheduledJob")

For Each objJob in colScheduledJobs
Wscript.Echo "On: " & oComputer.Name
''''Wscript.Echo "Caption: " & objJob.Caption
Wscript.Echo "Command: " & objJob.Command
'''Wscript.Echo "Days of Month: " & objJob.DaysOfMonth
'''Wscript.Echo "Days of Week: " & objJob.DaysOfWeek
Wscript.Echo "Description: " & objJob.Description
'''Wscript.Echo "Elapsed Time: " & objJob.ElapsedTime
''''Wscript.Echo "Install Date: " & objJob.InstallDate
''''Wscript.Echo "Interact with Desktop: " &
objJob.InteractWithDesktop
''''Wscript.Echo "Job ID: " & objJob.JobID
Wscript.Echo "Job Status: " & objJob.JobStatus
Wscript.Echo "Name: " & objJob.Name
''''Wscript.Echo "Notify: " & objJob.Notify
Wscript.Echo "Owner: " & objJob.Owner
''''Wscript.Echo "Priority: " & objJob.Priority
'''Wscript.Echo "Run Repeatedly: " & objJob.RunRepeatedly
'''Wscript.Echo "Start Time: " & objJob.StartTime
Wscript.Echo "Status: " & objJob.Status
'''Wscript.Echo "Time Submitted: " & objJob.TimeSubmitted
'''''Wscript.Echo "Until Time: " & objJob.UntilTime
Next
Next

Else
wscript.echo oComputer.name & ": probleme de securite: acces refuse"
End if


Else
wscript.echo oComputer.name & ": pas present sur le réseau"

End if
Next

Function IsConnectible(sHost, iPings, iTO)

If iPings = "" Then iPings = 2
If iTO = "" Then iTO = 750


Const OpenAsASCII = 0
Const FailIfNotExist = 0
Const ForReading = 1


Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
sTempFile = sTemp & "runresult.tmp"

oShell.run "%comspec% /c ping.exe -n " & iPings & " -w " & iTO & " "
& sHost & ">" & sTempFile, 0 , True

Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, FailIfNotExist,
OpenAsASCII)


sResults = fFile.ReadAll
fFile.Close
oFSO.DeleteFile(sTempFile)


Select Case InStr(sResults,"TTL=")
Case 0 IsConnectible = False
Case Else IsConnectible = True
End Select
End Function

Cordialement,
Mathieu CHATEAU
http://www.lotp.fr



Avatar
Lyes
Bonjour Mathieu

Je viens de lancer le script que tu m'as founis à partir d'un
contrôleur de domaine et je m'apperçois qu'il sonde tous les objets
ordinateurs de l'AD [oDomain.Filter = Array("computer")] et je souhaiterai
restreindre cette recherche aux seuls ordinateurs executant un OS serveur.
Sais tu comment je peux adapter ton script pour qu'il remplisse cette
condition?

De plus j'arrive pas à comprendre pourquoi est-ce qu'un second filtre
"colitems" est fait sur les SID [strGroupSID = S-1-5-32-544] des groupes
administrators locaux
[ ("Select * from Win32_Group WHERE SID = '" & strGroupSID & "'") ] ?
Si je pose cette question c'est que j'aimerai aussi ( et surtout) sonder
les contrôleurs de domaine , hors sur les contrôleurs de domaine ce groupe
n'existe pas.

Merci pour ton aide et tes réponses.

Lyes

"" wrote:

On 21 fév, 01:33, Lyes wrote:
> Bonjour,
>
> Je voudrais savoir si qqun a un script qui fait l'inventaire détaillé de
> toutes les taches planifiées (compte,planification,command,path du job,date
> de création,derniere/prochaine execution...) sur tous les serveurs 2000 2003
> et 2008.
> Serait il possible qu'il recherche dans l'AD tous les serveurs avec ces 3
> OS et recense tour à tour les taches planifiées de chacun?
> J'ai 200 serveurs à sonder et j'ai pas envie de passer sur chacun pour le
> faire car il m'ont donné bcp de boulot à faire et y a peut être une
> possibilité de recrutement à la fin du stage (j'aimerai réussi ce gros
> chantier de restructuration d'active directory/exchange car c'est super
> intéressant) .
>
> Merci beaucoup à vous tous .
>
> Lyes


Bonjour,

voici un vbscript qui fait cela, mais je ne l'ai jamais testé sur
Windows 2008:
strComputer = "."

Set oDomain = GetObject("WinNT://MONDOMAINWINDOWS")
Set objShell = CreateObject ("wscript.shell")
on error resume next
Dim objGroup
strGroupSID = "S-1-5-32-544" ' Well Known SID of the group

oDomain.Filter = Array("computer")
For Each oComputer In oDomain

If IsConnectible(oComputer.Name, 1, 50) Then
'-----------------------
err.number = 0
Set objWMIService = GetObject("winmgmts:" & oComputer.Name & "root
cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_Group WHERE SID = '" & strGroupSID & "'")

if err.number = 0 then

For Each objItem in colItems

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" & oComputer.Name & "root
cimv2")

Set colScheduledJobs = objWMIService.ExecQuery _
("Select * from Win32_ScheduledJob")

For Each objJob in colScheduledJobs
Wscript.Echo "On: " & oComputer.Name
''''Wscript.Echo "Caption: " & objJob.Caption
Wscript.Echo "Command: " & objJob.Command
'''Wscript.Echo "Days of Month: " & objJob.DaysOfMonth
'''Wscript.Echo "Days of Week: " & objJob.DaysOfWeek
Wscript.Echo "Description: " & objJob.Description
'''Wscript.Echo "Elapsed Time: " & objJob.ElapsedTime
''''Wscript.Echo "Install Date: " & objJob.InstallDate
''''Wscript.Echo "Interact with Desktop: " &
objJob.InteractWithDesktop
''''Wscript.Echo "Job ID: " & objJob.JobID
Wscript.Echo "Job Status: " & objJob.JobStatus
Wscript.Echo "Name: " & objJob.Name
''''Wscript.Echo "Notify: " & objJob.Notify
Wscript.Echo "Owner: " & objJob.Owner
''''Wscript.Echo "Priority: " & objJob.Priority
'''Wscript.Echo "Run Repeatedly: " & objJob.RunRepeatedly
'''Wscript.Echo "Start Time: " & objJob.StartTime
Wscript.Echo "Status: " & objJob.Status
'''Wscript.Echo "Time Submitted: " & objJob.TimeSubmitted
'''''Wscript.Echo "Until Time: " & objJob.UntilTime
Next
Next

Else
wscript.echo oComputer.name & ": probleme de securite: acces refuse"
End if


Else
wscript.echo oComputer.name & ": pas present sur le réseau"

End if
Next

Function IsConnectible(sHost, iPings, iTO)

If iPings = "" Then iPings = 2
If iTO = "" Then iTO = 750


Const OpenAsASCII = 0
Const FailIfNotExist = 0
Const ForReading = 1


Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
sTempFile = sTemp & "runresult.tmp"

oShell.run "%comspec% /c ping.exe -n " & iPings & " -w " & iTO & " "
& sHost & ">" & sTempFile, 0 , True

Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, FailIfNotExist,
OpenAsASCII)


sResults = fFile.ReadAll
fFile.Close
oFSO.DeleteFile(sTempFile)


Select Case InStr(sResults,"TTL=")
Case 0 IsConnectible = False
Case Else IsConnectible = True
End Select
End Function

Cordialement,
Mathieu CHATEAU
http://www.lotp.fr