Scripting examples for common PowerShell tasksLast Updated February 19, 2025
PowerShell
tasksYou can cut,
paste, and edit the JavaScript examples to write scripts for common
PowerShell
tasks.
For more information about scripting, see the .
Automation Orchestrator
Developer's GuideRun a
PowerShell
Script Through the APIYou can use JavaScript to run
a
PowerShell
script through the plug-in API.
This example script performs
the following actions.
- Opens a session to aPowerShellhost.
- Provides a script to run.
- Checks invocation results.
- Closes the session.
Work with
Result
You can use JavaScript to work
with the result of a
PowerShell
script run.
This example script performs
the following actions.
- Checks the invocation state.
- Extracts a value from the result.
- Checks theRemotePSObjecttype.
Connect with Custom
Credentials
You can use JavaScript to
connect to a
PowerShell
host
with custom credentials.