Hi,
I'm trying to write a vbscript to poll each of my 300 servers and give me the version number for a specified file so I know if they are running the correct executable. I first check if the OS is 64 or 32 bit and change the path accordingly. It takes the remote server's IP as an argument. I'm running it as a domain administrator. It does work on some (10%) of my servers but the rest come back with the error "The system cannot find the file specified." I'm running Server 2008 and server 2003 both 64 and 32 bit flavors.
I've confirmed that the file is on these servers. To make things simple I have it pointing to c:\windows\regedit.exe file for testing. I've been googling and playing around with this for two weeks but can't find the problem. I'm hoping someone with more experience can help me here. Here is my basic script:
Dim Col, Obj, strComputer, Wmi, objFSO
strComputer = Wscript.Arguments(0)
Set Wmi = GetObject("winmgmts:" _
& "{authenticationLevel=Pkt}!\\" _
& strComputer & "\root\cimv2")
Set Col = Wmi.ExecQuery("SELECT * FROM Win32_Processor",,48)
Set objFSO = Createobject("Scripting.FileSystemObject")
For Each Obj in Col
'-> X86
If InStr(LCase(Obj.AddressWidth),LCase("32")) Then
'-> Place Your Code Below Here
CSPath = "\\" & WScript.Arguments(0) & "\C$\Windows\regedit.exe"
Wscript.Echo "Message: Current Version: " & objFSO.GetFileVersion(CSPath)
Wscript.Echo "Statistic:0" & objFSO.GetFileVersion(CSPath)
End If
'-> X64
If InStr(LCase(Obj.AddressWidth),LCase("64")) Then
'-> Place Your Code Below Here
CSPath = "\\" & Wscript.Arguments(0) & "\C$\Windows\regedit.exe"
Wscript.Echo "Message: Current Version: " & objFSO.GetFileVersion(CSPath)
Wscript.Echo "Statistic: 0" & objFSO.GetFileVersion(CSPath)
End If
Next