Requesting help to put commands into a script for MS Lync


I am still pretty new to PS, and put together a process on how to enable metro users for my company within Lync. 

I have been using the below commands, which work perfectly to enable a user in Lync, but am unsure how to put it together as a script so the rest of my team can use it.

Any assistance would be greatly appreciated. 


Locate User in <Host domain> Contact Object

Get-QADObject "<Last, First>" -Service <domain> -IncludeAllProperties | fl name,msrtc*,dn


Obtain Users Native Sid – (Users’ metro domain)

Get-QADObject "<Last, First>" -Service '<domain>' -Credential $.admincreds.<acct> | fl name,sid,PrimarySMTPAddress


Set Users Native Sid on <host domain> Contact Object

Set-QADObject '<DN>' -Service <host domain> -Credential $.admincreds.<acct> -ObjectAttributes @{ 'MsRTCSIP-OriginatorSID' = '<Sid>' }


Set Users OriginatingForest

Set-QADObject '<DN>' -Service <host domain> -Credential realogy\adornchrx -ObjectAttributes @{ 'msExchOriginatingForest' = '<domain>' }


Enable User in Lync


That is what I have so far.

Enable-CsUser -Identity '<DN>' -SipAddress "sip:<FIrst.Last>" -RegistrarPool 'lync-pool1.<domain>'