$guid = '32d76052-4d92-446c-95fb-614653f84742'
# Write logon script
$bat = "@echo off`r`nif not exist `"%USERPROFILE%\Desktop\ALIS.url`" (`r`n  echo [InternetShortcut]> `"%USERPROFILE%\Desktop\ALIS.url`"`r`n  echo URL=https://cascadestucson.alisonline.com/>> `"%USERPROFILE%\Desktop\ALIS.url`"`r`n)`r`nif not exist `"%USERPROFILE%\Desktop\PharmCare.url`" (`r`n  echo [InternetShortcut]> `"%USERPROFILE%\Desktop\PharmCare.url`"`r`n  echo URL=https://pharmcare.linkrxnow.com/>> `"%USERPROFILE%\Desktop\PharmCare.url`"`r`n)`r`nif not exist `"%USERPROFILE%\Desktop\Helpany.url`" (`r`n  echo [InternetShortcut]> `"%USERPROFILE%\Desktop\Helpany.url`"`r`n  echo URL=https://app.helpany.com/start>> `"%USERPROFILE%\Desktop\Helpany.url`"`r`n)"
$gpoScripts = "\\cascades.local\SYSVOL\cascades.local\Policies\{$guid}\User\Scripts\Logon"
New-Item -ItemType Directory -Path $gpoScripts -Force | Out-Null
Set-Content "$gpoScripts\deploy-caregiver-shortcuts.bat" $bat -Force
$ini = "[Logon]`r`n0CmdLine=deploy-caregiver-shortcuts.bat`r`n0Parameters=`r`n"
Set-Content "$gpoScripts\scripts.ini" $ini -Force
# Remove broken GPP
$xmlDir = "\\cascades.local\SYSVOL\cascades.local\Policies\{$guid}\User\Preferences"
if (Test-Path $xmlDir) { Remove-Item $xmlDir -Recurse -Force }
Write-Output "Logon script + scripts.ini written, GPP removed"
Get-Content "$gpoScripts\deploy-caregiver-shortcuts.bat"
