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 }