Hi everybody. We are running EPO 4.6 and I would like to use a VBScript to automate the task of deleting a single computer from the system tree. I have read through the Web API documentation and believe I have found the command I need to run, but I just can't figure out how to actually run the command from within a VBScript. All the examples in the documentation use Python, but I don't know Python.
So, I believe the command I need to run is:
https://MyEPOServer:8443/remote/detectedsystem.delete?names=COMPUTERNAME
But the documentation talks about using WGET to send the command. Does anybody know a way to send the command in native VBScript?
thanks in advance!
Message was edited by: fitzgerac, typo on 9/28/12 3:21:58 PM CDTSolved! Go to Solution.
Hello Fitzgerac,
You actually need to use the system.delete command, detectedsystems refers to the RSD component. For this script to work you will need to install GNU Wget on every machine that will run this script, you can get the setup files at http://gnuwin32.sourceforge.net/packages/wget.htm. Once installed modify the URL variable to point to your epo server and enter your credentials in the UserName and Password variables. Also make sure the WGET variable points to your installation path. You can delete as many systems as you like so long as they are separated by a comma. The leading white spaces in the Options and URL variables are important for the script to execute properly. Hope this helps!
'####################################
'Script to delete systems from the system tree.
'Written By Darrell Pierson, 2012.
UserName = "foo"
Password = "bar"
WGET = """C:\Program Files (x86)\GnuWin32\bin\wget.exe"""
Options = " --no-check-certificate --http-user=" & UserName &" --http-password=" & Password
URL = " https://eposerver:8443/remote/system.delete?names="
Names = """MachineName1, MachineName2"""
Set ObjShell = WScript.CreateObject("WScript.Shell")
Result= ObjShell.Run(WGET & Options & URL & Names, 6, True)
If Result = 0 Then
wscript.echo "The following systems have been deleted: " & Names
Else
wscript.echo "Unable to delete the following systems: " & Names
End if
Message was edited by: dpierson on 10/15/12 8:40:56 PM CDTHello Fitzgerac,
You actually need to use the system.delete command, detectedsystems refers to the RSD component. For this script to work you will need to install GNU Wget on every machine that will run this script, you can get the setup files at http://gnuwin32.sourceforge.net/packages/wget.htm. Once installed modify the URL variable to point to your epo server and enter your credentials in the UserName and Password variables. Also make sure the WGET variable points to your installation path. You can delete as many systems as you like so long as they are separated by a comma. The leading white spaces in the Options and URL variables are important for the script to execute properly. Hope this helps!
'####################################
'Script to delete systems from the system tree.
'Written By Darrell Pierson, 2012.
UserName = "foo"
Password = "bar"
WGET = """C:\Program Files (x86)\GnuWin32\bin\wget.exe"""
Options = " --no-check-certificate --http-user=" & UserName &" --http-password=" & Password
URL = " https://eposerver:8443/remote/system.delete?names="
Names = """MachineName1, MachineName2"""
Set ObjShell = WScript.CreateObject("WScript.Shell")
Result= ObjShell.Run(WGET & Options & URL & Names, 6, True)
If Result = 0 Then
wscript.echo "The following systems have been deleted: " & Names
Else
wscript.echo "Unable to delete the following systems: " & Names
End if
Message was edited by: dpierson on 10/15/12 8:40:56 PM CDTThanks dpierson.
What I actually ended up doing was downloading a standalone .exe version of wget from http://users.ugent.be/~bpuype/wget/#download. then I just placed wget.exe in the same folder as my script, and ran the following command in my vbscript:
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim sPath
sPath=oFSO.GetParentFolderName(WScript.ScriptFullName)
oShell.Run "cmd.exe /c "&sPath&"\wget.exe -q --no-check-certificate --user=admin --password=password "_
&Chr(34)&"https://EPOSERVER:8443/remote/system.delete?names="&CompName&Chr(34),0,True
hope this helps somebody else out there.
So the password is being sent in clear text? That doesn't seem very secure..
The password is not being sent in clear text (httpS://...). Use a limited priviledge account if you're going to embed a password inside a script, or prompt for the password when the script is run.
Jon
Corporate Headquarters
6220 America Center Drive
San Jose, CA 95002 USA