Skip to content

Commit

Permalink
Process Guest account
Browse files Browse the repository at this point in the history
  • Loading branch information
vreguibar committed Jun 10, 2024
1 parent ecd9e94 commit 5555c4f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Public/New-CentralItOU.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
#region Users
$AdminName = $confXML.n.Admin.users.Admin.Name
$newAdminName = $confXML.n.Admin.users.NEWAdmin.Name
$GuestNewName = $confXML.n.Admin.users.Guest.Name


# Get the AD Objects by Well-Known SID
Expand Down Expand Up @@ -710,15 +711,16 @@

Write-Verbose -Message 'Moving objects...'


# Move, and if needed, rename the Admin account
If ($AdminName -ne $confXML.n.Admin.users.Admin.Name) {
Rename-ADObject -Identity $AdminName.DistinguishedName -NewName $confXML.n.Admin.users.Admin.Name
Set-ADUser $AdminName -SamAccountName $confXML.n.Admin.users.Admin.Name -DisplayName $confXML.n.Admin.users.Admin.Name
}

# Move the Guest Account
Get-ADUser -Identity $GuestNewName | Move-ADObject -TargetPath $ItAdminAccountsOuDn -Server $CurrentDC

$AdminName | Move-ADObject -TargetPath $ItAdminAccountsOuDn -Server $CurrentDC
Get-ADUser -Identity $confXML.n.Admin.users.Guest.Name | Move-ADObject -TargetPath $ItAdminAccountsOuDn -Server $CurrentDC
Get-ADUser -Identity krbtgt | Move-ADObject -TargetPath $ItAdminAccountsOuDn -Server $CurrentDC

$DomainAdmins | Move-ADObject -TargetPath $ItPrivGroupsOUDn -Server $CurrentDC
Expand Down

0 comments on commit 5555c4f

Please sign in to comment.