# Hash-Tabelle mit grundsätzlichen Benutzerdaten erzeugen
$PW = ‘#MeinKennwort789’
$PSS = ConvertTo-SecureString -String $PW -AsPlainText -Force
$NU = @{}
$NU.AccountPassword = $PSS
$NU.Enabled = $true
$NU.PasswordNeverExpires = $true
$NU.ChangePasswordAtLogon = $false
$NU.Path = “OU=User,OU=DWP,DC=dwp,DC=local”
# Benutzer Manfred erstellen
$NU.SamAccountName = ‘Manfred’
$NU.UserPrincipalName = ‘manfred@dwp.local’
$NU.Name = ‘Manfred Walter’
$NU.DisplayName = ‘Manfred Walter (Boss)’
New-ADUser @NU
# Benutzer Tom erstellen
$NU.SamAccountName = ‘Tom’
$NU.UserPrincipalName = ‘tom@dwp.local’
$NU.Name = ‘Tom Walter’
$NU.DisplayName = ‘Tom Walter (IT-Boss)’
New-ADUser @NU
# Die Daten eines Benutzers aktualisieren
$AU =@{
Identity = ‘Manfred’
OfficePhone = ‘0201 4366870’
Office = ‘Essen’
EmailAddress = ‘manfred@dwp.local’
GivenName = ‘Manfred’
Surname = ‘Walter’
HomePage = ‘https://www.windows-papst.de’
}
Set-ADUser @AU
# Benutzerinformationen auslesen
Get-ADUser -Identity Manfred -Properties * | Format-Table -Property DisplayName,Name,Office,OfficePhone,EmailAddress