Last active
May 26, 2018 14:08
-
-
Save bunchc/22023bc8299cb4a0d88d68c9b6a03557 to your computer and use it in GitHub Desktop.
Does terribad things to AD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$NewDomainName = "orangutan.local" | |
$NewDomainNetBios = "orangutan" | |
$NumRandomGroups = 12000 | |
$NumRandomUsers = 24000 | |
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions | |
Enable-RemoteDesktop | |
# Install chocolatey | |
Set-ExecutionPolicy AllSigned; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
# Allow chocolatey to run unattended | |
choco feature enable -n allowGlobalConfirmation | |
# Install some useful packages | |
cinst git | |
cinst git-credential-winstore | |
cinst console-devel | |
cinst sublimetext2 | |
cinst poshgit | |
cinst dotpeek | |
cinst putty | |
cinst winscp | |
# Enable AD | |
Install-WindowsFeature 'AD-Domain-Services' -IncludeAllSubFeature -IncludeManagementTools | |
# Installing ADDS Forest | |
Install-ADDSForest -ForestMode 2 ` | |
-DomainMode 2 ` | |
-DomainName $NewDomainName ` | |
-DomainNetbiosName $NewDomainNetBios ` | |
-SafeModeAdministratorPassword (ConvertTo-SecureString "P@ssword1" -AsPlainText -Force) ` | |
-Force | |
# Create a bunch of random groups | |
$RandomGroups = @() | |
for ($i=1; $i -le $NumRandomGroups; $i++) { | |
$GroupGuid = [guid]::NewGuid().toString().ToUpper() | |
$RandomGroups += New-ADGroup -Name "TestDomainGroup-$GroupGuid" ` | |
-Description "Test AD Group Number $i" ` | |
-DisplayName "Test AD Group $i - $GroupGuid" | |
} | |
# Create a bunch of random users | |
for ($i=1; $i -le $NumRandomUsers; $i++) { | |
$UserGuid = [guid]::NewGuid().toString().ToUpper() | |
$UserPassword = ConvertTo-SecureString "P@ssword1" -AsPlainText -Force | |
$UserGroup = $RandomGroups | Get-Random | |
$user = New-ADUser -Name "TestUser-$UserGuid" ` | |
-AccountPassword $UserPassword ` | |
-Enabled $true | |
# Add our user to a group | |
Add-ADGroupMember $UserGroup $user | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment