Win11 command script to copy software center shortcut to Default desktop folder

Eaven Huang 1,731 Reputation points
2023-01-03T07:23:52.637+00:00

Dear exports,

Is there a working script that helps to copy the software center shortcut to Default desktop folder, so that new login users will use it later on?
My idea was to create an application in SCCM to run this script, so after client push is completed, the application will run to copy the shortcut to the default desktop location.

Thank you very much.

Microsoft Configuration Manager
Microsoft Configuration Manager Application
Microsoft Configuration Manager Application
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Application: A computer program designed to carry out a specific task other than one relating to the operation of the computer itself, typically to be used by end users.
336 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
3,582 questions
No comments
{count} votes

Accepted answer
  1. CherryZhang-MSFT 3,976 Reputation points Microsoft Vendor
    2023-01-04T08:06:38.197+00:00

    Hi @Eaven Huang ,

    I have down some tests on your question. Please modify your $SourceFilePath and $ShortcutPath. The following screenshot for your reference:

    $SourceFilePath
    C:\Program Files\Google\Chrome\Application\chrome.exe(on client)
    275925-1.png

    $ShortcutPath
    C:\Users\Default\Desktop\Google Chrome.lnk(on client)
    275867-2.png

    Test result:
    275937-3.png

    Script:

    > $SourceFilePath = " C:\Program Files\Google\Chrome\Application\chrome.exe"
    > $ShortcutPath = " C:\Users\Default\Desktop\Google Chrome.lnk"
    > $WScriptObj = New-Object -ComObject ("WScript.Shell")
    > $shortcut = $WscriptObj.CreateShortcut($ShortcutPath)
    > $shortcut.TargetPath = $SourceFilePath
    > $shortcut.WindowStyle = 1
    > $shortcut.Save()

    For more detail about script, please refer to this link:
    https://shellgeek.com/create-shortcuts-on-user-desktop-using-powershell/

    Looking forward to your feedback.

    Best regards,
    Cherry


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments

1 additional answer

Sort by: Most helpful
  1. Garth 4,486 Reputation points
    2023-01-03T08:13:54.673+00:00

    What do you have now for a script? What isn't working with it?