marrj
asked on
Powershell - Enable Lync 2013 Users Based on Group Membership
I am trying to write a Powershell script that enables Lync users based on their AD group membership.
http://blogs.technet.com/b/meacoex/archive/2011/04/24/powershell-script-get-group-members-and-check-for-users-that-are-not-enabled-for-lync-and-enable-these-users-using-e-mail-address.aspx
I found this script, but it doesn't work. I get this error.
Enable-CsUser : Cannot convert 'System.Object[]' to the type 'Microsoft.Rtc.Management. AD.UserIdP arameter' required by parameter 'Identity'. Specified method is not supported.
At C:\Scripts\Lync_Test_Enabl e.ps1:9 char:25
+ Enable-CsUser -identity $aduser.identity -RegistrarPool lyncse.coex.com -SipAddr ...
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Enable-CsUser], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Micr osoft.Rtc. Management .AD.Cmdlet s.EnableOc sUserCmdle t
Any ideas on how to make this a functional script and satisfy the identity parameter?
http://blogs.technet.com/b/meacoex/archive/2011/04/24/powershell-script-get-group-members-and-check-for-users-that-are-not-enabled-for-lync-and-enable-these-users-using-e-mail-address.aspx
I found this script, but it doesn't work. I get this error.
Enable-CsUser : Cannot convert 'System.Object[]' to the type 'Microsoft.Rtc.Management.
At C:\Scripts\Lync_Test_Enabl
+ Enable-CsUser -identity $aduser.identity -RegistrarPool lyncse.coex.com -SipAddr ...
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Enable-CsUser], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Micr
Any ideas on how to make this a functional script and satisfy the identity parameter?
I really cannot take credit for this; but Lasse Nordvik Wedø ---- Lync Master:
http://tech.rundtomrundt.com/p/lync-ps-commands.html
http://tech.rundtomrundt.com/p/lync-ps-commands.html
ASKER
Thanks, but I'm having trouble getting either one of these methods to work.
Subsun, I get an error stating that the "Get-CsAdUser" cannot accept pipelined input or the parameters dont' match the cmdlet being piped.
jakob_di, I believe the "foreach" is missing a parameter or two. It won't run in its current state.
Any more ideas?
Subsun, I get an error stating that the "Get-CsAdUser" cannot accept pipelined input or the parameters dont' match the cmdlet being piped.
jakob_di, I believe the "foreach" is missing a parameter or two. It won't run in its current state.
Any more ideas?
ASKER
jakob_di, I finally got your version to get past the foreach loop, but I run into problems when satisfying the Identity requirement of the CS command, as Get-ADGroupMember.Name does not return something that is usable by the Enable-CsUser command, just as I ran into with my own version.
ASKER
THis is what pointed me to the use of the "Get-CsAdUser" cmdlet, but I get a similar error about mismatched properties when using it as well.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome! That worked.
What does the %{} do exactly?
What does the %{} do exactly?
% is an alias for ForEach-Object which i used to loop through the results of command Get-ADGroupMember
Refer following article to know more details about ForEach-Object
http://ss64.com/ps/foreach-object.html
Refer following article to know more details about ForEach-Object
http://ss64.com/ps/foreach-object.html
Open in new window