Sunday, January 10, 2010

Remote Assistance Script

Welcome to my first ghetto code and scripts blog.

Let's jump right to it. This first script I wrote is for offering remote assistance, and is helpful to IT Admins everywhere.


set shell = createobject("wscript.shell")
dim strComputerName

On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002

set objShell = wscript.createobject("wscript.shell")
strComputer = Wscript.Arguments.Item(0)

strComputer = InputBox("Enter PC Name or IP ADDRESS:","Input")

If strComputer <> "" Then
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
strEntryName = "SCForceOption"
dwValue = 0
objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue
If (Err.Number = 0) or (Err.Number = 9) Then
Else If (Not Err.Number = 0) or (Not Err.Number = 9) Then
wscript.Echo "Error: "& vbCrLf & strComputer & " not found or no access.."
End If
End If
End If


shell.run "hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/Remote%20Assistance/Escalation/Unsolicited/Unsolicitedrcui.htm"
shell.AppActivate("Help and Support Center")
wscript.sleep 1500
'shell.sendkeys "{TAB 9}"
shell.sendkeys strComputer
wscript.sleep 500
shell.sendkeys "%c"
shell.sendkeys "%S"

No comments:

Post a Comment