From 0b2e80b14910b1b21f4a7532eb33dcde3dc71a76 Mon Sep 17 00:00:00 2001 From: eeckert Date: Fri, 2 Feb 2024 10:31:12 -0700 Subject: [PATCH] fixed a logic issue. --- Set-UserAttributeDefaults.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Set-UserAttributeDefaults.ps1 b/Set-UserAttributeDefaults.ps1 index 90e3139..b54069d 100644 --- a/Set-UserAttributeDefaults.ps1 +++ b/Set-UserAttributeDefaults.ps1 @@ -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 }