G
Guest
Hi, I want to run a script with MOM that will run on a windows 2003 server.
It's a vbscript that run devcon.exe to disable a network card if the card is
active. When I run the script manually, it works perfectly, but when I run
it with my MOM's client. It says "Disabled Failed" in my log file and the
connection still active. I put my MOM's service account administrator of the
compute, the account is also Domain admin.
Here is the script :
-----------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
For Each objItem in colItems
If objItem.NetConnectionID= "Test Louis" Then '("Test Louis is the name
of my connection)
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = WINDOW_TYPE
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
'Parse the Id of the card to trunk at the good caracter
IdCarteReseau = objItem.PNPDeviceID
IdCarteReseau = mid(IdCarteReseau,5, 99)
pos = InStr(IdCarteReseau,"\")
IdCarteReseau = Left(IdCarteReseau, (pos -1))
IdCarteReseau = "PCI\" & IdCarteReseau
errReturn = objProcess.Create("C:\Windows\system32\cmd.exe /C
C:\Devcon\Devcon.exe disable " & chr(34) & IdCarteReseau & chr(34) & " >>
C:\Temp\verificationCarteReseau.txt", null, objConfig, intProcessID)
End If
Next
It's a vbscript that run devcon.exe to disable a network card if the card is
active. When I run the script manually, it works perfectly, but when I run
it with my MOM's client. It says "Disabled Failed" in my log file and the
connection still active. I put my MOM's service account administrator of the
compute, the account is also Domain admin.
Here is the script :
-----------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
For Each objItem in colItems
If objItem.NetConnectionID= "Test Louis" Then '("Test Louis is the name
of my connection)
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = WINDOW_TYPE
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
'Parse the Id of the card to trunk at the good caracter
IdCarteReseau = objItem.PNPDeviceID
IdCarteReseau = mid(IdCarteReseau,5, 99)
pos = InStr(IdCarteReseau,"\")
IdCarteReseau = Left(IdCarteReseau, (pos -1))
IdCarteReseau = "PCI\" & IdCarteReseau
errReturn = objProcess.Create("C:\Windows\system32\cmd.exe /C
C:\Devcon\Devcon.exe disable " & chr(34) & IdCarteReseau & chr(34) & " >>
C:\Temp\verificationCarteReseau.txt", null, objConfig, intProcessID)
End If
Next