.vbs scripts crashing
I am attempting offline usmt via two .vbs files. I keep getting errors on my scripts. Can someone take a look and give me a hand on these? first script: copy_and_runscanstate.vbs ------------------------------------ '========================================================================== ' VBScript Source File ' NAME: copy_and_runscanstate.vbs ' AUTHOR: mathias@haas.se ' DATE : 2011-04-13 ' COMMENT: v1.1 ' Does USMT hardlinking offline from WinPE. Thanks to Niall Brady for the idea. '============================================================================== Option Explicit Dim fso, wshell, sPath, sOSDStateStorePathArg Set fso = CreateObject("Scripting.FileSystemObject") Set wshell = CreateObject("WScript.Shell") sOSDStateStorePathArg = WScript.Arguments.Item(0) If fso.FolderExists (sOSDStateStorePathArg) = False Then fso.CreateFolder (sOSDStateStorePathArg) 'Store our migration data during scanstate operations If fso.FolderExists ("C:\USMT") = False Then fso.CreateFolder ("C:\USMT") 'Stores scanstate native files. If fso.FolderExists ("C:\Temp") = False Then fso.CreateFolder ("C:\Temp") 'Stores scanstate native files. sPath = wshell.CurrentDirectory wshell.Run ("cmd /c xcopy " & sPath & "\amd64 C:\USMT /hericy"),0,True ' Copies all relevant binaries and stuff to C:\usmt\amd64 wshell.Run ("cmd /c SET "&chr(34)&"USMT_WORKING_DIR=C:\Temp"&chr(34)&" & C:\USMT\scanstate.exe " & sOSDStateStorePathArg & " /c /o /hardlink /efs:hardlink /nocompress /offlinewindir:c:\windows /v:5 /l:c:\windows\temp\SMSTSLog\scanstate.log /i:c:\USMT\miguser.xml /i:c:\USMT\migapp.xml"),0,True WScript.Quit (0) ------------------------------------- receiving error line 16, character 1 , subscript out of range........ Second .vbs script is remove_state_store.vbs -------------------------------------- '========================================================================== ' VBScript Source File ' NAME: remove_statestore.vbs ' AUTHOR: mathias@haas.se ' DATE : 2011-04-13 ' COMMENT: v1.0 - Deletes the Statestore which USMT can't do... <sigh>. '========================================================================== Option Explicit Dim fso, wshell, sPath, sOSDStateStorePathArg Set fso = CreateObject("Scripting.FileSystemObject") Set wshell = CreateObject("WScript.Shell") sOSDStateStorePathArg = WScript.Arguments.Item(0) If fso.FolderExists ("C:\USMT") = False Then fso.CreateFolder ("C:\USMT") 'For the util. sPath = wshell.CurrentDirectory wshell.Run ("cmd /c copy " & sPath & "\amd64\usmtutils.exe C:\USMT"),0,True ' Copies Util to C:\USMT wshell.Run ("cmd /c echo Y | c:\USMT\usmtutils.exe /rd " & sOSDStateStorePathArg ),0,True fso.DeleteFolder "C:\USMT",True WScript.Quit (0) ------------------------------- error received is line 14 character 1, subscript out of range. smsts.log is throwing "incorrect function" any ideas?
April 24th, 2012 9:15pm

What does your command line look like that you are trying to run the script from? cscript.exe copy_and_runscanstate.vbs ...etc... cscript.exe remove_statestore.vbs ...etc... I think you are having a problem with your command line arguments. Chris Chisholm
Free Windows Admin Tool Kit Click here and download it now
April 24th, 2012 10:19pm

Try to change WScript.Arguments.Item(0) on WScript.Arguments(0)
April 25th, 2012 2:41am

Morning folks..I am following the guide here btw, I'm going to look at the suggestions here in a bit when i get to work, thanks for the help! http://sccm.haas.se/?p=272#comment-118
Free Windows Admin Tool Kit Click here and download it now
April 25th, 2012 7:07am

cscript copy_and_runscanstate.vbs %OSDStateStorePath%
April 25th, 2012 7:19am

I changed cscript copy_and_runscanstate.vbs %OSDStateStorePath% to copy_and_runscanstate.vbs %OSDStateStorePath%  I'll post the log when I get to work........
Free Windows Admin Tool Kit Click here and download it now
April 25th, 2012 7:43am

After re-reading my logs,cscript copy_and_runscanstate.vbs is now running correctly after I downloaded it again and replaced it.Now it is failing on the task sequence step "Unload registry" which runs the command line "cmd /c REG Unload HKLM\$DEST$Software". The log is showing incorrect function which means my syntax is off somewhere. Suggestions on the proper syntax? (This only gets run on the XP platform being migrated to 7).
April 25th, 2012 8:57am

If you read the posts below the Blog other had the same issue as this latest one, and the solution was that if you were using a x86 WinPE you don't have to unload the Registry Hive. Also, for Windows 7 Deployments I would recommend using a x86 Boot image for all your deployments (except a x64 Build and Capture which requires a x64 Boot Image). You can deploy a x64 reference image with a x86 Boot Image. ********************************************************************************* mathias October 30th, 2011 - 02:23 Hello Frank! If you read the post again youll see that when running x86-Windows you dont need to unload the registry hive with reg unload. Its only necessary for x64-Windows and USMT. Regards, Mathias. ********************************************************************************* mbroome April 25th, 2012 - 12:55 Mathias, after taking a break and sleeping on it to get a fresh perspective, I reread the logs. Re-copying the .vbs scripts did correct that issue. What I am having problems with now is the unload registry step, cmd /c REG Unload HKLM\$DEST$Software. That command is refusing to run throwing incorrect function errors and bringing the TS to a screeching halt. Any suggestions on that step sir? ( REPLY ) mathias April 25th, 2012 - 13:08 Is that 32bit Windows youre running ? When running x86-Windows you dont need to unload the registry hive with reg unload. Its only necessary for x64-Windows and USMT. ( REPLY ) ********************************************************************************* Chris Chisholm
Free Windows Admin Tool Kit Click here and download it now
April 25th, 2012 9:51am

Thank you! I just deleted that step in the sequence. down to my LAST problem,(I hope)! On the Partition Disk 0 (Bare Metal) step, it runs, even with the conditions in place, wiping out my state store!
April 25th, 2012 10:04am

Have you verified that the drive letters are what you expect to see in WinPE. Try this: Enable Command Prompt Support (F8) Boot to WinPE Before you select a Task Sequence press F8 Verify that the C:\ in Full Windows is still C:\ in WinPE and isn't D:\ Your conditions look correct, I would verify that your assumptions are true before tearing appart your Task Sequence. Chris
Free Windows Admin Tool Kit Click here and download it now
April 25th, 2012 10:29am

In PE the windows system drive IS C:
April 25th, 2012 10:38am

If you look for the following file: X:\Windows\Temp\SMSTSLogs\SMSTS.Log It will show you what is happening with your Task Sequence. Look for the Evaluation of the Conditions.
Free Windows Admin Tool Kit Click here and download it now
April 25th, 2012 12:01pm

If you look for the following file: X:\Windows\Temp\SMSTSLogs\SMSTS.Log It will show you what is happening with your Task Sequence. Look for the Evaluation of the Conditions. Check this via F8 while the TS is running, correct? My second problem: second problem: while the task sequence is running, it creates the OSDStateStorePath of C:\USMToffline, verified via F8, My Set restore options are present and correct. copy_and_runscanstate.vbs runs and gathers user data, yet while checking the statestore folder, no data gets placed there! Reading the loadstate.log I get the following error: invalid store path; check the store parameter and/or file system permissions[gle=0x00000006] and the USMT process basically fails. I disabled the remove state Storage step so I could verify it was there and verify its contents,( no user data). I'll keep digging, I'm determined to get this working!
April 25th, 2012 2:14pm

ok, found one huge mistake and corrected it. The ts was set to download content as needed by the ts instead of access data directly from the dp's. I also corected the partitioning problem by throwing 2 more conditions at it, ( i don't know but it worked!). I also just changed the user migration over to x86 instead of 64. Im waiting on the DP's to update and I'll give it a try and see if I get any userdata in the USMToffline folder. If I don't get data then im at a loss! Ill update after the next ts runs..........
Free Windows Admin Tool Kit Click here and download it now
April 25th, 2012 3:57pm

If you changed the USMT over to x86 make sure you also changed your WinPE to x86. They need to match. Chris
April 26th, 2012 1:43pm

I changed everything over to x86 and have finally gotten it running! The state store exists, with the easy transfer file and catalogs but is refusing to restore. My .xml file specifies "ignore local accounts" but on the restore I am getting the following error, ( see the root cause on the grey line with the arrow pointing at it..... I'm in the home stretch of getting this thing to work, i REALLY appreciate the help I'm getting! The fix for this is supposedly here: I'll make the change and let everyone know how it went! I spent half the day writing out a 12 page word document showing step by step EVERY step my sequence was doing and how and why. Re-reading it made my decide to swap over to x86 on a whim. If anyone needs an extensive,illustrated step by step guide, hit me up! lol.....
Free Windows Admin Tool Kit Click here and download it now
April 26th, 2012 2:08pm

That got it going and Ironed out the final bug! Thank you SO much for the help and encouragement Chris! This project is ultimately going to be a Windows 7 Standalone USB for our Techs in the field. This was the hard part, offline USMT! I really dont know which to mark as an answer so i'll just pick one, thank you sir! If anyone wants a very detailed guide with pics on how to get this going and not go thru what I had too, let me know!
April 26th, 2012 3:22pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics