Script status showing failed however, the desktop Icon is installed. Deployed script via Intune

39 views Asked by At

I have the following script deployed in Intune.

The script is working fine- it is deploying the desktop icon that I want. But the issue is even though the desktop icon is there- it is still showing as status failed in Intune status page

#Variables creating local folder and download .ico file
$LocalIconFolderPath = "C:\Intune\Xxxxxxxxxxxxxxx"
$SourceIcon = "https://xxxxxxxx/xxxxxxxxlogo-wo-wb/xxxxxxxxlogo-wo-wb.ico"
$DestinationIcon = "C:\Intune\Xxxxxxxxxxxxxxx\xxxxxxxxlogo-wo-wb.ico"


#Step 1 - Create a folder to place the URL icon
New-Item $LocalIconFolderPath -Type Directory

#Step 2 - Download a ICO file from a website into previous created folder
curl $SourceIcon -o $DestinationIcon

#Step 3 - Add the custom URL shortcut to your Desktop with custom icon
$new_object = New-Object -ComObject WScript.Shell
$destination = $new_object.SpecialFolders.Item('AllUsersDesktop')
$source_path = Join-Path -Path $destination -ChildPath '\\Global Intranet.lnk'
$source = $new_object.CreateShortcut($source_path)
$source.TargetPath = 'https://xxxxxxxxxxxxx.sharepoint.com/sites/GlobalIntranet?web=1'
$source.IconLocation = ”C:\Intune\Xxxxxxxxxxxxxxx\xxxxxxxxlogo-wo-wb.ico”
$source.Save()

enter image description here

Please suggest which command should I add so that it detects the desktop icon is installed and shows the status as succeeded.

0

There are 0 answers