Run PowerShell 7 Script
Available for Windows (64-bit) only
This Automation Manager object runs a PowerShell 7 script and includes all required components. You do not need to install PowerShell 7 or additional .NET runtime components on managed devices.
PowerShell module support
The PowerShell 7 object supports standard PowerShell 7 cmdlets and compatible PowerShell modules, including:
- Built-in PowerShell 7 functionality.
- Compatible custom modules.
- Supported modules already installed on the managed endpoint.
Some legacy PowerShell 5.1 modules may not be compatible with PowerShell 7. Verify module compatibility before migrating existing automation policies to the PowerShell 7 object.
Execution context compatibility
To maintain compatibility with existing automation policies, the PowerShell 7 object supports the following Automation Manager execution contexts:
- Local System.
- Custom credentials.
- Device credentials.
- Currently logged-on user.
Editor enhancements
- PowerShell syntax highlighting.
- Line numbers.
- Current line highlighting.
- Word wrap support.
- Parameter autocomplete: Type
$to display available input and output parameters. - Font scaling and zoom: Adjust the editor font size using zoom controls or mouse scroll shortcuts.
- Editor window behavior: Opens maximized by default and remembers its last size and position.
-
Reserved variables: Do not use
$Resultor$ResultStringin the embedded PowerShell script. These variables are reserved for internal use and may prevent the object from running correctly. -
Password security: Password parameters are treated as regular
System.Stringvalues and are not secure when passed to this object.
Privileges
Normal
Input parameters
| Name | Type | Required | Description |
|---|---|---|---|
| Script | String | Yes | The contents of the PowerShell script. |
| Input Parameter List | User Configurable | No | Input parameters are created by the user. |
-
Passwords containing apostrophes: Replace each single quote (
') with two single quotes ('') when entering a password into a password field. For example, if the password isab'cd, enterab''cd. -
Number type values: The maximum allowable value (
1E+308) is not valid when running the policy in N-central.
Output parameters
| Name | Type | Required | Description |
|---|---|---|---|
| Output Parameter List | Configurable | No | Output parameters are created by the user. |
| Result | Number | Returns 0 for success or a nonzero value for failure. |
Any value other than 0 causes the policy run to fail when using the Run PowerShell Script 7 object.
Example parameters
| Name | Type | Required | Description |
|---|---|---|---|
| Input Parameters | User Configurable | No | Create input parameters for the script. |
| Script | String | Yes | Paste PowerShell script contents. |
| Output Parameters | User Configurable | No | Create output parameters for the script. |
| Run as Current Logged on User | Boolean | No | Run the script as the current logged on user. |
