I have a number of servers to which I need to grant administrative access to 1 particular user, i.e. add him to local admins. I guess it can be scripted with PowerShell or somehow else.. Can somebody advice me how to do it?
I have a number of servers to which I need to grant administrative access to 1 particular user, i.e. add him to local admins. I guess it can be scripted with PowerShell or somehow else.. Can somebody advice me how to do it?
If this computer is in an Active Directory domain, I would control this via Group Policy. (You can use Restricted Groups via GPO, which adds members to the local admins group while at the same time removing members who shouldn't be there.)
If this computer is not part of a domain, just run
C:\>net localgroup Administrators billybob /add
You could of course also run the above line in a batch file.
Maybe not the prettiest Powershell and definitely not the shortest but here’s a modified version of something I use.
What Ryan Ries said, basically. I used to use restricted groups to add administrators (which also kicks out people who shouldn't be there, bonus!).
For non-domain computers, something like PsExec with a list of computers would work. Something like this: