Oi, I give for the weekend. Hopefully some time away / help from yall will be the trick.
I get the printers to move successfully, but the LoadKey() where I call drives gives me "error code 2" which I cannot get any info on.
I tried doing this also:
Code:
; commented out as get "reg.exe failed to initialize" error when the following line is run. doh
; Shell "REG EXPORT HKU\Oldprofile\Network x:\mydrives.reg";
; If @error = 0
; ? "Network Drives Key Saved";
; Shell "REG IMPORT x:\mydrives.reg";
; If @error = 0
; ? "Network Drives Key Loaded...";
; endif
; endif
This gave me a "REG performed an illegal operation, exception 00000147 click ok to continue" when it went to run the reg export.
Any ideas?
Code:
IF @WKSTA = "NICKEL21" or @WKSTA = "NICKEL22" or @WKSTA = "NICKEL23" or @WKSTA = "NICKEL24" or @WKSTA = "NICKEL25"
; *BEGIN* Main Citrix Server Farm Loop Keep things between this line and the ending line
IF INGROUP ("eTIMEUsers")
use T: /d;
use T: "\\silver1\etime";
ENDIF
;
; Read HKEY_CURRENT_USER registry keys to see if something is there. We set these values at the end to mark it as "run once"
; We selected the subkey of HKEY_CURRENT_USER\Software\SchnitzerCitrix\ as our root key to check for this sort of thing.
; The below section maps 3 Drives (root of PERSONAL_SHARES, old Citrix Profile, and new P: Drive, then copies the needed
; files out of the old profile. The new Citrix Desktop profiles we limit to 30MB, so we move this to P instead.
;
; This variable and check for a reg key is how we "do this once" and "only once"
; If it is there, then we have done the work before, and we want to skip.
$CitrixCheckVar = ReadValue ("HKEY_CURRENT_USER\Software\SchnitzerCitrix", "2K3ProfileMigrateDone");
IF $CitrixCheckVar = 1
? "This key exists, and therefore the ELSE Section has been done!";
ELSE
; temp mapping to copy shortcut files from root of personal_share
use w: \\hydrogen3\personal_shares;
; temp mapping to copy files and folders from old profile
use x: "\\corpfile\profiles\@USERID";
; temp mapping to copy files and folders to new P Drive
use y: "\\hydrogen3\personal_shares\@USERID";
copy "X:\Desktop\*.*" "y:\OldCitrixDesktop\" /s ; copies the files from OLD Citrix TSE Desktop to new one
copy "X:\Favorites\*.*" "c:\documents and settings\" + @userid + "\Favorites\" /s ; copies the files from OLD Citrix TSE Favorites to new one
copy "P:\Internet\Favorites\*.*" "c:\documents and settings\" + @userid + "\Favorites\" /s ; copies the files from P: Favorites to new one
copy "W:\*.lnk" "c:\documents and settings\" + @userid + "\Desktop\" ; copies a shortcut to P:\OldCitrixDesktop\ on new citrix desktop
;This section below reads the old NTUSER.DAT from the Windows 2000 (NICKEL1X Boxes) and exports
;mapped drives and printers from the HKEY_CURRENT_USER section of the registry, and then imports
;it to the new Windows 2003 User profile
$filename = "x:\ntuser.dat";
$rootkey = "HKEY_USERS\Oldprofile";
$ReturnCodeLoadHive = LoadHive($rootkey,$filename)
If $ReturnCodeLoadHive = 0
? "Old Citrix Server Hive loaded....";
$ReturnCodeSavePrinter = SaveKey($rootkey + "\Printers\Connections", "x:\" + @USERID + "printers.reg");
If $ReturnCodeSavePrinter = 0
? "Printers Key saved...."
$ReturnCodeLoadPrinter = LoadKey("HKEY_CURRENT_USER\Printers\Connections", "x:\" + @USERID + "printers.reg")
If $ReturnCodeLoadPrinter = 0
? "Printers Key loaded...."
Else
? "Printer Key did not load. Error : $ReturnCodeLoadPrinter";
Endif
Endif
$ReturnCodeSaveDrives = SaveKey($rootkey + "\Network", "x:\" + @USERID + "drives.reg");
If $ReturnCodeSaveDrives = 0
? "Drives Key saved...."
$ReturnCodeLoadDrives = LoadKey("HKEY_CURRENT_USER\Network", "x:\" + @USERID + "drives.reg")
If $ReturnCodeLoadDrives = 0
? "Network Drives Key loaded...."
Else
? "Network Drives did not load. Error Code : $ReturnCodeLoadDrives";
Endif
Endif
ELSE
? "The Return Code is = $ReturnCodeLoadHive";
Endif
; Cleanup from what you've done above...
;unloads the loaded hive from above
$ReturnCodeLoadHive = UnLoadHive( $rootkey );
;disconnects the drives we mapped above to migrate the files
use w: /d;
use x: /d;
use y: /d;
;Write the registry key that shows we've done this before, so it is not done again
Writevalue("HKCU\Software\SchnitzerCitrix","2K3ProfileMigrateDone","1","REG_SZ")
ENDIF