cs_Doccc
Messages postés4Date d'inscriptionjeudi 27 janvier 2005StatutMembreDernière intervention28 octobre 2008
-
28 oct. 2008 à 09:24
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 2012
-
28 oct. 2008 à 09:54
Bonjour,
Je me lance dans les scripts VBS, et il y à quelques subtilités que
je n'ai pas compris, et j'aimerais avoir votre avis sur mon script
(Pourquoi y se lance pas déjà )
C'est un script d'ouverture de session, il vérifie le nom du Pc, si
il commence par UC, il vérifie son OS, si c'est Xp il lance un exe
situer sur mon serveur.
Les deux conditions sont que le nom du PC commence par UC**** et qu'il soit sous XP.
Voilà mon bout de code actuel :
Set objNet = CreateObject("WScript.Network" )
strCompName = objNet.ComputerName
Next
For Each objItem in colItems
VerBig = Left(objItem.Version,3)
NextIF left(strCompName,2) "UC" AND VerBig "5.1" Then Shell.Run "\\serveur\ici\lefichier.exe"
ELSE Wscript.Quit
END IF
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 28 oct. 2008 à 09:29
Salut,
Un peu de couleur avec deux question dedans
Set objNet = CreateObject("WScript.Network")
strCompName = objNet.ComputerName
Next '=> Quest ce qui fait lui? il manquerait pas du code?
For Each objItem In colItems 'C'est quoi ce colItems il manquerait pas du code?
VerBig = Left(objItem.Version, 3)
Next If Left(strCompName, 2) "UC" And VerBig "5.1" Then
Shell.Run "\\serveur\ici\lefichier.exe"
Else
Wscript.Quit
End If , ----
[../code.aspx?ID=41455 By Renfield]
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 28 oct. 2008 à 09:40
Salut,
Essaie peu être ce code
Set objNet = CreateObject("WScript.Network")
strCompName = objNet.ComputerName
Set objWMI = GetObject("winmgmts:\\" & strCompName & "\root\cimv2")
Set Shell = Wscript.CreateObject("Wscript.Shell")
Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem", , 48)
For Each objItem In colItems
VerBig = Left(objItem.Version, 3)
Next If Left(strCompName, 2) "UC" And VerBig "5.1" Then
Shell.Run "\\serveur\ici\lefichier.exe"
Else
Wscript.Quit
End If , ----
[../code.aspx?ID=41455 By Renfield]
cs_Doccc
Messages postés4Date d'inscriptionjeudi 27 janvier 2005StatutMembreDernière intervention28 octobre 2008 28 oct. 2008 à 09:33
Set objNet = CreateObject( "WScript.Network" )
strCompName = objNet.ComputerName
Set objWMI = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set Shell = Wscript.CreateObject("Wscript.Shell")
Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem In colItems
VerBig = Left(objItem.Version, 3 )
Next If Left(strCompName, 2) <gras>"UC" And VerBig </gras> "5.1" Then
Shell.Run "\\serveur\ici\lefichier.exe" Else
Wscript.Quit
End If