Solved

Move or Enable Lync Clients

Posted on 2011-09-15
3
2,351 Views
Last Modified: 2012-05-12
I found this script on liine and when I run it, I keep getting the following error

http://blogs.technet.com/b/csps/archive/2010/06/10/scriptmoveusers.aspx

Transcript started, output file is MoveorEnableUsers2011-09-15T11-05-42.txt
Enable-CsUser : Cannot bind parameter 'SipAddress' to the target. Exception set
ting "SipAddress": "Value cannot be null.
Parameter name: address"
At C:\scripts\MoveOrEnableUsers.ps1:32 char:52
+         Enable-CsUser $importeduser.UPN -SipAddress <<<<  `
    + CategoryInfo          : WriteError: (:) [Enable-CsUser], ParameterBindin
   gException
    + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.Rtc.Management.
   AD.Cmdlets.EnableOcsUserCmdlet
 
I'm launching this powershell script from the Lync Management shell.
My csv file looks like this:  Does this command need to be in the same cell? At the moment I have them in Row1 Column A, Row2 Column B and Row 3 Column C
            A                                                   B                              C
SipUri,MoveorEnable,Target,UPN            
sip:joe.user1@domain.com      move      "hplync.domain.com"
sip:joe.user2@domain.com      move      "hplync.domain.com"

Should it look like this? All in the same row and column.
sip:joe.user1@domain.com,move,"hplync.domain.com"

Also, do you need the User Principal Name (UPN)?  The sip sign on is first name dot last name but the users AD principal name is first initial last name ( juser1@domain.com).

Finally, if the UPN is necessary could I use the variable %username%@domain.com

Thanks
0
Comment
Question by:jrobison
  • 2
3 Comments
 
LVL 9

Expert Comment

by:Benjamin MOREAU
ID: 36545613
You CSV must be like this :
SipUri,MoveorEnable,Target,UPN            
sip:joe.user1@domain.com, move,"hplync.domain.com"
sip:joe.user2@domain.com,move,"hplync.domain.com"

To check if all is ok; just run "import-csv youfile.csv"

You will see if powershell understand well your CSV file :)
0
 
LVL 1

Accepted Solution

by:
jrobison earned 0 total points
ID: 36546346
I figured it out ... Here's what worked.

First:  I did have to modify the csv file as well as the original script. For anyone else looking at this that's never done it before.

1.) Create the csv and save it. When you create the csv file make sure to add the sip information in seperate columns (Figure 1)

Example:
Column A                                        Column B            Column C
sip:joe.user1@domain.com             Move                   "YourLyncPoolName.domain.com"

2.) Next right click on the csv you just created and select "Edit" See attached (Figure 2)
You'll notice there are some additional quotes and commas.  Remove these and save to look like this (Figure 3)

Copy the modified csv to your lync server ( c:\scripts\users.csv)

Next modify the script provided here http://blogs.technet.com/b/csps/archive/2010/06/10/scriptmoveusers.aspx

To look like this (see below):  Since I was moving legacy accounts from my OCS R2 server and not enabeling them I had to modify the original move commed from Move-CsUser to Move-CsLegacyUser.  I also added the -Confirm:$False to the same line in order to avoid being prompted to enter yes when moving each and every account.  Also, I had to use this command ( .\moveorenableusers )  without the brackets in my Lync Management shell and not what was suggested in the original URL listed above.

And there you have. That's how I got mine to work.

param( [string] $importfile = $(Read-Host -prompt `
    "Please Enter File Path"))

$importedusers = Import-CSV $importfile

 

$transcriptname = "MoveorEnableUsers" + `
    (Get-Date -format s).Replace(":","-") +".txt"

Start-Transcript $transcriptname

 

foreach ($importeduser in $importedusers)

    {

        if ($importeduser.MoveorEnable -eq "Move")

            {

                Move-CsLegacyUser $importeduser.SipUri -target `
                   $importeduser.Target -verbose -Confirm:$False

            }

        else

    {

        Enable-CsUser $importeduser.UPN -SipAddress `
            $importeduser.SipUri -RegistrarPool `
            $importeduser.Target -Verbose

    }

 

 

    }

Stop-Transcript






Figure1.jpg
figure2.jpg
figure3.jpg
0
 
LVL 1

Author Closing Comment

by:jrobison
ID: 36565523
This is the solution that I figured out in my lab that worked for my issue.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question