New-Shortcut Icon is not being applied

Hi experts,

my icon is not getting applied with that script.

Folder for icon is local, also the icon is deployed on the public Desktop

Copy-File -Path “$dirFiles\Next.ico” -Destination “$envProgramFiles\SCCM_Scripts\Next_Icon”

New-Shortcut -Path “C:\Users\Public\Desktop\Next.url” -TargetPath “http://XXXX/” -IconLocation “$envProgramFiles\SCCM_Scripts\Next_Icon\Next.ico” -Description “NEXT”

Any Idear?

Thanks

You don’t need to use the New-Shortcut function. That is for lnk files, not url. URL have different format.
Drag the url shortcut into a notepad window and edit the icon location.

P.S. Maybe you place the wrong extension and actually you want Next.lnk If that is the case, then just modify the shortcut from Next.url into Next.lnk and the New-Shortcut function should work ok.

[InternetShortcut]
URL=http://example.com
IconFile=C:\WINDOWS\SYSTEM\url.dll
IconIndex=1