Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $OU = ''
- $userpool = Get-ADUser -Filter * -SearchBase $OU -Properties mobile | Select-Object SamAccountName, Mobile
- foreach ($user in $userpool)
- {
- if ($user.mobile[0] -eq '8')
- {
- $user.mobile = '+7' + $user.mobile.Substring(1,$user.mobile.Length - 1)
- }
- if ($user.SamAccountName.Length -ge 2)
- {
- $user.mobile = $user.mobile -replace ('[^\w+]','')
- $goodNumber = $user.mobile.Insert(2," ").Insert(6, " ").Insert(10, " ")
- Set-ADUser $user.SamAccountName -Replace @{mobile=$goodNumber}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement