Creating a shortcut to a folder on a user's device using Microsoft Intune requires configuring a custom PowerShell script and deploying it as a Win32 app. Here's a step-by-step guide on how to achieve this:
- Prepare the PowerShell script:
Open a text editor and create a new PowerShell script. For example, you can name it "CreateShortcut.ps1".
- Inside the script, add the following code:
- powershell script:
$ShortcutPath = "$env:PUBLIC\Desktop\ShortcutName.lnk" $TargetPath = "C:\Path\to\Target\Folder" $WshShell = New-Object -ComObject WScript.Shell $Shortcut = $WshShell.CreateShortcut($ShortcutPath) $Shortcut.TargetPath = $TargetPath $Shortcut.Save()
Replace "ShortcutName.lnk"
with the desired name for the shortcut file, and "C:\Path\to\Target\Folder"
with the actual path of the folder you want to create a shortcut to.
Save the PowerShell script.
Package the PowerShell script as a Win32 app package:
- Use the Microsoft Win32 Content Prep Tool (win32contentprep.exe) to package the PowerShell script as a Win32 app package. This tool is available in the IntuneWinAppUtil repository on GitHub: https://github.com/Microsoft/Microsoft-Win32-Content-Prep-Tool.
- Follow the instructions provided in the tool's repository to package the PowerShell script. This involves running the
IntuneWinAppUtil.exe
command-line tool and specifying the PowerShell script and output folder as parameters.
Upload the Win32 app package to Intune:
- Log in to the Microsoft Endpoint Manager admin center (https://endpoint.microsoft.com) and navigate to "Apps" > "All apps".
- Click on the "+ Add" button to add a new app.
- Choose "Windows app (Win32)" as the app type.
- Specify the required details for the app, including the name, description, publisher, and version.
- On the "App package file" page, click on "Select file" and choose the Win32 app package (.intunewin file) generated in the previous step.
- Complete the remaining steps in the wizard to finish uploading the app package.
Configure the deployment settings:
- In the app deployment settings, specify the desired behavior for the deployment, such as the user group(s) the app should be deployed to and the installation behavior.
- You can also configure the detection rules to determine whether the app is already installed on the device.
- Save the deployment settings.
Assign the app to the desired group(s):
- On the app's overview page, click on the "Assignments" tab.
- Select the user group(s) to which you want to deploy the shortcut.
- Save the assignments.
Once the deployment is processed by Intune and the target devices sync with the Intune service, the PowerShell script will run on the user's devices and create the specified shortcut to the folder.