Wir wollten mit Powershell gerne von Anfang an während des Deploymentprozesses schon Links im Startmenü von Windows anlegen.
Zum Beispiel zu einem Internen Wiki oder einem Schulungsportal.
Also wie kann man einen Shortcut auf eine Url im Startmenu per Script erstellen?
function New-UrlShortcut
{
param(
[Parameter(
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[Alias("FullName")]
[string] $Filename,
[string] $URL)
process {
$shell = New-Object -ComObject Wscript.Shell
$Us = $shell.CreateShortcut($Filename)
$Us.TargetPath = $URL
#$Us.IconLocation = "user32.dll,83"
$us.Save()
}
}
$Path = "$Env:ProgramData\Microsoft\Windows\Start Menu\Programs"
New-UrlShortcut "$Path\Wiki.url" "https://commandline.info/index.php/powershell"