Created
June 1, 2015 08:44
-
-
Save janikvonrotz/3c9fc5894e3d514a330a to your computer and use it in GitHub Desktop.
Add Remote Desktop User
#PowerShell
#Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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