Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Move or Enable Lync Clients

Posted on 2011-09-15
3
Medium Priority
?
2,531 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 10

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦
Screencast - Getting to Know the Pipeline

886 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