[PS] Function to add localadmins

How to add members to the local Administrator group using powershell

The answers is quite simple

PS C:\>[ADSI]"WinNT://./Administrators,group").Add("WinNT://USEFUL-IT/Administrators),group")

But of course this needs to be run locally on the system. So why to do this using powershell if I am already logged on to the system, I can use computer management Right?

Yes you can, but if the system is running core, you need to use powershell to add members to the local Administrator Group.

 

But I have multiple servers, how can I do this and also have response if it failes..

Here is my initial version of a function you can use from a central server and session into the remote systems, to offload the workload, also to run this in parallel.

 

 

Regards,

Wessel.

About the Author

wvsandwijk

I am a Technical Specialist - Cloud Infrastructures from the Netherlands. My Skills are mainly PowerShell, VMWare, Hyper-V, Microsoft System Center products and Windows Azure Pack. I work for a company in Utrecht The Netherlands.

No Comments

Comments are closed.