Detection – Create Edge InPrivat Shortcut on Desktop and Startmenu
$desktopShortcut = "C:\Users\Public\Desktop\Microsoft Edge InPrivate.lnk"
$startMenuShortcut = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Edge InPrivate.lnk"
$desktopExists = Test-Path $desktopShortcut
$startMenuExists = Test-Path $startMenuShortcut
if ($desktopExists -and $startMenuExists) {
Write-Output "Both shortcuts exist"
exit 0
} else {
if (-not $desktopExists) { Write-Output "Desktop shortcut missing" }
if (-not $startMenuExists) { Write-Output "Start menu shortcut missing" }
exit 1
}
Remediation – Create Edge InPrivat Shortcut on Desktop and Startmenu
$desktopShortcut = "C:\Users\Public\Desktop\Microsoft Edge InPrivate.lnk"
$startMenuShortcut = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Edge InPrivate.lnk"
$edgePath = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
$targetUrl = "URL"
if (-not (Test-Path $desktopShortcut)) {
Write-Output "Creating desktop shortcut..."
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($desktopShortcut)
$Shortcut.TargetPath = $edgePath
$Shortcut.Arguments = "--inprivate $targetUrl"
$Shortcut.IconLocation = "$edgePath, 0"
$Shortcut.WorkingDirectory = Split-Path $edgePath
$Shortcut.Save()
}
if (-not (Test-Path $startMenuShortcut)) {
Write-Output "Creating start menu shortcut..."
Copy-Item -Path $desktopShortcut -Destination $startMenuShortcut -Force
}