# Define the password for the accounts
$password = ConvertTo-SecureString -AsPlainText "Password11" -Force
# Create 100 user accounts (user001 to user100)
1..100 | ForEach-Object {
$username = "computer{0:D3}" -f $_
#$username = "user{0:D3}" -f $_
#New-ADUser -Name $username -SamAccountName $username -UserPrincipalName "$username@enron.com.au" -AccountPassword $password -Enabled $true -Path "CN=Users,DC=enron,DC=com,DC=au" -PassThru
New-ADComputer -Name $username -SamAccountName $username -UserPrincipalName "$username@enron.com.au" -AccountPassword $password -Enabled $true -Path "CN=Computers,DC=energy,DC=com,DC=au" -PassThru
}
Saturday, December 16, 2023
Quickly create some accounts in Active Directory for testing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment