PowerShell as an AD bulk user management tool
Bulk AD user creation can be quite a challenge for Active Directory (AD) administrators day in, day out. Many administrators use Microsoft's PowerShell to create users and perform other such basic AD user management tasks. Below are some key PowerShell scripts and commands for working with AD users in bulk.
Creating users in bulk with CSV import
Import-CSV test.csv | foreach {New-ADUser -SamAccountName $_.SamAccountName -Name $_.Name -Surname $_.Surname -GivenName $_.GivenName -Path "OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM" -AccountPassword (ConvertTo-SecureString -AsPlainText $_.password -Force) -Enabled $true
Adding users to a group in bulk
Import-CSVtest.csv | foreach {Add-ADGroupMember -Identity "Domain guests"-Members $_.sAMAccountName}
Modifying users in bulk
Import-CSVtest.csv | foreach {Set-ADUser -Identity $_.sAMAccountName -Description"testing description"}
Disabling users in bulk
Import-CsvC:\Users\administrator.AUTOMATION\Desktop\Sample.csv | foreach{Disable-ADAccount -Identity $_.sAMAccountName}
Related Articles
PowerShell as an AD user management tool
User management can be quite a challenge for Active Directory (AD) administrators day in and day out. Many administrators use Microsoft's PowerShell technology to perform basic AD user management tasks. Below are some key PowerShell scripts and ...
How to find unused Exchange Online mailboxes
What are unused Exchange Online mailboxes and how to identify them? Unused Exchange Online mailboxes are user mailboxes which are currently not being used by their users. There are 3 ways in which we can identify if a mailbox is unused or not. They ...
PowerShell as an AD group management tool
Group management can be quite a challenge for Active Directory (AD) administrators day in, day out. Many administrators use Microsoft's PowerShell technology to perform basic AD user management tasks. Below are some key PowerShell scripts and ...
Generate an Activity Report for Microsoft 365 Groups and Teams
Introduction The activity reports available for Microsoft 365 groups and Teams can be beneficial for administrators in an organization. Microsoft 365 teams group activity reports provide insight into group activities, group workloads, group counts, ...
PowerShell for AD user reports
Real-time insights on user account status and activity can help AD administrators manage accounts better. Many administrators use Microsoft's PowerShell scripts to generate Active Directory reports and pull detailed information. Below are some ...