October 23, 2021


A blog for USEFUL-IT information

[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.