need user desktop variable when using redirected folders

Hi

In a login script in the user context i need to copy some shortcut to the desktop. But we are using redirected folders and C:\users\%username%\desktop\ does not exist when using redirected folders (and the desktop is redirected to a file-server)

Which variables should I then use?

Best Regards, Steffen.

March 30th, 2015 1:15pm

You can try %USERPROFILE%\Desktop, but I would not use login script. Have you considered using Group Policy Preferences?
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2015 1:23pm

HKEY_CURRENT_USER\Volatile Environment

USERPROFILE

Or, in powershell:

$env:userprofile

  • Edited by mdkelley 14 hours 20 minutes ago
March 30th, 2015 1:23pm

On redirected folders the variables always point to the right place.  That is the whole point of "variables".  They are "variable".  They tend to tell you the most current information as opposed to "constants" which tell you only one t
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2015 7:05pm

Okay. But in this case the variable is not pointing to the client cashe since it saying that the folder does not exists.

%USERPROFILE%\desktop

says on danish that the folder does not exists

error

No desktop folder in the user profile since it redirected

ps

The desktop folder must be in the CSC folder in windows (client cashe) and then rediredted to the fileserver.


March 31st, 2015 2:31am

Hi

with redirected folders, user profile remains while desktop can be redirected, so %USERPROFILE% nor $HOME won't help.

I think you can find the correct path in registry, under 'User Shell Folders'

here is how to read it in PowerShell :

$usf = get-item 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders'
$udp = $usf.getvalue('Desktop')

hope it helps.

Sbastien

Free Windows Admin Tool Kit Click here and download it now
March 31st, 2015 3:31am

That Helped!
March 31st, 2015 3:33am

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

Other recent topics Other recent topics