# 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
Need to rename an Active Directory (2019 and later) and dont want the life story?
Here is a bullet point list of the commands to run in order based on the provided text:
On the DC, from an Admin Command Prompt:
rendom /list
Edit the Domainlist.xml file it created to replace all existing domain names with
the new domain name, including the NetBIOS name if it’s changed.
rendom /showforest
rendom /upload
Ensure replication is complete, optionally using
repadmin.exe /syncall /d /e /P /q DomainNamingMaster-HostName
rendom /prepare
rendom /execute
After domain controllers restart, log on using the new domain name.
Restart the pretty much everything twice after all domain controllers are back
online.
Update GPO linkages with the new domain name using gpfixup . If FQDN is changed:
gpfixup /olddns:old-domain.local /newdns:new-domain.com
If NetBIOS name is changed:
gpfixup /oldnb:OLD-NetBIOS /newnb:NEW-NetBIOS
If needed, synchronise group policy changes with repadmin.exe /syncall /d /e /P /q DC-HostName NewDomainDN
Rename domain controllers with netdom commands:
netdom computername old.computer.name /add:new.computer.name
followed by
netdom computername old.computer.name /makeprimary:new.computer.name
Reboot domain controllers.
Reboot all domain member computers, workstations, and servers twice.
If using domain-based DFS namespaces, update any orphaned paths.
Run rendom /clean to clean up old domain references and unfreeze the forest
configuration.
rendom /clean
Open DNS Manager create the new zone, reboot and after you can delete the old domain DNS zone.
Remove the Active Directory Domain Services role from Control Station if
applicable.
The domain rename process is complex and can have far-reaching effects on your
network. It should not be undertaken lightly and requires thorough planning and
testing.