Solved

Move or Enable Lync Clients

Posted on 2011-09-15
3
2,429 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

A brief introduction to what I consider to be the best editor for PowerShell.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

624 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