PowerShell – Adding users and groups to a server using a CSV source

Quick and simple on here.

This script takes the list of servers from a CSV file and then adds the specified user or groups to the local group of that server.

CSV File should be formatted as follows

“Name”
“Server1”
“Server2”

$ServerList = Import-CSV C:\Temp\serverlist.csv
ForEach ($server in $ServerList)
{
echo $serverInvoke-Command -ComputerName $server.name -ScriptBlock {add-LocalGroupMember -Group "Administrators" -Member "---Insert User or Group name-----"}
}

A copy is attached if you want to download it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.