locked
Pushing a script using SCCM does not work with folder shortcut. RRS feed

  • Question

  • I have a script that creates a shortcut to a network drive folder that I am deploying through SCCM. The short cut gets created and works if I run it with PowerShell on my computer but when deployed using SCCM the target type is set as "File" instead of "File Folder" and does not work. Here is the script:

    $SourceFileLocation = "S:\OR_Resources\"
    $ShortcutLocation = "c:\users\public\desktop\OR Resources.lnk"
    $WScriptShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WScriptShell.CreateShortcut($ShortcutLocation)
    $Shortcut.TargetPath = $SourceFileLocation
    $Shortcut.IconLocation = "C:\Windows\OR Resources.ico"
    $Shortcut.Save()

    Any suggestions would be very helpful. Thank you

    Friday, June 19, 2020 8:20 PM

All replies