'PowerShell Script : Create URL website shortcut with the website icon (Firefox)

Like drag and drop feature in Firefox to create a website shortcut on desktop, I want to create a PowerShell script to do the same thing for many websites.

But how to create and access the Website icon with firefox ?

$Shell = New-Object -ComObject ("WScript.Shell")
$MyShortcut = $Shell.CreateShortcut($env:USERPROFILE + "\Desktop\MyWebsite001.url")
$MyShortcut.TargetPath = "https://www.MyWebsite001.com/";
$MyShortcut.IconLocation = "???"
$MyShortcut.Save()

[Firefox.exe]

  1. Go to "https://www.MyWebsite001.com/"
  2. Create Icon in "...\AppData\Local\Mozilla\Firefox\Profiles\xxxxx\shortcutCache\xxxx.ico"
  3. Copy/Paste to "C:\Tools\Icons"
  4. Rename "xxxx.ico" to "MyWebsite001.ico"
$MyShortcut.IconLocation = "C:\Tools\Icons\MyWebsite001.ico"


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source