Browsed by
Tag: Groupes

Massive AD Group Creation using Powershell

Massive AD Group Creation using Powershell

#Parameters 
$InputFile="import.csv"


#Variables
$errors=0
$success=0

#csv file that contains all groups to create 
$InputGroups=Import-csv $InputFile -Delimiter ";"

$InputGroups|
Foreach-Object{
	
	#Importing data
	$GroupName=$_."GroupName"
	$Destination=$_."DESTINATION"
	$Description=$_."DESCRIPTION"
	
	Write-Host "`n Creation du groupe : $GroupName -" -NoNewLine
	
	#AD Group creation
	New-ADGroup -name "$GroupName" -groupscope DomainLocal -GroupCategory Security -Description $Description -path $Destination
	
	#Check if group well created
	$testADGroup=Get-ADGroup $GroupName
	If($testADGroup){
		Write-Host " OK" -ForegroundColor:GREEN
		$success+=1
	}
	Else{
		Write-Host " KO" -ForegroundColor:RED
		$errors+=1
	}	

}

#Final 
$total=$success+$errors
Write-Host "`n `n $total groups created : `n "
Write-Host "           - $success" -NoNewLine -ForegroundColor:GREEN
Write-Host " groups created"
Write-Host "           - $errors" -NoNewLine -ForegroundColor:RED
Write-Host " groupes not created `n `n "

A quick Powershell script, easy to use, to create a lot of groups from a csv file

How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site