Skip to content

Instantly share code, notes, and snippets.

@hackingbutlegal
Created February 12, 2013 03:33
Show Gist options
  • Save hackingbutlegal/4760041 to your computer and use it in GitHub Desktop.
Save hackingbutlegal/4760041 to your computer and use it in GitHub Desktop.
Windows: Remotely unlock RDP.
strComputer = InputBox ("Enter Machine Name")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colTSSettings = objWMIService.InstancesOf("Win32_TerminalServiceSetting")
For Each colTS in colTSSettings
colTS.SetAllowTSConnections(1)
Wscript.Echo UCase(strComputer) & "Remote Desktop Is Now Enabled"
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment