Monday, 3 March 2014

Add users to Local Groups using PowerShell

Today I had to add a new hire to all the local Administrators group of all our dev and test servers.

So I wrote a script to do this:
$group =[ADSI]"WinNT://$(hostname)/Administrators,group"
This could be improved in so many ways that I hesitate it to even call it a script but there you go.

Given the churn rate, it probably makes sense to actually write a proper script, that takes values such as username and hostname and does it remotely, but I just hope that it won't be me running this next time :)

No comments:

Post a Comment