πŸ’‘ Why This Is Useful

Ever needed to add desktop links to company resources - ones users can’t easily delete - with customised icons?
This lightweight approach lets you:

  • πŸ“Œ Keep shortcuts consistent across all devices
  • πŸ”’ Prevent accidental deletion by end users
  • ✨ Deploy easily with Intune Win32 apps

πŸ“¦ How It Works

  • Creates shortcuts on the Public Desktop with your custom icon.
  • Stores all icons in a shared folder:
    C:\ProgramData\DesktopShortcuts
  • Automatically cleans up the folder when the last link is removed.

πŸ”„ Customisation

Just replace the:

  • $url β†’ your link
  • google.ico β†’ your custom icon file
  • Google.lnk β†’ your shortcut name

⚠️ Important: Ensure the icon file and the scripts are in the same folder.


πŸ“₯ Installer Script

# Variables
$url = "https://www.google.co.uk/"
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition
$tempIconPath = Join-Path $scriptDirectory "google.ico"
$persistentIconPath = "C:\ProgramData\DesktopShortcuts\google.ico"
$shortcutPath = "C:\Users\Public\Desktop\Google.lnk"

# Ensure destination directory exists
$persistentDir = Split-Path $persistentIconPath
if (-not (Test-Path $persistentDir)) {
    New-Item -Path $persistentDir -ItemType Directory -Force | Out-Null
}

# Copy icon to permanent location
Copy-Item -Path $tempIconPath -Destination $persistentIconPath -Force

# Create shortcut
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut($shortcutPath)
$shortcut.TargetPath = $url
$shortcut.IconLocation = $persistentIconPath
$shortcut.Save()

Write-Host "Shortcut created with persistent icon at $shortcutPath"

πŸ“₯ Uninstaller Script

# Variables
$persistentIconPath = "C:\ProgramData\DesktopShortcuts\google.ico"
$shortcutPath = "C:\Users\Public\Desktop\Google.lnk"
$persistentDir = Split-Path $persistentIconPath

# Remove shortcut
if (Test-Path $shortcutPath) {
    Remove-Item $shortcutPath -Force
    Write-Host "Removed shortcut: $shortcutPath"
}

# Remove icon
if (Test-Path $persistentIconPath) {
    Remove-Item $persistentIconPath -Force
    Write-Host "Removed icon: $persistentIconPath"
}

# Clean up folder if empty
if (Test-Path $persistentDir -and !(Get-ChildItem $persistentDir)) {
    Remove-Item $persistentDir -Force
    Write-Host "Removed folder: $persistentDir"
} else {
    Write-Host "Folder not empty or does not exist, skipping deletion: $persistentDir"
}

πŸ“¦ Deployment Tip

  • Package and add two script files and the icon file as a Win32 app in Intune.
  • Use the uninstaller script for clean removal.
  • You can use the .lnk file’s existence in the Public Desktop folder as the detection method.

✨ With this method, your corporate desktop stays clean, consistent and professional - no matter who logs in!