Running a script on target machines
Hello:
I am sorry but I am a newbie to scripting. I have created a vb script to do an uninstall of an application. I want to target computers and run the script against them and record the output to a file. I know I can put this in a logon script and let it run that way but I really need to target the machines and run it that way.
Does anyone know of a way to run a script agains another computer remotely?
Thanks.
I am sorry but I am a newbie to scripting. I have created a vb script to do an uninstall of an application. I want to target computers and run the script against them and record the output to a file. I know I can put this in a logon script and let it run that way but I really need to target the machines and run it that way.
Does anyone know of a way to run a script agains another computer remotely?
Thanks.
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
Ilikebananas
19 years ago
Posted by:
Garrett
19 years ago
Stolen from: [link]http://cwashington.netreach.net/depo/view.asp?Index=326&ScriptType=vbscript[/link]
NameSpace = "root\cimv2"
Server = "ComputerName or IP"
UserName = "domain\user"
Password = "thePassword"
command = "calc"
Set Locator = CreateObject("WbemScripting.SWbemLocator")
If Err.Number Then
msgbox = Err.description
Err.Clear
End If
Set Service = Locator.ConnectServer (Server, NameSpace, UserName, Password)
Service.Security_.impersonationlevel = 3
If Err.Number Then
msgbox = Err.Description & " " & """" & Server & """"
err.clear
End If
Set Instance = Service.Get("Win32_Process")
If Err.Number then
msgbox = Err.Description
Err.Clear
End If
intStatus = Instance.Create(Command, null, null, intProcessId)
If intStatus = 0 Then
If intProcessId < 0 Then
'4294967296 is 0x100000000.
intProcessId = intProcessId + 4294967296
End If
themsg = "Succeeded in executing " & Command & "." & vbCRLF
msgbox themsg & vbcrlf & "The process id is " & intProcessId & "."
Else
msgbox "Failed to execute " & Command & ". " & Err.Description
End If
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.