I've been using this script to add domain users to local computer groups one at a time but I've been tasked with adding the primary user of the computer to the Remote Desktop Users group on their computer. There are over 100 users and computers. I am hoping I can pull the data from a csv or text file but I'm stumped.
Here's the script I've been using. Any help would be greatly appreciated.
$group = read-host "Enter Security Group"
$user = read-host "Enter username"
$pc = read-host "Enter computer name"
$objUser = [ADSI]("WinNT://DOMAIN/$user")
$objGroup = [ADSI]("WinNT://$pc/$group")
$objGroup.PSBase.Invoke("Add",$objUser.PSBase.Path)