Remove periods from Variable
i trying automate enrolling users lync. the query finds users not lync enabled , gets data user. $nolync = get-csaduser -ldapfilter "employeenumber=primary" -ou "ou=users,dc=domain,dc=com" | where-object {$_.enabled -eq $null}
so query finds users in users ou of account type primary , not lync enabled. for user enrolled in lync need telephonenumber attribute not contain periods. however due how user accounts provisioned, telephone number contain 111.222.3333.
i need telephonenumber attribute users in $nolync have value 111222333
so in short need query (as did above) go through each user , remove periods telphonenumber attribute, after done, can @ $nolync , see origional query expetion telephonenumber attribute contain no periods or special characters.
help appreciated.
sure.
$nolync = get-csaduser -ldapfilter "employeenumber=primary" -ou "ou=users,dc=domain,dc=com" | where-object {$_.enabled -eq $null} | select * foreach ($csaduser in $nolync) { $csaduser.telephonenumber = 'tel:+1{0}' -f ($csaduser.telephonenumber -replace '[^\d]') }
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Windows Server > Windows PowerShell
Comments
Post a Comment