fixed a logic issue.
This commit is contained in:
parent
836355a879
commit
0b2e80b149
@ -13,12 +13,12 @@ $countryHash = @{
|
|||||||
}
|
}
|
||||||
$CompanyName = 'MPE, a Division of Englobe'
|
$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) {
|
foreach ($u in $User) {
|
||||||
$u | Set-ADUser -Company $CompanyName
|
$u | Set-ADUser -Replace @{ Company = $CompanyName } -Credential $cred
|
||||||
$u | Set-ADUser -Country 'CA' -Credential $cred
|
$u | Set-ADUser -Country 'CA' -Credential $cred
|
||||||
if ($u.countryCode -eq 0 ) {
|
if ($u.countryCode -eq 0 ) {
|
||||||
Write-Output $u.Name
|
# Write-Output $u.Name
|
||||||
$u | set-adobject -Add $countryHash -Credential $cred -ErrorAction SilentlyContinue
|
$u | set-adobject -Add $countryHash -Credential $cred -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user