Add-RemoteDesktopUsers
Add-RemoteDesktopUsers
Add Remote Desktop Users to a Remote Computer with PowerShell
By Michael J. Thomas
If you are getting tired of adding users to remote computers the manual way for users to have RDP access to their computers. Then the following solution with our PowerShell automation will be a sigh of relief from your manual labors.
Manual Process:
Automated Process with PowerShell:
<#
.Synopsis
Add-RemoteDesktopUsers
Author: Michael J. Thomas
Updated: 01/16/2020
.DESCRIPTION
Add Users to Remote Desktop Users Group on the a Remote Computer
.EXAMPLE
Add-RemoteDesktopUsers -ComputerName "Computer01" -UserName "mthomas","ethomas"
#>
function Add-RemoteDesktopUsers {
[cmdletbinding()]
param(
[string[]]$UserName,
[string]$ComputerName
)
ForEach ($User in $UserName){
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
NET LOCALGROUP "Remote Desktop Users" /ADD "$Using:User"
}
}
}
Manual Process:
- Open Computer Management
- Click Action Menu
- Click Connect to Another Computer
- Type Computer Name "Computer1"
- Click OK
- Expand Down Local Users and Groups
- Select Groups
- Double Click Remote Desktop Users Group
- Click Add
- Type the User Name "User1"
- Click OK
- Click OK again.
Automated Process with PowerShell:
- Open PowerShell Script and Run
- Type: Add-RemoteDesktopUsers -ComputerName "Computer1" -UserName -"User1"
<#
.Synopsis
Add-RemoteDesktopUsers
Author: Michael J. Thomas
Updated: 01/16/2020
.DESCRIPTION
Add Users to Remote Desktop Users Group on the a Remote Computer
.EXAMPLE
Add-RemoteDesktopUsers -ComputerName "Computer01" -UserName "mthomas","ethomas"
#>
function Add-RemoteDesktopUsers {
[cmdletbinding()]
param(
[string[]]$UserName,
[string]$ComputerName
)
ForEach ($User in $UserName){
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
NET LOCALGROUP "Remote Desktop Users" /ADD "$Using:User"
}
}
}
Comments
Post a Comment