Skip to content

Instantly share code, notes, and snippets.

@janikvonrotz
Created June 1, 2015 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janikvonrotz/3c9fc5894e3d514a330a to your computer and use it in GitHub Desktop.
Save janikvonrotz/3c9fc5894e3d514a330a to your computer and use it in GitHub Desktop.
Add Remote Desktop User #PowerShell #Windows
$computername = "hostname"
Invoke-Command -ComputerName $computername -ScriptBlock {
$computer = $env:COMPUTERNAME
$domain = "domain"
$user = "username"
$group = [ADSI]"WinNT://$computer/Remote Desktop Users,group"
$group.psbase.Invoke("add",([ADSI]"WinNT://$domain/$user").Path)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment