adding Company Info
This commit is contained in:
parent
9e5bc812ca
commit
001bb952c6
26
Set-UserAttributeDefaults.ps1
Normal file
26
Set-UserAttributeDefaults.ps1
Normal file
@ -0,0 +1,26 @@
|
||||
<#
|
||||
Sets user Country and Company Fields
|
||||
|
||||
#>
|
||||
|
||||
if (!($cred)) {
|
||||
|
||||
$cred = Get-Credential
|
||||
}
|
||||
$countryHash = @{
|
||||
# canada is 124
|
||||
countryCode = 0124
|
||||
}
|
||||
$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
|
||||
foreach ($u in $User) {
|
||||
$u | Set-ADUser -Company $CompanyName
|
||||
$u | Set-ADUser -Country 'CA' -Credential $cred
|
||||
if ($u.countryCode -eq 0 ) {
|
||||
Write-Output $u.Name
|
||||
$u | set-adobject -Add $countryHash -Credential $cred -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user