Tag Archives: vbscript

Install UltraVNC msi remotely using a VBS / VBScript

Hi,

To create a silent MSI for UltraVNC I have used this open source app that you can get it here: UltraVNC MSI Creator

To create the MSI just follow the instructions is plain and simple.

Now the script so you can remotly install on any PC you got administrative privileges:

 Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strComputer = InputBox("Writte down the target computer","UltraVNC Remote INSTALL","Nomed do Computador", 50, 50)
Const UVNCPath = "\\yourultravncpath\UltraVNC.msi"
Const Overwrite = True
wsLocation = "\\" & strComputer & "\c$\Windows\Temp\"

if strComputer = "" then
	WScript.Quit
end if

if Ping(strComputer) then
	objFSO.CopyFile UVNCPath, wsLocation ,Overwrite
else
	msgbox("Can't reach the target computer, sorry!")
	WScript.Quit
end if

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objSoftware = objWMIService.Get("Win32_Product")
errReturn = objSoftware.Install("C:\Windows\Temp\ultravnc.msi",,True)

if errReturn = 0 then
	msgbox("Yupii, installed with success.")
	else
	msgbox("Can't install, sorry!")
end if

Function Ping(PC)
	Set objWshScriptExec = objShell.Exec("C:\WINDOWS\system32\ping.exe " & PC)
	Set objStdOut = objWshScriptExec.StdOut

	awake=False
	Do Until objStdOut.AtEndOfStream
		strLine = objStdOut.ReadLine
		awake = awake Or InStr(LCase(strLine), "bytes=") > 0
	Loop
	Ping = awake
End Function