Thursday, October 25, 2012

XML file for Migrating “My Network Places” using USMT 4.0

Here is the XML file which allow Migrating “My Network Places” using USMT.
Migration is from Windows XP to Windows 7.
This XML copies content from:

C:\Documents and Settings\%users%\NetHood      to
C:\Users\%users%\AppData\Roaming\Microsoft\Windows\Network Shortcuts

**************************************************************
<migration urlid="http://www.microsoft.com/migration/1.0/migxmlext/test"&gt;
<component type="Documents" context="User">
  <displayName>Moving My Network Places</displayName>
  <role role="Data">
    <rules>
      <include>
        <objectSet>
          <pattern type="File">%CSIDL_NETHOOD%\* [*]</pattern>
        </objectSet>
      </include>
      <locationModify script="MigXmlHelper.RelativeMove('%CSIDL_NETHOOD%\','%CSIDL_NETHOOD%\')">
        <objectSet>
          <pattern type="File">%CSIDL_NETHOOD%\* [*]</pattern>
        </objectSet>
      </locationModify>
    </rules>
  </role>
</component>
</migration> 

****************************************************************
Variable CSIDL_NETHOOD in Windows XP is: C:\Documents and Settings\username\NetHoodA path for same variable for Windows Vista or Windows 7 is : C:\Users\Username\AppData\Roaming\Microsoft\Windows\Network Shortcuts



 

Wednesday, October 17, 2012

USMT 4.0, ScanState VBS script

Here is very useful vbs script which execute ScanState on local machine, asking for a user name and location (local or network) share and gives results in HTML.

 Before to start you should specify few variables inside the script.

 '******************************************************************************
Option Explicit 

 REM Define Global Constants 
  CONST NetDomain = "test.local" 
 ' Specifies where to find the USMT executables 
 CONST USMTLocation = "\\srv2003dc1\FolderMig\USMT\X86"  
 ' Specifies where to write the MIG file locally 
 CONST USMTLocalStore = "c:\USMT_MIG\" 
 ' Specifies where to write the MIG file on the network share 
 CONST USMTNetworkStore = "\\srv2003dc1\FolderMig\TEST\" 

 REM Define Global Objects 
 DIM objIE : Set objIE = CreateObject("InternetExplorer.Application") 

 REM Define Global Variables 
 DIM OldComputer   : Set OldComputer = Nothing 
 DIM ReturnCode    : ReturnCode      = "0" 
 DIM UserName      : Set UserName    = Nothing 
 DIM USMTOutput    : Set USMTOutput  = Nothing 
 DIM USMTDestCMD   : USMTDestCMD     = "0" 

  
 CreateDisplayWindow() 
 GetComputerInfo() 
 CreateUSMTFolders() 
 USMTMigrate() 
 GlobalVariableCleanUp() 

 '******************************************************************************  

 Sub CreateDisplayWindow() 

      REM Define Local Constants 
      CONST strComputer = "." 

      REM Define Local Objects 
      DIM objWMIService : Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 
      DIM colItems      : Set colItems      = objWMIService.ExecQuery ("Select PelsWidth,PelsHeight From Win32_DisplayConfiguration") 
      DIM objItem       : Set objItem       = Nothing 

      REM Define Local Variables 
      DIM intWidth        : intWidth  = 320 
      DIM intHeight       : intHeight = 240 
      DIM intScreenWidth  : Set intScreenWidth  = Nothing 
      DIM intScreenHeight : Set intScreenHeight = Nothing 

      For Each objItem in colItems 
           intScreenWidth  = objItem.PelsWidth 
           intScreenHeight = objItem.PelsHeight 
      Next 
      objIE.Navigate "about:blank" 
      objIE.Toolbar    = 0 
      objIE.StatusBar  = 0 
      objIE.AddressBar = 0 
      objIE.MenuBar    = 0 
      objIE.Resizable  = 0 
      While objIE.ReadyState <> 4 
           WScript.Sleep 100 
      Wend 
      objIE.Left = (intScreenWidth / 2) - (intWidth / 2) 
      objIE.Top = (intScreenHeight / 2) - (intHeight / 2) 
      objIE.Visible = True 

      REM Cleanup Local Variables 
      Set colItems        = Nothing 
      Set intScreenWidth  = Nothing 
      Set intScreenHeight = Nothing 
      Set intWidth        = Nothing 
      Set intHeight       = Nothing 
      Set objItem         = Nothing 
      Set objWMIService   = Nothing 

 End Sub 

 '****************************************************************************** 

 Sub GetComputerInfo() 

      DIM wshNetwork : Set wshNetwork = WScript.CreateObject( "WScript.Network" )
      OldComputer = wshNetwork.ComputerName

      UserName    = InputBox( "Enter the username:" ) 
      USMTOutput  = MsgBox("Output USMT to Network Location?", 4) 
      If USMTOutput = 6 then 
           USMTOutput = USMTNetworkStore & UserName & "\" & OldComputer 
      Else 
           USMTOutput = USMTLocalStore & UserName & "\" & OldComputer 
      End If 
      objIE.Document.WriteLn "USMT migration of " & UserName & " from " & OldComputer & " to " & USMTOutput &_ 
                                    Chr(32) & "




 End Sub 

 '******************************************************************************

 Sub CreateUSMTFolders() 

      On Error Resume Next 
      REM Define Local Objects 
      DIM FSO    : SET FSO    = CreateObject("Scripting.FileSystemObject") 
      DIM oShell : Set oShell = WScript.CreateObject("WScript.Shell") 

      REM Define Local Variables 
      DIM CreateFolder : CreateFolder = "cmd.exe /c md" & Chr(32) & USMTOutput 
      objIE.Document.WriteLn "Creating USMT Folders....." 

      REM Create the USMT folders if they do not exist 
      If NOT FSO.FolderExists(USMTOutput) then 
           oShell.Run CreateFolder, 7, True 
      End If 

      REM Cleanup Local Variables 
      Set FSO          = Nothing 
      Set CreateFolder = Nothing 
      Set oShell       = Nothing 

 End Sub

 '****************************************************************************** 

 Sub USMTMigrate() 

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

      REM Define Local Variables 
      DIM Debug       : Debug       = "13" 
      DIM IgnoreProfs : IgnoreProfs = "cmd.exe /c Set MIG_IGNORE_PROFILE_MISSING=1" 
      DIM USMT        : USMT        = USMTLocation & "\scanstate.exe " & USMTOutput & Chr(32) & "/v:" & Debug & Chr(32) & "/i:" &_ 
                                               USMTLocation & "\Migapp.xml" & Chr(32) & "/i:" &_ 
                                              USMTLocation & "\miguser.xml" & Chr(32)  &_ 
                                              "/progress:" & USMTOutput & "\ScanStateProg.log" & Chr(32) & "/l:" & USMTOutput & "\ScanState.log" &_ 
                                              Chr(32) & "/ui:" & UserName & Chr(32) & "/ue:*\* /c /vsc" 

      objIE.Document.WriteLn "Executing Scanstate on " & OldComputer & "....." 
      ReturnCode = oShell.Run(IgnoreProfs, 7, True) 
      ReturnCode = oShell.Run(USMT, 7, True) 
      If ReturnCode = "0" Then 
           objIE.Document.WriteLn "Success" & "


      else 
           objIE.Document.WriteLn "Failure(" & ReturnCode & ")" & "


      End If 

      REM Cleanup Variables 
      Set Debug       = Nothing 
      SET IgnoreProfs = Nothing 
      SET oShell      = Nothing 
      Set USMT        = Nothing 

 End Sub 

 '****************************************************************************** 

 Sub GlobalVariableCleanUp() 

      Set OldComputer   = Nothing 
      Set objIE         = Nothing 
      Set ReturnCode    = Nothing 
      Set UserName      = Nothing 
      Set USMTOutput    = Nothing 
      Set USMTDestCMD   = Nothing 

 End Sub 

Tuesday, October 16, 2012

IndirectKeyMapper: RegLoadKey ...C:\Documents and Settings\...\NTUSER.DAT) failed

Issue: USMT 4.0 ScanState.exe is stuck in the loop and it takes time to get done. This happens on the machine where the user is not properly removed, it means just User folder is deleted from C:\Documents and Settings but its registry settings still exist.


 In the Scan.log files different warnings show that the process is stuck on user3 which does not exist in C:\Documents and Settings.

To resolve this issue this command should be executed before to start ScanState command:



SET MIG_IGNORE_PROFILE_MISSING=1