Skip to content

Instantly share code, notes, and snippets.

@ferdinandosimonetti
Created October 15, 2018 08:06
Show Gist options
  • Save ferdinandosimonetti/97ecb7c6ef206ce6f619e52cbcdd4b42 to your computer and use it in GitHub Desktop.
Save ferdinandosimonetti/97ecb7c6ef206ce6f619e52cbcdd4b42 to your computer and use it in GitHub Desktop.
function to add AD users to AD groups from a CSV input file
function addUsersToGroup {
Param(
[parameter(Mandatory=$true)]
[String]
$InputFile
)
$a = import-csv -header utente,gruppo -path $InputFile
foreach ($row in $a) {
Add-ADGroupMember -members $row.utente -identity $row.gruppo
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment