Link to home
Start Free TrialLog in
Avatar of nav2567
nav2567Flag for United States of America

asked on

Add members to local group of remote computers using power shell.

Hi,

I need to add a AD group to a local group (Remote Desktop User) of a lot of servers.

Can I use power shell to read a file with list of servers and add a domain group to the Remote Desktop Users (local group) of each of the server in the list?

Thanks.
Avatar of Steven Carnahan
Steven Carnahan
Flag of United States of America image

Microsoft TechNet has a script to add an AD User/Group to local administrators group that you can probably modify:

https://gallery.technet.microsoft.com/scriptcenter/Add-AD-UserGroup-to-Local-fe5e9239
Wouldn't it be easier to do that via GPO and just deploy it to the servers you need?
Hopefully you're running an Active Directory domain. If you are then doing this using PowerShell is a terrible idea. If you're not, well than PowerShell might be your only option. If you are running Active Directory you should be looking at using a GPO to manage local groups on servers. Its very easy to do.

Someone has written an article here on EE, it's not the best so I would suggest following some guides on Petri.com. There are 2 ways to do this using GPO's:

1. Restricted Groups: https://www.petri.com/manage-local-active-directory-groups-using-group-policy-restricted-groups
2. Group Policy Preferences (GPP) - the new way: https://www.petri.com/manage-local-active-directory-groups-using-group-policy-preferences
Avatar of nav2567

ASKER

Learnctx, we cannot use GP in this case.  

Pony10us, your solution is close but we will need a script to read file server file and process the ADD.
ASKER CERTIFIED SOLUTION
Avatar of Steven Carnahan
Steven Carnahan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial