fixed a logic issue.

This commit is contained in:
Erik Eckert 2024-02-02 10:31:12 -07:00
parent 836355a879
commit 0b2e80b149

View File

@ -13,12 +13,12 @@ $countryHash = @{
}
$CompanyName = 'MPE, a Division of Englobe'
$User = Get-ADUser -Filter * -SearchBase 'OU=MPEUsers,DC=mpe,DC=ca' -Properties c, co, countryCode | Where-Object countryCode -NE 124
$User = Get-ADUser -Filter * -SearchBase 'OU=MPEUsers,DC=mpe,DC=ca' -Properties c, co, countryCode
foreach ($u in $User) {
$u | Set-ADUser -Company $CompanyName
$u | Set-ADUser -Replace @{ Company = $CompanyName } -Credential $cred
$u | Set-ADUser -Country 'CA' -Credential $cred
if ($u.countryCode -eq 0 ) {
Write-Output $u.Name
# Write-Output $u.Name
$u | set-adobject -Add $countryHash -Credential $cred -ErrorAction SilentlyContinue
}