TrickyDicky12
Technical User
Hi,
I have had a vbscript which has worked perfectly on a server which pings workstations to determine whether the PC is free for users to use.
I did this my pinging the PC and then checking if the explorer.exe process was running on the system. See below
' Check if Process is running on pinged PC that was Successful
Sub Query_Process_Running
'--- *******************************************
On Error Resume next
Set objLocator=CreateObject("WbemScripting.SWbemLocator")
Set objWMISer = objLocator.ConnectServer(strComputer,"root\cimv2",,,,,128)
' Wscript.Echo "after set loc"&cNoPCS&","&nct&","&strComputer
' Set objWMISer = GetObject("winmgmts:" _
' & "{impersonationLevel=impersonate}!\\" _
' & strComputer & "\root\cimv2")
If Err.Number = 0 Then
Set colProcessList = objWMISer.ExecQuery _
("Select Name from Win32_Process Where Name = 'explorer.exe'",,48)
If Err.Nmber = 0 Then
For Each objProcess in colProcessList
flagLog = True
Next
End If
Else
Err.Clear
End If
' objTextFile.WriteLine(Now&","&strComputer&","&flagLog)
On Error goto 0
End Sub
This all worked fine when the PCs were 32-bit Windows 7, however we have moved to 64-bit Windows 7 images, and my script no longer works. The ping works, but the explorer.exe process is not being reached. Can anyone else me achieve this so it will be able to check if explorer.exe is running on a 64-bit PC?
Thanks,
I have had a vbscript which has worked perfectly on a server which pings workstations to determine whether the PC is free for users to use.
I did this my pinging the PC and then checking if the explorer.exe process was running on the system. See below
' Check if Process is running on pinged PC that was Successful
Sub Query_Process_Running
'--- *******************************************
On Error Resume next
Set objLocator=CreateObject("WbemScripting.SWbemLocator")
Set objWMISer = objLocator.ConnectServer(strComputer,"root\cimv2",,,,,128)
' Wscript.Echo "after set loc"&cNoPCS&","&nct&","&strComputer
' Set objWMISer = GetObject("winmgmts:" _
' & "{impersonationLevel=impersonate}!\\" _
' & strComputer & "\root\cimv2")
If Err.Number = 0 Then
Set colProcessList = objWMISer.ExecQuery _
("Select Name from Win32_Process Where Name = 'explorer.exe'",,48)
If Err.Nmber = 0 Then
For Each objProcess in colProcessList
flagLog = True
Next
End If
Else
Err.Clear
End If
' objTextFile.WriteLine(Now&","&strComputer&","&flagLog)
On Error goto 0
End Sub
This all worked fine when the PCs were 32-bit Windows 7, however we have moved to 64-bit Windows 7 images, and my script no longer works. The ping works, but the explorer.exe process is not being reached. Can anyone else me achieve this so it will be able to check if explorer.exe is running on a 64-bit PC?
Thanks,