How to Creat a shortcut to a network folder in Intune(No Drive Mapping with admx)

Question

I’m using this script but is not working, any suggestion?

 

$ShortcutName = “YourShortcutName”
$TargetPath = “YourargetPath”
$ShortcutLocation = “$env:APPDATAMicrosoftWindowsNetwork Shortcuts$ShortcutName.lnk”

$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($ShortcutLocation)
$Shortcut.TargetPath = $TargetPath

$Shortcut.IconLocation = “%SystemRoot%system32SHELL32.dll,3”

$Shortcut.Save()

Answer ( 1 )

    1
    2025-06-12T01:05:14+05:30

    Hi Mattia Borino,

    I think the script you mentioned have two issues.
    1) Incorrect or missing backslashes in file paths ($ShortcutLocation and $Shortcut.IconLocation).
    2) Incorrect quotation characters – you’re using smart quotes (“ ”) which PowerShell will reject.

    Use the below mentioned corrected script for Network Folder Shortcut via Intune (No Drive Mapping)

    $ShortcutName = “YourShortcutName”
    $TargetPath = “\YourNetworkPathSharedFolder”
    $ShortcutLocation = “$env:APPDATAMicrosoftWindowsNetwork Shortcuts$ShortcutName.lnk”

    $WshShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WshShell.CreateShortcut($ShortcutLocation)
    $Shortcut.TargetPath = $TargetPath
    $Shortcut.IconLocation = “$env:SystemRootsystem32SHELL32.dll,3”
    $Shortcut.Save()

Leave an answer

Sorry, you do not have permission to answer to this question .