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: 

  1. Open Computer Management 
  2. Click Action Menu 
  3. Click Connect to Another Computer
  4. Type Computer Name "Computer1"
  5. Click OK 
  6. Expand Down Local Users and Groups 
  7. Select Groups 
  8. Double Click Remote Desktop Users Group
  9. Click Add 
  10. Type the User Name "User1"
  11. Click OK
  12. Click OK again. 

Automated Process with PowerShell:

  1. Open PowerShell Script and Run
  2. 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

Popular posts from this blog

Invoke-Reprofile

Mike's Profile Cleanup Tool