|
|
|||||||
Hi, I'm new to KIXTART. I'm trying to use a short kixtart script to set the users default printer in a metaframe farm with multiple servers and roaning profiles on server applic2. The script below only works when I replace %USERPROFILE% with the actual domain username (testcitrix). log in as this user while a run the script of course... Anybody knows the reason? use u: \\applic2\profiles IF NOT EXIST ("u:\%USERPROFILE%\DFPrint.ini") copy "c:\winnt\Application Compatibility Scripts\DFPrint\DFPrint.ini" "u:\%USERPROFILE%\DFPrint.ini" /s/h ENDIF shell "%systemroot%\Application Compatibility Scripts\DFPrint\SetDefaultPrinter.exe" $RegDFPrint = Readvalue("HKEY_Current_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device") $Result = writeprofilestring("u:\%USERPROFILE%\DFPrint.ini","DFPrint" ,"DFPrint", $RegDFPrint) use u: /del |
||||||||
|
|
|||||||
Does not %USERPROFILE% already include the drive letter? |
||||||||
|
|
|||||||
yeah, it sounds like he needs @userid or %username% |
||||||||
|
|
|||||||
Better still would be to pull it from the reg. |
||||||||
|
|
|||||||
Doing an ECHO %USERPROFILE% from a dos prompt returns the local path for the profile on my computer. I.E. C:\Documents and Settings\mranderson You'll need to use another variable instead of %userprofile% (like maciep's suggested @userid) to accomplish your task. BTW, This might be a helpful resource for you. Environment Variables - Windows 2000/XP |
||||||||
|
|
|||||||
The %username% did the trick for me, the %userprofile% showed the local userdirectory as mentioned. Thanks for the advise guys |
||||||||
|
|
|||||||
You were on the right track with %USERPROFILE% only you doubled up on the drive. It is bad practice to use %username% since it will not always prove correct as when you rename a user account or duplicates exist. |
||||||||
|
|
|||||||
Les, I know about this problem with %username%, but my problem now is that the %userprofile% is pointing to the local profile and I need to copy these parameters to the roaming profiles (only for Terminal service users) located on a different server. What if we put the \profiles\%username% in the user accounts TS profile directory instead of the actual username? |
||||||||
|
|
|||||||
Quote: Correct. When you log on this is the profile you use - it is a copy of your roaming profile. Quote: I doubt it. The roaming profile is overwritten/merged by the local copy of the profile when the user logs off so any changes that you make may well be lost. You therefore need to set the values in the local profile once the user has logged on. When they log off the values will be copied back to their roaming profile location. If for some strange reason you really do want to write to the roaming profile, you can get the path directly from the user account - much safer than trying to guess it. You may need to manually expand environment variables. |