none
GPO to run existing desktop shortcut at login RRS feed

  • General discussion

  • HiAll,

    Im attempting to create a GPO that will run a desktop shortcut when the user logs in.

    Ive created the GPO and navigated to Computer Configuration > Policies > Admin Templates > System > Logon > Run these programs at user logon

    The path im using is apparently not correct: C:\%USERPROFILE%\Desktop\Shortcut.lnk

    Ive tinkered with removing C:\ from the path with no success.

    If i move the .lnk to a folder like c:\windows and point the path to C:\windows\shortcut.lnk  it works fine.

    Any help is very much appreciated.

    • Changed type Bill_Stewart Thursday, September 5, 2019 9:25 PM
    • Moved by Bill_Stewart Thursday, September 5, 2019 9:25 PM Off-topic
    Tuesday, May 21, 2019 12:08 PM

All replies

  • Desktop shortcuts are not in a folder called desktop on modern Windows systems.  They can be in a number of different places

    The desktop can be found like this:

    [environment]::GetFolderPath('Desktop')


    \_(ツ)_/

    Tuesday, May 21, 2019 12:22 PM
  • Im not sure I follow exactly. How would i go about getting the path needed for the GPO template?
    Tuesday, May 21, 2019 12:28 PM
  • You add it to your logon script. 

    To learn how to use a GPO you need to post in the GPO forum.  Once you learn how to use the GPO policies then add the script to the policy you create.

    https://devblogs.microsoft.com/scripting/using-group-policy-to-deploy-a-windows-powershell-logon-script/


    \_(ツ)_/

    Tuesday, May 21, 2019 12:47 PM
  • But im not using a script. Im just trying to execute a desktop shortcut using the admin template to "Run these programs at user logon". The examples ive seen using this method simply point to an exe. However the paths are direct (c:\windows). They dont have examples for a user specific location that requires a variable.
    Tuesday, May 21, 2019 7:57 PM
  • There is no way to get the path using this method. You have to type in the explicit path and that is OS dependent so it has to be different for different OSs. The desktop can also be redirected. This is not detectable via this GPO setting.

    If you have further issues you will have to post in the GP forum.  This is an admin scripting forum and your question has nothing to do with scripting.


    \_(ツ)_/

    Tuesday, May 21, 2019 8:03 PM
  • Why does it matter whether you run the shortcut when the user logs on?

    -- Bill Stewart [Bill_Stewart]

    Wednesday, May 22, 2019 1:16 AM