<# .SYNOPSIS Sa Polar - Crear accesos directos .DESCRIPTION Crea accesos directos en Inicio y Escritorio. Se ejecuta durante la instalación MSI. #> param( [string]$InstallDir = "$env:ProgramFiles\SaPolar", [switch]$Desktop ) $startMenuPath = "$([Environment]::GetFolderPath('Programs'))\Sa Polar" $desktopPath = [Environment]::GetFolderPath('Desktop') $psExe = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" $manageServices = Join-Path $InstallDir "scripts\manage-services.ps1" # Crear directorio Start Menu if (-not (Test-Path $startMenuPath)) { New-Item -ItemType Directory -Path $startMenuPath -Force | Out-Null } # Acceso directo: Panel web $wshell = New-Object -ComObject WScript.Shell $shortcut = $wshell.CreateShortcut("$startMenuPath\Sa Polar - Panel.lnk") $shortcut.TargetPath = "$env:SystemRoot\System32\cmd.exe" $shortcut.Arguments = "/c start http://localhost:3000" $shortcut.Description = "Abrir panel de administración de Sa Polar" $shortcut.WorkingDirectory = $InstallDir $shortcut.Save() # Acceso directo: Gestor de servicios $shortcut = $wshell.CreateShortcut("$startMenuPath\Sa Polar - Gestor de Servicios.lnk") $shortcut.TargetPath = $psExe $shortcut.Arguments = "-NoExit -ExecutionPolicy Bypass -File `"$manageServices`" -Action status" $shortcut.Description = "Gestionar servicios Docker de Sa Polar" $shortcut.WorkingDirectory = $InstallDir $shortcut.Save() # Acceso directo: Desinstalar $shortcut = $wshell.CreateShortcut("$startMenuPath\Sa Polar - Desinstalar.lnk") $shortcut.TargetPath = $psExe $shortcut.Arguments = "-ExecutionPolicy Bypass -File `"$manageServices`"" $shortcut.Description = "Desinstalar Sa Polar" $shortcut.WorkingDirectory = $InstallDir $shortcut.Save() # Acceso directo escritorio if ($Desktop) { $shortcut = $wshell.CreateShortcut("$desktopPath\Sa Polar.lnk") $shortcut.TargetPath = "$env:SystemRoot\System32\cmd.exe" $shortcut.Arguments = "/c start http://localhost:3000" $shortcut.Description = "Abrir panel de administración de Sa Polar" $shortcut.WorkingDirectory = $InstallDir $shortcut.Save() } Write-Host "Accesos directos creados correctamente."