Sorry, I am invoking the script with a batch file. Example below:
The Problem:
Using a batch file to invoke a .
VB script I use the %1 variable and insert the computer name from a text file. My
VB script keeps on assuming I am running on the local machine. The script works fine with hardcoded servernames, but I can't seem to find a way of inserting the remote machine variable.
Batch File text=
for /f %%a in (client.txt) do call :sub %%a
goto :eof
:sub
echo %1 >> c:\sms\verification\smsresults.txt
cscript //nologo smsclientcheck1.vbs %1 >> c:\sms\verification\smsresults.txt
goto :eof
VB Script text=
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'clisvcl.exe'")
If colProcesses.Count = 1 Then
Wscript.Echo "SMS Client is running."
Else
Wscript.Echo "SMS Client is not running."
End If