Forum Discussion

Jesse13579's avatar
Jesse13579
Brass Contributor
Jan 15, 2024

Win32 app installed desktop shortcut with no custom icon

I'm installing a desktop shortcut to all my endpoints.  I'm installing it as a win32 app with this script.

 

#Create directory to hold icon file and copy file there
New-Item -Path "c:\" -Name "scut" -ItemType "directory" -Force
Copy-Item "S:\Shortcuts\UKGi.ico" -Destination "c:\scut\UKGi.ico"

#Shortcut creation and specify settings
$Shell = New-Object -ComObject ("WScript.Shell")
$ShortCut = $Shell.CreateShortcut("C:\users\public\desktop\UKG Time.lnk")
$ShortCut.TargetPath="---------------------------------------------- "
#$Shortcut.Arguments="---------------------------------------------- "
$ShortCut.IconLocation = "c:\scut\UKGi.ico";
$ShortCut.Description = "UKG Time";
$ShortCut.Save()

 

I already have a s: drive mapped to all my endpoints and I'm creating a folder on the c: drive of the destination pcs.  I'm copying the ico file from the mapped drive to the c: drive then installing the shortcut.  The desktop shortcut is created just fine.  I just don't get the custom icon.  The install behavior is via system.  I went into the app and added the custom icon jpg as the logo of the app itself.  Still no luck with the custom icon.  Any suggestions?  

  • Copy-Item ".\UKGi.ico" -Destination "c:\scut\UKGi.ico ---> Copy-Item ".\UKGi.ico" -Destination "c:\scut\UKGi.ico" , you mist the last " I think 😉
  • Jesse13579's avatar
    Jesse13579
    Brass Contributor
    I just dug into the issue a little deeper and it looks like a rights issue. I can create the shortcut but my users do not have admin rights to copy the ico file and link it to the shortcut. Has anyone worked around this issue before?
    • Harm_Veenstra's avatar
      Harm_Veenstra
      MVP

      You should have all the files in your .Intunewin package. Copy-Item "S:\Shortcuts\UKGi.ico" -Destination "c:\scut\UKGi.ico" should be Copy-Item ".\UKGi.ico" -Destination "c:\scut\UKGi.ico" if the files are all in one folder from which you create the .intunewin package. Run this with the System installation behavior when configuring the settings in Intune and uploading the package.

      The system account doesn't have the mapping in its environment, so it doesn't work the way it's configured right now.

      Please click Mark as Best Response & Like if my post helped you to solve your issue.
      This will help others to find the correct solution easily. It also closes the item.

      If one of the posts was helpful in other ways, please consider giving it a Like.

      • Jesse13579's avatar
        Jesse13579
        Brass Contributor
        I made the changes and everything is running in the test environment to see how it goes. I appreciate the help.

Resources