Solved

Move or Enable Lync Clients

Posted on 2011-09-15
3
2,365 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Synchronize a new Active Directory domain with an existing Office 365 tenant
A brief introduction to what I consider to be the best editor for PowerShell.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

821 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