Friday, 29 May 2015

Useful Powershell Commands - Lync Server 2010 / 2013


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=Test"


Add a New User

 To create a new Lync Server user

 To enable a user to use Lync Server, use the Enable-CsUser cmdlet:

 Enable-CsUser -Identity "John Smith" -RegistrarPool "gs-lab.pro.com" -SipAddressType SamAccountName  -SipDomain pro.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 "John Smith" -RegistrarPool "gs-lab.pro.com" –SipAddress "sip:john@pro.com"
 
 
 
Enable or Disable Users for Lync Server
 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 "John Smith"
 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 "John Smith" –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 "John Smith" –Enabled $True
 
 
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 "John Smith"
 The assigned PIN number will appear onscreen, like this:
 Identity                    Pin                PinReset
--------                     ---                --------
Sip:john@pro.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 "John Smith" -Pin 10122231
 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=Test" | Set-CsClientPin
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 "John Smith" -Target "gs-lab.pro.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:
 "John Smith", "Alex Branon", "Gareth Winner" | Move-CsUser -Target "gs-lab.pro.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 "gs-lab2.pro.com"} limits the returned user accounts to those users homed on the pool gs-lab2.pro.com. That collection of user accounts can then be piped to the Move-CsUser cmdlet:
 Get-CsUser -Filter {RegistrarPool –eq "gs-lab2.pro.com"}| Move-CsUser -Target "gs-lab.pro.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 "gs-lab.pro.com"
 Assign Policies to Users
 Assign a Conferencing Policy to Modify a User's Default Meeting Experience
 To assign a per-user conferencing policy
 To assign a per-user conferencing policy to a user, use a command similar to this, specifying the Identity of the per-user policy as the parameter value for the PolicyName parameter:
 Grant-CsConferencingPolicy –Identity "John Smith" –PolicyName "GLabConferencingPolicy"
 If you later decide to remove that conferencing policy (and thus have the user managed by the global policy or his or her site policy) use the following command, which sets the PolicyName property to a null value:
 Grant-CsConferencingPolicy –Identity "John Smith" –PolicyName $Null
Specify Client Versions Supported for Sign-in by a User
 To assign a per-user client version policy
 To assign a per-user client version policy to a user, use a command similar to this, specifying the Identity of the per-user policy as the parameter value for the PolicyName parameter:
 Grant-CsClientVersionPolicy –Identity "John Smith" –PolicyName "GLabClientVersionPolicy"
 If you later decide to remove that client version policy (and thus have the user managed by the global policy, a service policy, or his or her site policy) use the following command, which sets the PolicyName property to a null value:
 Grant-CsClientVersionPolicy –Identity "John Smith" –PolicyName $Null
 
 
Assign Specific Dial-in Conferencing PIN Security Settings to a User
 To assign a per-user PIN policy
 To assign a per-user PIN policy to a user, use a command similar to this, specifying the Identity of the per-user policy as the parameter value for the PolicyName parameter:
 Grant-CsPinPolicy –Identity "John Smith" –PolicyName "GLabPinPolicy"
 If you later decide to remove that PIN policy (and thus have the user managed by the global policy or his or her site policy) use the following command, which sets the PolicyName property to a null value:
 Grant-CsPinPolicy –Identity "John Smith" –PolicyName $Null
Apply External User Access Policies to Users
 To apply an external user policy to a user account
 To assign a per-user external access policy to a user, use a command similar to this, specifying the Identity of the per-user policy as the parameter value for the PolicyName parameter:
 Grant-CsExternalAccessPolicy –Identity "John Smith" –PolicyName "GLabExternalAccessPolicy"
 If you later decide to remove that external access policy (and thus have the user managed by the global policy or his or her site policy) use the following command, which sets the PolicyName property to a null value:
 Grant-CsExternalAccessPolicy –Identity "John Smith" –PolicyName $Null
 Configure Archiving of a User's Communications
To assign a per-user archiving policy
 To assign a per-user archiving policy to a user, use a command similar to this, specifying the Identity of the per-user policy as the parameter value for the PolicyName parameter:
Grant-CsArchivingPolicy –Identity "John Smith" –PolicyName "GLabArchivingPolicy"
If you later decide to remove that archiving policy (and thus have the user managed by the global policy or his or her site policy) use the following command, which sets the PolicyName property to a null value:
Grant-CsArchivingPolicy –Identity "John Smith" –PolicyName $Null
 
 
Assign a Location Policy to a User
To assign a per-user location policy
To assign a per-user conferencing policy to a user, use a command similar to this, specifying the Identity of the per-user policy as the parameter value for the PolicyName parameter:
 Grant-CsLocationPolicy –Identity "John Smith" –PolicyName "GLabLocationPolicy"
 Enable a User for Enterprise Voice
 To enable a user account for Enterprise Voice
 To enable a user for Enterprise Voice, use Set-CsUser to set the EnterpriseVoiceEnabled property to True and to assign the user a unique line URI:
Set-CsUser –Identity "John Smith" -EnterpriseVoiceEnabled $True –LineUri "TEL:+440207123456"
 Configure Telephony for Users
 To configure telephony for a specific user account
 To configure telephony options for a user, use the Set-CsUser cmdlet. The following command enables a user for Enterprise Voice and assigns that user a line URI:
 Set-CsUser –Identity "John Smith" –EnterpriseVoiceEnabled $True –LineUri "TEL:+440207123400"
 To enable remote call control for a user, use the following command:
 Set-CsUser –Identity "John Smith" -RemoteCallControlTelephonyEnabled $True –LineUri "TEL:+440207123400"
 This command enables PC-to-PC audio communications for the user, but without enabling either remote call control or Enterprise Voice:
 Set-CsUser –Identity "John Smith" –EnterpriseVoiceEnabled $False -RemoteCallControlTelephonyEnabled $False –LineUri "TEL:+440207123400"
 
 
 
 
 
 
 
 

 

 

No comments:

Post a Comment