How to Add New Users USING SCRIPT in Active Directory Windows Server 2022

preview_player
Показать описание
Hello! In this video we will show you how to add new users USING SCRIPT and csv file in Active Directory Windows Server 2022.

Chapters:
00:00 Intro
00:20 Script to add one single user to AD
01:25 Script to add bulk multiple users to AD
01:58 Check the new users

STEP-BY-STEP GUIDE:

SCRIPT TO ADD ONE USER:
$splat = @{
Name = 'John Doe'
AccountPassword = (Read-Host -AsSecureString 'AccountPassword')
Enabled = $true
}
New-ADUser @splat -Path "OU=Accounting, OU=San Francisco, OU=testflora, DC=corp, DC=testflora, DC=com"
----------------------------------------------------------------------------
SCRIPT TO ADD MULTIPLE/BULK USERS:
$Users = Import-Csv -Delimiter "," -Path "C:\LOCATION\OF\YOUR\FILE.csv"
foreach ($User in $Users)
{
$Displayname = $User.Firstname + " " + $User.Lastname
$UserFirstname = $User.Firstname
$UserLastname = $User.Lastname
$OU = $User.OU
$SAM = $User.SAM
$UPN = $User.Firstname + "." + $User.Lastname + "@" + $User.Maildomain
$Description = $User.Description
$Password = $User.Password
#New-ADUser -Path "OU=Accounting, OU=San Francisco, OU=testflora, DC=corp, DC=testflora, DC=com"

}
------------------------------------------------------------------------------
CSV FILE(USE EXCEL OR SIMILAR TO EDIT):
Firstname, Lastname,Maildomain,SAM,OU,Password,Description
--------------------------------------------------------------------------------

Please Like, Share, and Subscribe! =)
Comment with any questions.

#windowsserver2022 #windowsserver #serveradvanced #activedirectory #ad #scripts
Рекомендации по теме