Automating Web URLs as Start Menu Links
In my previous post on Creating Web URLs as Start Menu Links, I outlined details how to manually create links to URLs (as seen in the images below). While this does work, most folks in the systems management community would prefer to automate this link creations. The following PowerShell script can be used to create a custom start menu link for all users.
Note that a problem that you may encounter is the link not being displayed in the grouping. This could be caused by having two .lnk files with the same target path pointing to the same URL.
# Create a Shortcut with Windows PowerShell $oWScriptShell = New-Object -ComObject WScript.Shell $sTargetFile = "C:\Windows\explorer.exe" $sShortcutFile = $oWScriptShell.SpecialFolders("AllUsersPrograms") + "\Links\t3chn1ck.lnk" # Note: to open URL in a specific browser like Edge, add in front of the URL Microsoft-edge: $sURL = "http://t3chn1ck.com" #Delete existing shortcut if exists If (Test-Path $sShortcutFile){ Remove-Item $sShortcutFile } $oShortcut = $oWScriptShell.CreateShortcut($sShortcutFile) $oShortcut.IconLocation = "explorer.exe,20" $oShortcut.TargetPath = $sTargetFile $oShortcut.Arguments = $sURL $oShortcut.Save()
October 26, 2016 at 8:26 am
[…] To automate this process using PowerShell, see my post Automating Web URLs as Start Menu Links. […]