Solved

Move or Enable Lync Clients

Posted on 2011-09-15
3
2,294 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
Comment Utility
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
Comment Utility
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
Comment Utility
This is the solution that I figured out in my lab that worked for my issue.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
A procedure for exporting installed hotfix details of remote computers using powershell
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now