The execution of Rescue scripts needs some special knowledge from the script writers, especially when the applet side script or binary is not a directly executable code.
Such are PowerShell scripts, those cannot be directly started from command shell. Earlier scripts with extension PS1 could be started, but not now.
I have created a template that consists of two components, a starter scrip (CMD) and a PowerShell Script (PS1) as a resource. The template is also an example for
- delaying the clean up of the applet, until the PS1 script really ends
- logging for the command, and collecting the logs for the log shown in the TC
- break out from the hidden-no UI state of scrips preferred by the applet.
You are right, you can execute the PS1 script in PowerShell, too.
My goal was to publish a Rescue script that can be added to the set of scripts of a Technician Console.
Since Microsoft has changed settings, PS1 script cannot be started from command line.
To execute PS1 files (PowerShell scripts) as rescue scripts:
Replace scriptname.ps1 with your actual file name.
To execute PS1 files as Rescue Scripts: Create a Starter CMD Script: Use a CMD script to invoke the PowerShell script, ensuring it waits for completion and handles logging. Run PowerShell Script: Call the PS1 file from the CMD script using powershell -ExecutionPolicy Bypass -File "path\to\script.ps1". Manage Cleanup and Logs: Ensure the CMD script manages cleanup after the PS1 script finishes and collects logs for review.