param([switch]$NoLaunch) $ErrorActionPreference = "Stop" $AppUrl = "https://scheduler.apoulosacramento.asia" $InstallDir = Join-Path $env:LOCALAPPDATA "Planwise" $IconPath = Join-Path $InstallDir "planwise.ico" $DesktopShortcut = Join-Path ([Environment]::GetFolderPath("Desktop")) "Planwise Scheduler.lnk" $StartMenuShortcut = Join-Path ([Environment]::GetFolderPath("Programs")) "Planwise Scheduler.lnk" $Edge = Join-Path ${env:ProgramFiles(x86)} "Microsoft\Edge\Application\msedge.exe" if (-not (Test-Path -LiteralPath $Edge)) { $Edge = Join-Path $env:ProgramFiles "Microsoft\Edge\Application\msedge.exe" } if (-not (Test-Path -LiteralPath $Edge)) { throw "Microsoft Edge is required to install Planwise." } New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null Invoke-WebRequest -UseBasicParsing -Uri "$AppUrl/favicon.ico" -OutFile $IconPath $Shell = New-Object -ComObject WScript.Shell foreach ($Path in @($DesktopShortcut, $StartMenuShortcut)) { $Shortcut = $Shell.CreateShortcut($Path) $Shortcut.TargetPath = $Edge $Shortcut.Arguments = "--app=$AppUrl" $Shortcut.WorkingDirectory = $InstallDir $Shortcut.IconLocation = $IconPath $Shortcut.Description = "Planwise resource planning workspace" $Shortcut.Save() } if (-not $NoLaunch) { Start-Process -FilePath $Edge -ArgumentList "--app=$AppUrl" } Write-Output "Planwise is installed on the Desktop and Start menu."