Link to home
Start Free TrialLog in
Avatar of Pumpernickel
PumpernickelFlag for United States of America

asked on

USMT 4.0 VBScript

I'm using the "Script USMT 4.0 PC-to-PC" (http://gallery.technet.microsoft.com/scriptcenter/f20a0a75-c903-4548-9bb4-e38fba0802ee).  I copied robocopy to the XP machine and I put pstools and the x86, x64 usmt from the Windows AIK in there.  

After I run the VB script, it fails when it gets to the "Executing Loadstate on <new_machine> ...... Failure(27)"

The only thing in the log files are:
2012-04-23 09:59:15, Info                  [0x000000] USMT Started at 2012/04/23:09:59:15.655
2012-04-23 09:59:15, Info                  [0x000000] Command line: \\USMT_DESKTOP\usmt$\x64\loadstate.exe c:\Temp\MigData\USERNAME\OLD_MACHINE /v:13 /i:\\USMT_DESKTOP\usmt$\x64\Migapp.xml /i:\\USMT_DESKTOP\usmt$\x64\MigDocs.xml /i:\\USMT_DESKTOP\usmt$\x64\miguser.xml /progress:c:\Temp\MigData\USERNAME\LoadStateProg.log /l:c:\Temp\MigData\USERNAME\LoadState.log /ui:Nash\USERNAME /c
¿2012-04-23 09:59:15, Status                [0x000000] Activity: 'MIGACTIVITY_COMMAND_LINE_PROCESSING'
2012-04-23 09:59:15, Info                  [0x000000] Failed.[gle=0x00000006]
2012-04-23 09:59:15, Info                  [0x000000]   USMT Status 1059 (INVALID_STORE_PATH): An error occurred processing the command line.
  Invalid store path; check the store parameter and/or file system permissions[gle=0x00000006]
2012-04-23 09:59:15, Info                  [0x000000] USMT Completed at 2012/04/23:09:59:15.702[gle=0x00000006]
¿2012-04-23 09:59:15, Info                  [0x000000] Entering MigShutdown method
2012-04-23 09:59:15, Info                  [0x000000] Leaving MigShutdown method




Any ideas?
Avatar of Bartender_1
Bartender_1
Flag of Canada image

http://technet.microsoft.com/en-us/library/dd823291(v=ws.10).aspx

The above states that there are a few things that could be causing this error 27, the most common is the store is not accessible or does not have proper permissions (for the target machine)

Could you check to ensure the path is correct, and  that the permissions are correct?

One other thing stated is that there might be an existing store already present, so you should use the /o switch to overwrite.

Hope this helps!

:o)

Bartender_1
Avatar of Pumpernickel

ASKER

I was looking at that actaully a few min ago, and it looks like Robocopy isn't even copying the .mig file to the new machine... I think the problem is with robocopy... I just have to lookup the switch for logging on robocopy so I can see what the error is
Yup, robocopy isn't copying the data.  

2012/04/23 11:27:40 ERROR 5 (0x00000005) Creating Destination Directory \\NEW_COMPUTER\c$\Temp\MigData\
Access is denied.
You'll need to ensure that robocopy has permission to write to that directory on the new machine. Is there a common account for both machines?
Hmm It can't even read whats in the new machines files...

2012/04/23 11:36:13 ERROR 5 (0x00000005) Getting File System Type of Destination \\NEW_COMPUTER\c$\Temp\MigData\
Access is denied.


The script never prompts for a username and password... I figured psexec was using my user account to execute the commands
Heres the robocopy command in the script

Sub CopyUSMTData()

      REM Define Local Objects
      DIM FSO    : SET FSO    = CreateObject("Scripting.FileSystemObject")
      DIM oShell : SET oShell = CreateObject("Wscript.Shell")

      REM Define Local Variables
      DIM SourceUSMTPath : SourceUSMTPath = "\\" & OldComputer & "\c$\Temp\MigData"
      DIM DestUSMTPath   : DestUSMTPath   = "\\" & NewComputer & "\c$\Temp\MigData"
      DIM Parameters     : Parameters     = "/e /eta /mir /log:log.txt"
      DIM RemoteExec     : RemoteExec     = USMTLocation & "PSTools\PsExec.exe \\" & OldComputer &_
                                                            Chr(32) & "-s" & Chr(32)
      DIM RoboCopyCMD    : RoboCopyCMD    = RemoteExec & "RoboCopy.exe" & Chr(32) & SourceUSMTPath & Chr(32) & DestUSMTPath &_
                                                            Chr(32) & Parameters

      objIE.Document.WriteLn "Copying USMT folder from " & OldComputer & " to " & NewComputer & "....."
      oShell.Run RoboCopyCMD, 7, True
      If FSO.FolderExists(DestUSMTPath) then
            objIE.Document.WriteLn "Success" & "<BR><BR>"
      else
            objIE.Document.WriteLn "Failure" & "<BR><BR>"
      End If
      
      REM Cleanup Variables
      Set FSO            = Nothing
      Set oShell         = Nothing
      SET SourceUSMTPath = Nothing
      SET DestUSMTPath   = Nothing
      Set Parameters     = Nothing
      Set RemoteExec     = Nothing
      Set RoboCopyCMD    = Nothing

End Sub
Is this something you're working on to migrate a bunch of accounts, or just this one time?

I can see 2 ways through this easily,

1. Create an account on the target machine with read/write access to c:\temp\migdata, or
2. Change permissions on "C:\temp\migdata" folder to allow everyone to read/write

If this is a one time deal, I'd say give read/write access to the folder to everyone so it can be done quickly, just make sure to delete the data from that folder once you are sure the transfer is done, so no-one can access it without authorization.

If this is a setup that will be used multiple times on multiple machines, I'd recommend sorting out an account that can have read/write access on all the machines, and run the scripts all under that account.

:o)

Bartender_1
Even if an account was created... Where would this account be put... The script doesn't call for one, so I'm guessing it would have to be put in psexec.exe -u username -p password ?
Are these computers a part of a domain? If so, run the scripts with an Admin account, if they are not part of a domain, then I would create a duplicate account on the target machine, with the same username/password as the source machine.
Does it matter if this script is ran from a remote machine or should it be ran on the machine you are transferring the settings from?
ASKER CERTIFIED SOLUTION
Avatar of Bartender_1
Bartender_1
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I was running it from a remote machine.  I will try them both now.  Should I be logged in as the user whos profile needs to be transfer or should it be another account?
It should work when logged in as the user whose profile is being transferred.
Still the same error on either machine with robocopy:


-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows     ::     Version XP010
-------------------------------------------------------------------------------

  Started : Mon Apr 23 14:08:20 2012

2012/04/23 14:08:21 ERROR 5 (0x00000005) Getting File System Type of Destination \\NEW_MACHINE\c$\Temp\MigData\
Access is denied.


   Source : \\OLD_MACHINE\c$\Temp\MigData\
     Dest - \\NEW_MACHINE\c$\Temp\MigData\

    Files : *.*
          
  Options : *.* /S /E /COPY:DAT /PURGE /MIR /ETA /R:1000000 /W:30

------------------------------------------------------------------------------

2012/04/23 14:08:21 ERROR 5 (0x00000005) Creating Destination Directory \\NEW_MACHINE\c$\Temp\MigData\
Access is denied.
It's odd that the system is having issues creating the directory.

Can you try changing the target destination directory, try something like:

\\new_machine\c$\migdata
I got it to finally work, I removed the -s from the command so its uses the currently logged in account.  So as long as that person is an admin on the machines, it will work.

DIM RemoteExec     : RemoteExec     = USMTLocation & "PSTools\PsExec.exe \\" & OldComputer &_
                                                            Chr(32) & "-s" & Chr(32)

So it should be:
      DIM RemoteExec     : RemoteExec     = USMTLocation & "PSTools\PsExec.exe \\" & OldComputer &_
                                                            Chr(32) & "" & Chr(32)
Avatar of net-fusion
net-fusion

I keep getting the below error:
2013-08-28 13:24:48, Info                  [0x000000] USMT Started at 2013/08/28:13:24:48.962
2013-08-28 13:24:48, Info                  [0x000000] Command line: \\MININT-1ABF79\Datastore\USMTLocation\x86\loadstate.exe c:\Temp\MigData\daveni\A11001C234E3589 /v:13 /i:\\MININT-1ABF79\Datastore\USMTLocation\x86\Migapp.xml /i:\\MININT-1ABF79\Datastore\USMTLocation\x86\MigDocs.xml /i:\\MININT-1ABF79\Datastore\USMTLocation\x86\miguser.xml /progress:c:\Temp\MigData\daveni\LoadStateProg.log /l:c:\Temp\MigData\daveni\LoadState.log /ui:office\daveni /c
¿2013-08-28 13:24:48, Status                [0x000000] Activity: 'MIGACTIVITY_COMMAND_LINE_PROCESSING'
2013-08-28 13:24:48, Info                  [0x000000] Failed.[gle=0x00000003]
2013-08-28 13:24:48, Info                  [0x000000]   An error occurred processing the command line.
  Invalid store path; check the store parameter and/or file system permissions[gle=0x00000003]
2013-08-28 13:24:48, Info                  [0x000000] USMT Completed at 2013/08/28:13:24:48.962[gle=0x00000003]
¿2013-08-28 13:24:48, Info                  [0x000000] Entering MigShutdown method
2013-08-28 13:24:48, Info                  [0x000000] Leaving MigShutdown method
Don't mean to highjack this thread but does anyone know where to get the script mentioned above? When I select the link provided I get a message saying that the resource hasn't been published yet.

Thanks
It looks as if a copy of the script has been loaded here: http://mickitblog.blogspot.ca/2012/04/usmt-40-pc-to-pc.html


As with any script from the internet, please take all necessary precautions to protect your data before using. (Better safe than sorry!)


Bartender_1