none
need user desktop variable when using redirected folders RRS feed

  • Question

  • 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.

    Monday, March 30, 2015 5:13 PM

Answers

  • 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.

    Sébastien

    Tuesday, March 31, 2015 7:29 AM

All replies

  • You can try %USERPROFILE%\Desktop, but I would not use login script. Have you considered using Group Policy Preferences?
    Monday, March 30, 2015 5:21 PM
  • HKEY_CURRENT_USER\Volatile Environment

    USERPROFILE

    Or, in powershell:

    $env:userprofile

    • Edited by mdkelley Monday, March 30, 2015 5:22 PM
    Monday, March 30, 2015 5:21 PM
  • 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 thing ever.

    ¯\_(ツ)_/¯


    • Edited by jrv Monday, March 30, 2015 11:05 PM
    Monday, March 30, 2015 11:03 PM
  • 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.


    Tuesday, March 31, 2015 6:30 AM
  • 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.

    Sébastien

    Tuesday, March 31, 2015 7:29 AM
  • That Helped!
    Tuesday, March 31, 2015 7:31 AM