-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert Przybylski
committed
Sep 23, 2021
1 parent
071b53b
commit 7824d5b
Showing
3 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Throw "This is not a robust file" | ||
$domain = $env:USERDNSDOMAIN | ||
$dNC = (Get-ADRootDSE).defaultNamingContext | ||
|
||
|
||
#region redir | ||
$usrDN = '"' + "OU=Enabled Users,OU=User Accounts," + $dNc + '"' | ||
redirusr $usrDN | ||
$cmpDN = '"' + "OU=Quarantine," + $dNc + '"' | ||
redircmp | ||
#endregion | ||
|
||
#region Sites | ||
Import-Module ActiveDirectory | ||
Get-ADObject -SearchBase (Get-ADRootDSE).ConfigurationNamingContext ` | ||
-filter "objectclass -eq 'site'" | ` | ||
where-object { $_.Name -eq 'Default-First-Site-Name' } | ` | ||
Rename-ADObject -NewName "HQ" | ||
$subnet = Read-Host "Please provide subnet details" | ||
New-ADReplicationSubnet -Name $subnet -Site "HQ" | ||
#endrgion | ||
|
||
#region KDS Root Key | ||
add-kdsrootkey | ||
#add-kdsrootkey �effectivetime ((get-date).addhours(-10)) | ||
#endregion | ||
|
||
#password policies | ||
$TemplatePSO = New-Object Microsoft.ActiveDirectory.Management.ADFineGrainedPasswordPolicy | ||
$TemplatePSO.PasswordHistoryCount = 24 | ||
$TemplatePSO.MinPasswordAge = [TimeSpan]::Parse("0.01:00:00") | ||
$TemplatePSO.ComplexityEnabled = $true | ||
$TemplatePSO.ReversibleEncryptionEnabled = $false | ||
$TemplatePSO.LockoutDuration = "-10675199.02:48:05.4775808" | ||
$TemplatePSO.LockoutObservationWindow = [TimeSpan]::Parse("0.01:00:00") | ||
$TemplatePSO.LockoutThreshold = 4 | ||
$name = "AdminsPSO" | ||
New-ADFineGrainedPasswordPolicy -Instance $TemplatePSO -Name $name -Precedence 50 -Description "The Tiered users Password Policy" -DisplayName "Tiered Users PSO" -MaxPasswordAge "180.00:00:00" -MinPasswordLength 10 | ||
Add-ADFineGrainedPasswordPolicySubject -Identity $name -Subjects ` | ||
"Domain Admins", Tier1ServerMaintenance, tier1admins, Tier1PAWUsers, Tier2ServiceDeskOperators, tier2admins, Tier2WorkstationMaintenance | ||
#endregion | ||
|
||
#AD Resycle | ||
Enable-ADOptionalFeature 'Recycle Bin Feature' -Scope ForestOrConfigurationSet -Target $domain -Confirm:$false | ||
#endregion | ||
|
||
#region DNS registration | ||
$networkConfig = Get-WmiObject Win32_NetworkAdapterConfiguration -filter "ipenabled = 'true'" | ||
$networkConfig.SetDnsDomain("$domain") | ||
$networkConfig.SetDynamicDNSRegistration($true, $true) | ||
ipconfig /registerdns | ||
#endregion | ||
|
||
#gmsa for MDI | ||
$name = 'svc_MDIReadOnly' | ||
$dcList = Get-ADGroupMember -Identity 'Domain Controllers' | ||
New-ADServiceAccount -Name $name -DNSHostName "$($name).$domain" -PrincipalsAllowedToRetrieveManagedPassword $dcList | ||
Test-ADServiceAccount -Identity $name | ||
Get-ADServiceAccount -Identity $name -Properties MemberOf | ||
|
||
#endregion |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
<<<<<<< HEAD | ||
Name,samAccountName,GroupCategory,GroupScope,DisplayName,OU,Description,Membership | ||
Test Group 1,testgroup1,Security,Global,Test Group 1,"ou=Security Groups,OU=Groups",Group with random members, | ||
Test Group 2,testgroup2,Security,Global,Test Group 2,"ou=Security Groups,OU=Groups",Group with random members, | ||
Test Group 3,testgroup3,Security,Global,Test Group 3,"ou=Security Groups,OU=Groups",Group with random members, | ||
Test Group 4,testgroup4,Security,Global,Test Group 4,"ou=Security Groups,OU=Groups",Group with random members, | ||
======= | ||
Name,samAccountName,GroupCategory,GroupScope,DisplayName,OU,Description,Membership | ||
Test Group 1, testgroup1,Security,Global,Group 1,"ou=Security Group,OU=Groups",Group with members of the first 10 users | ||
Test Group 2, testgroup1,Security,Global,Group 1,"ou=Security Group,OU=Groups",Group with members of the first 10-20 users | ||
Test Group 3, testgroup1,Security,Global,Group 1,"ou=Security Group,OU=Groups",Group with members of the first 20-30 users | ||
Test Group 4, testgroup1,Security,Global,Group 1,"ou=Security Group,OU=Groups",Group with members of the first 30-40 users | ||
>>>>>>> 07c1c14 (Other section added) |