Move-CSLegacyUser : Object not set to an instance of an Object

twitterlinkedinmail

Environment:

Office Communications Server 2007R2 to Lync Server 2013 Migration

Servers: Office Communications Server 2007 R2 (OCS2007R2), Lync Server 2013 (will be upgraded to Skype for Business Server when OCS2007R2 is decommissioned)

Issue:

The Lync Server 2013 had been setup, and the OCS2007R2 configuration has been merged with the topology.

Our next step was to move a user from OCS2007R2 to Lync Server 2013 we tried using Lync Server 2013 Control Panel and also Lync Server 2013 Management Shell same issue both times.

Move-CSLegacyUser -identity UserA -Target LyncPool.domain.ca resulted with the error:

Move-CSLegacyUser : Object not set to an instance of an Object

Move-CSLegacyUserError

So one would think that since the migration failed that the user could still sign into OCS2007R2, well we thought wrong! When the user signs into OCS2007R2 they receive an error:

Cannot sign in because the server is temporarily unavailable. If the problem persists, contact your system administrator.

OCS2007R2-SigninError

So we now we’re stuck , can’t sign into OCS2007R2 or Lync Server 2013.

Resolution:

Here is what was done in order to sign back into OCS2007R2 and then migrate the user over to Lync Server 2013.

We need to modify the Users AD Attributes so ensure you have the proper permissions.

  1. Remote Desktop to Domain controller or your Lync Server 2013
  2. Open up Active Directory Users and Computers
  3. Click View -> Advanced Features
  4. Find the user you tried to move over, and bring up their properties
  5. Select Attribute Editor Tab and scroll down to MSRTCSIP-PrimaryHomeServer
  6. Validate that this is still the OCS2007R2 server if not, find a user currently on OCS2007R2 and copy the details from there.
  7. Scroll down to MSRTCSIP-TargetHomeServer and MSRTCSIP-TargetUserPolicies and clear each entryOCS2007R2-ADUserAttributes

Now we need to fix the user on OCS2007R2

  1. Remote Desktop to the OCS2007R2 server
  2. Opened SQL Management Studio and connected to the SQLExpress
  3. First we need to find the ResourceId of UserA
  4. Start a new Query:
    1. Use RTC
    2. select * from dbo.Resource where UserAtHost = ‘UserA@domain.ca’
    3. Make not of the ResourceId
  5. Now we need to find out the row UserA’s configuration is setup with
  6. Start a new Query:
    1. Use RTC
    2. Select * from HomedResource where ResourceId = <ID Number from step 4>
  7. It returned:
    1. OCS2007R2-SQLQueryHomedResource
  8. The MovingAway and Unavailable values were set to 1
  9. Changed the values from to 1
  10. The user was now able to sign into OCS2007R2

Ok so now that we got the user back to where they were here is how we got them over to Lync Server 2013

  1. First we have to backup the users contact list on OCS2007R2
    1. Single User:
      1. Open a command prompt as administrator
      2. Browse to C:\Program Files\Common Files\Office Communications Server 2007 R2\Support
      3. Type the following command: dbimpexp.exe /user:<Sip Address> /hrxmlfile:”<FilePath>:\Username.xml”
    2. All Users:
      1. Open a command prompt as administrator
      2. Browse to C:\Program Files\Common Files\Office Communications Server 2007 R2\Support
      3. Type the following command: dbimpexp.exe /hrxmlfile:”<FilePath>:\AllUsers.xml”
  2. Move the User from OCS2007R2 to Lync Server 2013 (by forcing the user to move this will clear the contact list of the user)
    1. Open Lync Server 2013 Management Shell as administrator
    2. Type the following command: Move-CsLegacyUser -Identity “Username” -Target “Domain.ca” –ExcludeConferencingPolicy –ExcludeExternalAccessPolicy – Force
  3. Now we have to convert the xml file to a useable Lync Server 2013 format
    1. Single User:
      1. Copy the XML file to c:\Temp or another location on the Lync Server 2013
      2. Open Lync Server 2013 Management Shell as administrator
      3. Browse to C:\temp or the location the file was copied
      4. Type the following command: Convert-CsUserData -InputFile .Username.xml -OutputFile .Username.zip -TargetVersion current
    2. All Users:
      1. Copy the XML file to c:\Temp or another location on the Lync Server 2013
      2. Open Lync Server 2013 Management Shell as administrator
      3. Browse to C:\temp or the location the file was copied
      4. Type the following command: Convert-CsUserData -InputFile .Allusers.xml -OutputFile .AllUsers.zip -TargetVersion current
  4. Now we need to update the user with their contact list
    1. Single User:
      1. Open Lync Server 2013 Management Shell as administrator
      2. Type the following command: Update-CsUserData -Filename “C:\Temp\Username.zip” -UserFilter “<Sip Address>”
      3. Once command has completed , validate the user now has their contact list
    2. All Users:
      1. Open Lync Server 2013 Management Shell as administrator
      2. Type the following command: Update-CsUserData -Filename “C:\Temp\AllUsers.zip”
      3. Once the command has completed , validate the users now have their contact list

Now we can force move the user from OCS2007R2 to Lync Server 2013 and import their contact list.

Move-CsLegacyUser -Identity UserA@domain.ca -Target Lyncpool.domain.ca -ExcludeConferencingPolicy -ExcludeExternalAccessPolicy -Verbose -force -Confirm:$false

Update-CsUserData -FileName “C:\SfB\ExportedXML\AllUsers3.zip” -UserFilter UserA@Domain.ca -Confirm:$false

 

twitterlinkedinmail

6 comments on “Move-CSLegacyUser : Object not set to an instance of an Object

  1. Thanks for the information, I have run into the same issue. Do you have any insight on what the cause of the “Object not set to an instance of an Object” error is?

  2. I was seeing the same issue after we applied Aug 2016 Rollup updates. Tried multiple things but nothing helped. then tried using -force with move-cslegacyuser and it worked.

  3. Hi,
    thanks for the help on this matter, I ran into this issue a few weeks ago and this workaround is helping me in the migration process.
    I had a question. I already migrated some users for testing to the Lync 2013 environment.
    Once I am confident to move all the rest, will the procedure to move all users will affect the current users that are already there?
    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

*