Enable new Lync users being member of an AD group RRS feed

  • Question

  • Hi.

    I am trying to make a script enabling users til Lync being a member of an Active Directory group "TestLync"

    Users allready created should be ignored

    At the moment there is only one user in the group: "Testuser Testuser"

    I have no experience in Powershell but found something by Google

    Import-Module activedirectory
    Import-Module lync
    $groupmember = Get-ADGroupMember TestLync
    foreach ($member in $groupmember)
    $aduser = Get-CsAdUser -Identity $member.Name | Where-Object {$_.enabled -ne "true"}
    if($aduser -ne $())
    Enable-CsUser -identity $aduser.identity -RegistrarPool -SipAddressType emailaddress

    When I run this script I get this error:

    Get-CsAdUser : Management object not found for identity "Testuser Testuser ".
    At line:3 char:23
    + $aduser = Get-CsAdUser <<<<  -Identity $member.Name | Where-Object {$_.enabled -ne "true"}
        + CategoryInfo          : InvalidData: (Testuser Testuser :UserIdParameter) [Get-CsAdUser], ManagementException + FullyQualifiedErrorId : Identity,Microsoft.Rtc.Management.AD.Cmdlets.GetAdUserCmdlet

    What does this error message mean?



    Tuesday, March 20, 2012 2:12 PM


All replies