This article is part of the Microsoft Lync Server 2010 Administration Guide: PowerShell Supplement .
Search for Lync Server 2010 Users
- To search for one or more users
To search for a user based on the value of a Microsoft Lync Server-specific attribute, use the Get-CsUser cmdlet and the Filter parameter. For example, this command searches for all users who have not been assigned a per-user voice policy:
Get-CsUser -Filter {VoicePolicy -eq $Null}
To search for a user based on the value of a generic Active Directory attribute, use the Get-CsUser cmdlet and the LdapFilter parameter. For example, this command searches for all users who are members of the Finance department:
Get-CsUser -LDAPFilter "Department=Finance"
For more information:
Add a New User to Lync Server 2010
- To create a new Lync Server user
To enable a user to use Lync Server, use the Enable-CsUser cmdlet:
Enable-CsUser -Identity "Pilar Ackerman" -RegistrarPool "atl-cs-001.litwareinc.com" -SipAddressType SamAccountName -SipDomain litwareinc.com
The preceding command includes the SipAddressType and SipDomain parameters; this causes Lync Server to automatically create a SIP address for the user based (in this case) on the user's SamAccountName and the domain name litwareinc.com. Alternatively, you can use the SipAddress parameter to assign a specific SIP address to a user:
Enable-CsUser -Identity "Pilar Ackerman" -RegistrarPool "atl-cs-001.litwareinc.com" –SipAddress "sip:pilar@litwareinc.com"
For more information
- 21 User Information Cmdlets to Run Before You Die
- Enabling a User for Microsoft Lync Server 2010
- Enabling a User for Microsoft Lync Server 2010 and Enterprise Voice
- The New Communications Server User Dialog
- Enable-CsUser
Enable or Disable Users for Lync Server 2010
- To disable or re-enable a previously enabled user account for Lync Server
To permanently disable a Lync Server user account, use the Disable-CsUser cmdlet:
Disable-CsUser –Identity "Ken Myer"
When you run the preceding command, the user's Lync account will be disabled and all Lync Server-related attributes (including the policies assigned to that user) will be deleted from the user account. (Note that the user's Active Directory user account will not be deleted.) If you later decide to once more give the user access to Lync Server you will need to re-run the Enable-CsUser cmdlet, reassign any per-user policies, and reset property values such as the user's line URI and SIP address.
To temporarily disable a Lync Server user account, use the Set-CsUser cmdlet to set the account's Enabled property to False:
Set-CsUser –Identity "Ken Myer" –Enabled $False
When you run the preceding command the user will still have a valid Lync Server account, and that account will retain all its current settings (including any per-user policies that have been assigned to the user). However, the user will not be able to log on to Lync Server until his or her account has been re-enabled.
To re-enable a user whose Lync Server account has been temporarily disabled, use the Set-CsUser cmdlet to set the account's Enabled property to True:
Set-CsUser –Identity "Ken Myer" –Enabled $True
For more information:
Set, View, and Send a User's Dial-in Conferencing PIN
- To set a user’s PIN
Lync Server PowerShell provides two different ways to assign a PIN number to a user. To have Lync Server randomly generate a PIN number for the user, use a command similar to this one:
Set-CsClientPin -Identity "Ken Myer"
The assigned PIN number will appear onscreen, like this:
Identity Pin PinReset
-------- --- --------
Sip:kmyer@litwareince.com 55279 True
Note . It will be up to you to notify the user of his or her new PIN number; Lync Server will not automatically send these notifications for you.
Alternatively, you can include the Pin parameter and assign a specific PIN number to a user:
Set-CsClientPin -Identity "Ken Myer" -Pin 18723834
You can also pipe multiple user accounts to Set-CsClientPin and Lync Server will automatically assign a new PIN number to each of those accounts. For example:
Get-CsUser –LdapFilter "Department=IT" | Set-CsClientPin
For more information:
Move Users to Another Pool
- To move selected users to a different server or pool
To move a user from one Registrar pool to another, use the Move-CsUser cmdlet:
Move-CsUser -Identity "Pilar Ackerman" -Target "atl-cs-001.litwareinc.com"
You can also move multiple users by piping more than one user Identity (in this case, the Active Directory display name) to the Move-CsUser cmdlet:
"Ken Myer", "Pilar Ackerman", "Aidan Delaney" | Move-CsUser -Target "atl-cs-001.litwareinc.com"
- To move all users from one server or pool to a different server or pool
To move all the users from a specified pool to a different pool, first use the Get-CsUser cmdlet to retrieve all the users from that pool; in the following command, the Filter value {RegistrarPool –eq "dublin-cs-001.litwareinc.com"} limits the returned user accounts to those users homed on the pool dublin-cs-001.litwareinc.com. That collection of user accounts can then be piped to the Move-CsUser cmdlet:
Get-CsUser -Filter {RegistrarPool –eq "dublin-cs-001.litwareinc.com"}| Move-CsUser -Target "atl-cs-001.litwareinc.com"
- To move users from one pool to a different pool by using a filter
To move a selected group of users (based on an Active Directory attribute) first use the Get-CsUser cmdlet and the LdapFilter parameter to retrieve the desired set of users. After retrieving the appropriate user accounts you can then pipe all those accounts to the Move-CsUser cmdlet:
Get-CsUser -LdapFilter "Department=Finance" | Move-CsUser -Target "atl-cs-001.litwareinc.com"
For more information:
Assign Policies to Users
Assign a Conferencing Policy to Modify a User's Default Meeting Experience