This script will install UltraVNC on a remote computer. You need to have the following files in your @ScriptDir
vnchooks.dll, winVNC.exe, and vncviewer.exe. The script uses WMI to install the service on the remote PC and to determine the Windows Directory. After the viewer is closed, the script will clean up after itself on the local and remote PC.
$compname = INPUTBOX("Remote Control", "Remote Control Address", "", "", -1, 120)
Ping($compname)
If @error Then
MsgBox(0,"error", "PC not alive")
Exit
EndIf
RegWrite("\\" & $compname & "\HKLM\SOFTWARE\ORL\WinVNC3", "AuthRequired", "REG_DWORD", "1")
RegWrite("\\" & $compname & "\HKLM\SOFTWARE\ORL\WinVNC3", "DisableTrayIcon", "REG_DWORD", "1")
RegWrite("\\" & $compname & "\HKLM\SOFTWARE\ORL\WinVNC3\Default", "Password", "REG_BINARY", "DBD83CFD727A1458")
FileInstall("vnchooks.dll", "\\" & $compname & "\admin$\temp\vnchooks.dll")
FileInstall("winVNC.exe", "\\" & $compname & "\admin$\temp\winVNC.exe")
FileInstall("vncviewer.exe", @ScriptDir & "\viewer.exe")
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $compname & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * From Win32_OperatingSystem")
For $objItem in $colItems
$windir=$objItem.WindowsDirectory
Next
$objNewService = $objWMIService.Get ("Win32_Service")
$errReturn = $objNewService.Create ("VNC", "VNC", $windir & "\temp\winVNC.exe -service", "16", "0", "Manual", "1")
$colListOfServices = $objWMIService.ExecQuery ("Select * from Win32_Service Where Name = 'VNC'")
For $objNewService in $colListOfServices
$objNewService.StartService()
Next
Sleep(1000)
RunWait(@ScriptDir & "\viewer.exe -connect " & $compname & " -password password -nostatus")
For $objNewService in $colListOfServices
$objNewService.StopService()
$objNewService.Delete()
Next
Sleep(1000)
FileDelete("\\" & $compname & "\admin$\temp\vnchooks.dll")
FileDelete("\\" & $compname & "\admin$\temp\winVNC.exe")
FileDelete(@ScriptDir & "\viewer.exe")
RegDelete("\\" & $compname & "\HKLM\SOFTWARE\UltraVNC")
RegDelete("\\" & $compname & "\HKCU\SOFTWARE\ORL")
RegDelete("HKCU\SOFTWARE\ORL")