Share via


PowerShell Script to set certain [msRTCSIP-] and [proxyAddresses] attributes in AD

Question

Wednesday, June 26, 2019 8:44 PM

My new company is using Aegis system to import all new hire accounts into active directory and our department needs a powershell script to overwrite the msRTCSIP- and proxyAddresses attributes in AD. We have been doing this manually and it is very time consuming as the company grows, can anybody assist. I am aware of the Get-Item and Set-ItemProperty but need a script with no errors. The suggested changes are below...

msRTCSIP-DeploymentLocator to 'sipfed.online.lync.com'

msRTCSIP-PrimaryUserAddress to '[email protected]'

Clear out msRTCSIP-OptionFlags

msRTCSIP-PrimaryUserAddress to '[email protected]'

Clear out msRTCSIP-UserPolicies

Clear out msRTCSIP-UserRoutingGroupId

All replies (2)

Wednesday, June 26, 2019 9:10 PM | 1 vote

This Forum is for   Scripting   Questions Rather than script requests

How to ask   questions in a technical forum

Forum for Script   requests

Microsoft   Script Gallery

      Microsoft Virtual     Academy - Getting Started with Microsoft PowerShell

      PowerShell Documentation

      PowerShell Style   Guidelines

\(ツ)_/


Wednesday, June 26, 2019 9:12 PM

This might help, I have not checked the script:

$attributes_remove = @(
    'msRTCSIP-OptionFlags',
    'msRTCSIP-UserPolicies' ,
    'msRTCSIP-UserRoutingGroupId' 
)

$User = Get-ADUser -Identity USER -Properties Mail # Or some other filter or iterating through CSVs
Set-ADUser $user.SamAccountname -Clear $attributes_remove # To remove/clear the attributes
Set-ADUser $user.SamAccountname -Replace @{'msRTCSIP-PrimaryUserAddress' = $user.Mail; 'msRTCSIP-DeploymentLocator' = 'sipfed.online.lync.com'}