Using Intune to Copy a Shortcut to the User Desktop

Robert Sudbury 21 Reputation points
2020-08-28T20:42:29.26+00:00

I have used "Microsoft Win32 Content Prep Tool 1.8.1" to create a "*.intunewin" that contains the "shortcut.lnk", then created the app in Intune using the following to copy the shortcut to "C:\Users\Public\Desktop".

For Program entries:

install command:
powershell.exe copy-item ".\shortcut.lnk" -destination "c:\users\public\desktop"

uninstall command:
powershell.exe remove-item "c:\users\public\desktop\shortcut.lnk"

install behavior:
system

For Detection Rules:

rules format:
manually configure detection rules

rule type:
file

path:
C:\Users\Public\Desktop

file or folder:
shortcut.lnk

detection method:
file or folder exists

associated with a 32-bit app on 64-bit clients:
no

I would prefer the destination to be:

"C:\Users\<LoggedOnUsername>\Desktop"
I tried:

      install command: powershell.exe Copy-Item ".\shortcut.lnk" -Destination "C:\Users\$($env:USERNAME)\Desktop"
      install behavior: user

But, I cannot use "$($env" for detection rule path. It must be absolute, so I can't even create the app.
Help?

Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,348 questions
0 comments No comments
{count} votes

Accepted answer
  1. Crystal-MSFT 42,961 Reputation points Microsoft Vendor
    2020-09-01T07:15:33.13+00:00

    Thanks for the reply.

    For the issue you mentioned with self-healing, I have tested in my lab and find the same issue with you. When I remove the desktop-shortcut manually, I find the record is also removed from "Device install status" of the win32 app. But a new Win32 app never deploy to the client.

    Then I go to check the logs under "C:\ProgramData\ Microsoft\IntuneManagementExtension\Logs", I find that when the Intune Management Extension check the application status, the mode shows "DetectInstall". Although the detection rule result shows false. the installation is not started.
    21885-image.png

    As the information of Win32 app detected by IME agent is stored under HKLM\ SOFTWARE\Microsoft\EnterpriseDesktopAppManagement\<SID>\<MSI-ProductCode>, I try to delete the registry key for this Win32 app, restart the client machine. Then I find the Win32 app is installed again. Here is a useful article about IME, we can read it as a reference:
    https://www.anoopcnair.com/intune-management-extension-level-3-troubleshoot/
    Note: Non-Microsoft link, just for the reference.

    Afterwards, I also test with other Win32 app and find the same issue. I think this is the cause of our issue. We suggest to feedback it to Intune user voicei in the following link (Intune user voice is a place where Product team collect some known issue, they will review it and may take it into consideration when deploying new version.)
    https://microsoftintune.uservoice.com/forums/291681-ideas

    For the second issue, based on my experience, we can modify the script to detect if the folder is there. If not there, create one to avoid the issue.

    Hope it can help.

    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Nick Hogarth 3,436 Reputation points
    2020-08-29T22:29:56.743+00:00
    0 comments No comments

  2. Robert Sudbury 21 Reputation points
    2020-08-30T03:27:30.757+00:00

    Ooh, that looks like it might do the trick. I'll test that out tomorrow and get back to you.

    0 comments No comments

  3. Robert Sudbury 21 Reputation points
    2020-08-31T03:40:12.13+00:00

    So far I can get it to create the shortcut, remove the shortcut, but I can't get it to self-heal.
    Plus if the shortcut is created before the target exists, it breaks the shortcut.


  4. Michael Long 16 Reputation points
    2022-01-19T23:53:39.057+00:00

    You could use the Proactive Remediation. That allows you to have a detection script and a remediation script that can run regularly. I use it to do the install/updates for Dell Command Update for All Windows 10 and All Windows 11 computers. It works great!