PowerShell – Add Shortcut to Start Menu

email me

$objShell = New-Object -ComObject WScript.Shell
$explorerFile = "C:\Windows\explorer.exe"

$URL = "https://eddiejackson.net"

$webLink = $objShell.SpecialFolders("AllUsersPrograms") + "\Eddie_Site.lnk"
If (Test-Path $webLink){
Remove-Item $webLink
}

$objShortcut = $objShell.CreateShortcut($webLink)
$objShortcut.IconLocation = "explorer.exe,12"
$objShortcut.TargetPath = $explorerFile
$objShortcut.Arguments = $URL
$objShortcut.Save()

 

tags: MrNetTek