Invoke-pmScript

Description

This cmdlet will invoke the specified script in the current Powershell runspace.

This cmdlet is only accessible by PowerMapi Platinum members.

Syntax
Note: Parameters in orange are optional.
Invoke-pmScript
-ScriptNameString
-ArgsObject[]
-CredentialsPSCredential
Invoke-pmScript
-CommunityFileIDInt32
-ArgsObject[]
-CredentialsPSCredential
Parameters
ScriptNameA text string that is the name of a script to retrieve from either the Community forum, or from the user's private scripts. If the same name exists in both areas, the private file is chosen. See remarks.
CommunityFileIDAn Int32 value that is the FileID of a community forum script. See remarks.
ArgsAn optional array of values that are passed as arguments to the script.
CredentialsA PSCredential object holding the username and password for a Platinum site member.
Remarks

Similar to Get-pmScript, this cmdlet will search for a script from PowerMapi.com.  This cmdlet however, upon finding the requested script, will invoke the script directly without having to save the script locally.

This cmdlet implements the ShouldProcess attribute and the ConfirmImpact attribute is set to Medium.  On systems where the policy has been changed to prompt at High, this cmdlet will not prompt to execute.  Execution confirmation can be forced by using the -Confirm parameter.

Invoked scripts are cached in memory so that subsequent calls to the same script can execute immediately, without waiting for the script to be pulled from PowerMapi.com.  Cached scripts, by default, expire after 15 minutes of no use and this interval can be adjusted (for the current PowerMapi host instance) using Set-pmCachedScriptExpire.  Each subsequent invocation of a script resets the timer.

This cmdlet searches private scripts first before searching community scripts.   See Get-pmScript's remarks about FileID and ambiguity.