--- title: "Logoffcleanup PowerShell Script Opening in Notepad" slug: "logoffcleanup-powershell-script-opening-in-notepad" description: "Sometimes, when configured to launch a PowerShell script in the registry, the script is opened in Notepad when a user logs out of XA:" updated: 2022-06-01T19:53:55Z published: 2022-06-01T19:53:55Z canonical: "healthcare.rapididentity.com/logoffcleanup-powershell-script-opening-in-notepad" --- > ## Documentation Index > Fetch the complete documentation index at: https://healthcare.rapididentity.com/llms.txt > Use this file to discover all available pages before exploring further. # Logoffcleanup PowerShell Script Opening in Notepad ## Logoffcleanup PowerShell Script Opening in Notepad ### PROBLEM BEHAVIOR When configured to launch a PowerShell script in the registry, the script is opened in Notepad when a user logs out of XA: [HKEY_LOCAL_MACHINE\Software\HealthCast\eXactACCESS\LogoffCleanup Settings\LogoffScript\MyScript.ps1] "Path"="C:\Program Files (x86)\HealthCast\eXactACCESS\wrappers\xaLogoffCleanup\" ### EXPECTED BEHAVIOR The PowerShell script should run (and not open in Notepad) when a user logs out of XA. ### OTHER BEHAVIOR If you double-click the PowerShell script file, it also opens in Notepad. ### AFFECTS: All versions of XA running on Windows 10. ### ROOT CAUSE: Security Behavior in Windows 10 Windows 10 sets the default app for PS1 files to Notepad rather than PowerShell, as a security precaution (to prevent the accidental running of a malicious script). ### RESOLUTION 1. In Windows, change the default program for opening PowerShell scripts to PowerShell (most customers will be unwilling to do this). 2. Rather than running a script file, run PowerShell and pass the script name as a parameter: [HKEY_LOCAL_MACHINE\SOFTWARE\HealthCast\eXactACCESS\LogoffCleanup Settings\LogoffScript\powershell.exe] Path=C:\Windows\System32\WindowsPowerShell\v1.0\ Param=-executionPolicy bypass -WindowStyle Hidden -file \"C:\Program Files (x86)\HealthCast\eXactACCESS\wrappers\xaLogoffCleanup\MyScript.ps1" ## Related - [Logoff Cleanup](/xa-configure-logoff-cleanup.md)