Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Set-CMTSStepRunPowerShellScript
- Module:
- ConfigurationManager Module
Configure an instance of the Run PowerShell Script task sequence step.
Syntax
ByValue (Default)
Set-CMTSStepRunPowerShellScript
-InputObject <IResultObject>
[-ExecutionPolicy <ExecutionPolicyType>]
[-OutputVariableName <String>]
[-PackageId <String>]
[-Parameter <String>]
[-ScriptName <String>]
[-SourceScript <String>]
[-SuccessCode <Int32[]>]
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-AddCondition <IResultObject[]>]
[-ClearCondition]
[-Description <String>]
[-IsContinueOnError <Boolean>]
[-IsEnabled <Boolean>]
[-MoveToIndex <Int32>]
[-NewStepName <String>]
[-RemoveConditionFile]
[-RemoveConditionFolder]
[-RemoveConditionIfStatement]
[-RemoveConditionOperatingSystem]
[-RemoveConditionQueryWmi]
[-RemoveConditionRegistry]
[-RemoveConditionSoftware]
[-RemoveConditionVariable]
[-StepName <String>]
[-StepOrder <ReorderType>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ById
Set-CMTSStepRunPowerShellScript
-TaskSequenceId <String>
[-ExecutionPolicy <ExecutionPolicyType>]
[-OutputVariableName <String>]
[-PackageId <String>]
[-Parameter <String>]
[-ScriptName <String>]
[-SourceScript <String>]
[-SuccessCode <Int32[]>]
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-AddCondition <IResultObject[]>]
[-ClearCondition]
[-Description <String>]
[-IsContinueOnError <Boolean>]
[-IsEnabled <Boolean>]
[-MoveToIndex <Int32>]
[-NewStepName <String>]
[-RemoveConditionFile]
[-RemoveConditionFolder]
[-RemoveConditionIfStatement]
[-RemoveConditionOperatingSystem]
[-RemoveConditionQueryWmi]
[-RemoveConditionRegistry]
[-RemoveConditionSoftware]
[-RemoveConditionVariable]
[-StepName <String>]
[-StepOrder <ReorderType>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByName
Set-CMTSStepRunPowerShellScript
-TaskSequenceName <String>
[-ExecutionPolicy <ExecutionPolicyType>]
[-OutputVariableName <String>]
[-PackageId <String>]
[-Parameter <String>]
[-ScriptName <String>]
[-SourceScript <String>]
[-SuccessCode <Int32[]>]
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-AddCondition <IResultObject[]>]
[-ClearCondition]
[-Description <String>]
[-IsContinueOnError <Boolean>]
[-IsEnabled <Boolean>]
[-MoveToIndex <Int32>]
[-NewStepName <String>]
[-RemoveConditionFile]
[-RemoveConditionFolder]
[-RemoveConditionIfStatement]
[-RemoveConditionOperatingSystem]
[-RemoveConditionQueryWmi]
[-RemoveConditionRegistry]
[-RemoveConditionSoftware]
[-RemoveConditionVariable]
[-StepName <String>]
[-StepOrder <ReorderType>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByIdSetConditionIfStatement
Set-CMTSStepRunPowerShellScript
-TaskSequenceId <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-Condition <IResultObject[]>]
[-SetConditionIfStatement]
[-StatementType <ConditionStatementType>]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameSetConditionIfStatement
Set-CMTSStepRunPowerShellScript
-TaskSequenceName <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-Condition <IResultObject[]>]
[-SetConditionIfStatement]
[-StatementType <ConditionStatementType>]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByValueSetConditionIfStatement
Set-CMTSStepRunPowerShellScript
-InputObject <IResultObject>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-Condition <IResultObject[]>]
[-SetConditionIfStatement]
[-StatementType <ConditionStatementType>]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByIdSetConditionVariable
Set-CMTSStepRunPowerShellScript
-TaskSequenceId <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-ConditionVariableName <String>]
[-ConditionVariableValue <String>]
[-OperatorType <VariableOperatorType>]
[-SetConditionVariable]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameSetConditionVariable
Set-CMTSStepRunPowerShellScript
-TaskSequenceName <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-ConditionVariableName <String>]
[-ConditionVariableValue <String>]
[-OperatorType <VariableOperatorType>]
[-SetConditionVariable]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByValueSetConditionVariable
Set-CMTSStepRunPowerShellScript
-InputObject <IResultObject>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-ConditionVariableName <String>]
[-ConditionVariableValue <String>]
[-OperatorType <VariableOperatorType>]
[-SetConditionVariable]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByIdSetConditionFile
Set-CMTSStepRunPowerShellScript
-TaskSequenceId <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-FileDateTimeOperator <VariableOperatorType>]
[-FilePath <String>]
[-FileTimestamp <DateTime>]
[-FileVersion <String>]
[-SetConditionFile]
[-StepName <String>]
[-VersionOperator <VariableOperatorType>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameSetConditionFile
Set-CMTSStepRunPowerShellScript
-TaskSequenceName <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-FileDateTimeOperator <VariableOperatorType>]
[-FilePath <String>]
[-FileTimestamp <DateTime>]
[-FileVersion <String>]
[-SetConditionFile]
[-StepName <String>]
[-VersionOperator <VariableOperatorType>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByValueSetConditionFile
Set-CMTSStepRunPowerShellScript
-InputObject <IResultObject>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-FileDateTimeOperator <VariableOperatorType>]
[-FilePath <String>]
[-FileTimestamp <DateTime>]
[-FileVersion <String>]
[-SetConditionFile]
[-StepName <String>]
[-VersionOperator <VariableOperatorType>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByIdSetConditionFolder
Set-CMTSStepRunPowerShellScript
-TaskSequenceId <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-FolderDateTimeOperator <VariableOperatorType>]
[-FolderPath <String>]
[-FolderTimestamp <DateTime>]
[-SetConditionFolder]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameSetConditionFolder
Set-CMTSStepRunPowerShellScript
-TaskSequenceName <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-FolderDateTimeOperator <VariableOperatorType>]
[-FolderPath <String>]
[-FolderTimestamp <DateTime>]
[-SetConditionFolder]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByValueSetConditionFolder
Set-CMTSStepRunPowerShellScript
-InputObject <IResultObject>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-FolderDateTimeOperator <VariableOperatorType>]
[-FolderPath <String>]
[-FolderTimestamp <DateTime>]
[-SetConditionFolder]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByValueSetConditionQueryWmi
Set-CMTSStepRunPowerShellScript
-InputObject <IResultObject>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-Namespace <String[]>]
[-Query <String>]
[-SetConditionQueryWmi]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByValueSetConditionOperatingSystem
Set-CMTSStepRunPowerShellScript
-InputObject <IResultObject>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-SetConditionOperatingSystem]
[-StepName <String>]
[-SupportedPlatform <IResultObject[]>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByValueSetConditionRegistry
Set-CMTSStepRunPowerShellScript
-InputObject <IResultObject>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-RegistryKey <String>]
[-RegistryOperator <VariableOperatorType>]
[-RegistryValueData <String>]
[-RegistryValueName <String>]
[-RootKey <RegistryRootKeyType>]
[-SetConditionRegistry]
[-StepName <String>]
[-ValueType <RegistryValueType>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByValueSetConditionSoftware
Set-CMTSStepRunPowerShellScript
-InputObject <IResultObject>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-IsAnyVersion <Boolean>]
[-MsiFilePath <String>]
[-SetConditionSoftware]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByIdSetConditionSoftware
Set-CMTSStepRunPowerShellScript
-TaskSequenceId <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-IsAnyVersion <Boolean>]
[-MsiFilePath <String>]
[-SetConditionSoftware]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameSetConditionSoftware
Set-CMTSStepRunPowerShellScript
-TaskSequenceName <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-IsAnyVersion <Boolean>]
[-MsiFilePath <String>]
[-SetConditionSoftware]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByIdSetConditionQueryWmi
Set-CMTSStepRunPowerShellScript
-TaskSequenceId <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-Namespace <String[]>]
[-Query <String>]
[-SetConditionQueryWmi]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameSetConditionQueryWmi
Set-CMTSStepRunPowerShellScript
-TaskSequenceName <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-Namespace <String[]>]
[-Query <String>]
[-SetConditionQueryWmi]
[-StepName <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByIdSetConditionRegistry
Set-CMTSStepRunPowerShellScript
-TaskSequenceId <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-RegistryKey <String>]
[-RegistryOperator <VariableOperatorType>]
[-RegistryValueData <String>]
[-RegistryValueName <String>]
[-RootKey <RegistryRootKeyType>]
[-SetConditionRegistry]
[-StepName <String>]
[-ValueType <RegistryValueType>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameSetConditionRegistry
Set-CMTSStepRunPowerShellScript
-TaskSequenceName <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-RegistryKey <String>]
[-RegistryOperator <VariableOperatorType>]
[-RegistryValueData <String>]
[-RegistryValueName <String>]
[-RootKey <RegistryRootKeyType>]
[-SetConditionRegistry]
[-StepName <String>]
[-ValueType <RegistryValueType>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByIdSetConditionOperatingSystem
Set-CMTSStepRunPowerShellScript
-TaskSequenceId <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-SetConditionOperatingSystem]
[-StepName <String>]
[-SupportedPlatform <IResultObject[]>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByNameSetConditionOperatingSystem
Set-CMTSStepRunPowerShellScript
-TaskSequenceName <String>
[-TimeoutMins <Int32>]
[-UserName <String>]
[-UserPassword <SecureString>]
[-WorkingDirectory <String>]
[-SetConditionOperatingSystem]
[-StepName <String>]
[-SupportedPlatform <IResultObject[]>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Use this cmdlet to configure an instance of the Run PowerShell Script task sequence step.
For more information on this step, see About task sequence steps: Run PowerShell Script.
Note
Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.
Examples
Example 1
This example changes the Run PowerShell Script step in the Default OS deployment task sequence to use the contents of an existing script file.
$tsNameOsd = "Default OS deployment"
$tsStepNameRunPwsh = "Run PowerShell Script"
$scriptFile = "C:\Users\janed\scripts\Add-ContosoBrand.ps1"
$content = [IO.File]::ReadAllText( $scriptFile )
Set-CMTSStepRunPowerShellScript -TaskSequenceName $tsNameOsd -StepName $tsStepNameRunPwsh -SourceScript $content
Parameters
-AddCondition
Specify a condition object to add to this step. To get this object, use one of the task sequence condition cmdlets. For example, Get-CMTSStepConditionVariable.
Parameter properties
| Type: | IResultObject[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AddConditions |
Parameter sets
-ClearCondition
Remove a condition from this step. Use the -Condition parameter to specify the condition to remove.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | ClearConditions |
Parameter sets
-Condition
Specify a condition object to use with this step. To get this object, use one of the task sequence condition cmdlets. For example, Get-CMTSStepConditionVariable.
Parameter properties
| Type: | IResultObject[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | SubCondition, SubConditions |
Parameter sets
-ConditionVariableName
Specify the name of the task sequence variable to use as a condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Variable |
Parameter sets
-ConditionVariableValue
Specify the value of the task sequence variable to use in a condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Value |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-Description
Specify an optional description for this task sequence step.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DisableWildcardHandling
This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ExecutionPolicy
Specify the PowerShell execution policy for the scripts you allow to run on the computer. Choose one of the following policies:
AllSigned: Only run scripts signed by a trusted publisher.Undefined: Don't define any execution policy.Bypass: Load all configuration files and run all scripts. If you download an unsigned script from the internet, PowerShell doesn't prompt for permission before running the script.
Parameter properties
| Type: | ExecutionPolicyType |
| Default value: | None |
| Accepted values: | AllSigned, Undefined, Bypass |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | PowerShellExecutionPolicy |
Parameter sets
-FileDateTimeOperator
Specify a variable operator type for a file date/time condition.
Parameter properties
| Type: | VariableOperatorType |
| Default value: | None |
| Accepted values: | Equals, NotEquals, Greater, GreaterEqual, Less, LessEqual |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-FilePath
Specify the path for a file condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-FileTimestamp
Specify a date/time value to use for a file condition.
Parameter properties
| Type: | DateTime |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-FileVersion
Specify a version string for a file condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-FolderDateTimeOperator
Specify a variable operator for a folder date/time condition.
Parameter properties
| Type: | VariableOperatorType |
| Default value: | None |
| Accepted values: | Equals, NotEquals, Greater, GreaterEqual, Less, LessEqual |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-FolderPath
Specify the path for a folder condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-FolderTimestamp
Specify a date/time value to use for a folder condition.
Parameter properties
| Type: | DateTime |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ForceWildcardHandling
This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-InputObject
Specify a task sequence object from which to get the Run PowerShell Script step. To get this object, use the Get-CMTaskSequence cmdlet.
Parameter properties
| Type: | IResultObject |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | TaskSequence |
Parameter sets
-IsAnyVersion
Use this parameter with the SetConditionSoftware parameter to match any version of the product.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-IsContinueOnError
Use this parameter to enable the step option Continue on error. When you enable this option, if the step fails, the task sequence continues.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | IsThisStepContinueOnError |
Parameter sets
-IsEnabled
Use this parameter to enable this task sequence step.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | IsThisStepEnabled |
Parameter sets
-MoveToIndex
Move this step to the specified index position in the task sequence.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MsiFilePath
Specify the path to a Windows Installer file for a software condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Namespace
Specify the namespace for a WMI query condition.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-NewStepName
Use this parameter to rename this task sequence step.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-OperatorType
Specify an operator to use with a task sequence variable condition.
Parameter properties
| Type: | VariableOperatorType |
| Default value: | None |
| Accepted values: | Exists, NotExists, Equals, NotEquals, Greater, GreaterEqual, Less, LessEqual, Like, NotLike |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-OutputVariableName
Specify the name of a custom task sequence variable. When you use this parameter, the step saves the last 1000 characters of the command output to the variable.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Output, OutputVariable |
Parameter sets
-PackageId
Specify the package ID for the package that has the PowerShell script. The package doesn't require a program. One package can contain multiple scripts.
This value is a standard package ID, for example XYZ00821.
Then use the ScriptName parameter to specify the name of the script.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Parameter
Specify the parameters passed to the PowerShell script. These parameters are the same as the PowerShell script parameters on the command line. Provide parameters consumed by the script, not for the PowerShell command line.
The following example contains valid parameters:
-MyParameter1 MyValue1 -MyParameter2 MyValue2
The following example contains invalid parameters. The first two items are PowerShell command-line parameters (NoLogo and ExecutionPolicy). The script doesn't consume these parameters.
-NoLogo -ExecutionPolicy Unrestricted -File MyScript.ps1 -MyParameter1 MyValue1 -MyParameter2 MyValue2
If a parameter value includes a special character or a space, use single quotation marks (') around the value. Using double quotation marks (") may cause the task sequence step to incorrectly process the parameter.
For example: -Arg1 '%TSVar1%' -Arg2 '%TSVar2%'
You can also set this parameter to a task sequence variable. For example, if you specify %MyScriptVariable%, when the task sequence runs the script, it adds the value of this custom variable to the PowerShell command line.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Parameters |
Parameter sets
-Query
Specify a WMI query string to use for a condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RegistryKey
Specify the key to use with a registry condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RegistryOperator
Specify an operator to use with a registry condition.
Parameter properties
| Type: | VariableOperatorType |
| Default value: | None |
| Accepted values: | Exists, NotExists, Equals, NotEquals, Greater, GreaterEqual, Less, LessEqual |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RegistryValueData
Specify the value data to use with a registry condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RegistryValueName
Specify the value name to use with a registry condition.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RemoveConditionFile
Use this parameter to remove a file condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RemoveConditionFolder
Use this parameter to remove a folder condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RemoveConditionIfStatement
Use this parameter to remove an if statement condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RemoveConditionOperatingSystem
Use this parameter to remove an OS condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RemoveConditionQueryWmi
Use this parameter to remove a WMI query condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RemoveConditionRegistry
Use this parameter to remove a registry condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RemoveConditionSoftware
Use this parameter to remove a software condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RemoveConditionVariable
Use this parameter to remove a task sequence variable condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RootKey
Specify the root key to use with a registry condition.
Parameter properties
| Type: | RegistryRootKeyType |
| Default value: | None |
| Accepted values: | HKeyCurrentUser, HKeyLocalMachine, HKeyUsers, HKeyCurrentConfig |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ScriptName
Specify the name of the script to run. This script is in the package specified by the PackageId parameter.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SetConditionFile
Add a new file condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SetConditionFolder
Add a new folder condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SetConditionIfStatement
Add a new if statement condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SetConditionOperatingSystem
Add a new OS condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SetConditionQueryWmi
Add a new WMI query condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SetConditionRegistry
Add a new registry condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SetConditionSoftware
Add a new software condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SetConditionVariable
Add a new task sequence variable condition.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SourceScript
Instead of using the PackageId and ScriptName parameters, use this parameter to directly specify the script commands. This string value is the PowerShell commands that this step runs.
You can read the contents of an existing script file into a string variable, and then use that variable for this parameter. For example:
$script = [IO.File]::ReadAllText( "C:\temp\script.ps1" )
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | SourceCode |
Parameter sets
-StatementType
Set the type for an if statement condition.
Parameter properties
| Type: | ConditionStatementType |
| Default value: | None |
| Accepted values: | All, Any, None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Operator |
Parameter sets
-StepName
Specify the name of the step to select for changes.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StepOrder
Use this parameter to reorder the step in the task sequence.
Parameter properties
| Type: | ReorderType |
| Default value: | None |
| Accepted values: | MoveUp, MoveDown, MoveToIndex |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SuccessCode
Specify an array of integer values as exit codes from the script that the step should evaluate as success.
Parameter properties
| Type: | Int32[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | SuccessCodes |
Parameter sets
-SupportedPlatform
Use this parameter to specify the platforms for an OS condition.
Parameter properties
| Type: | IResultObject[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | SupportedPlatforms |
Parameter sets
-TaskSequenceId
Specify the package ID of the task sequence from which to get the Run PowerShell Script step. This value is a standard package ID, for example XYZ00858.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Id, TaskSequencePackageId |
Parameter sets
-TaskSequenceName
Specify the name of the task sequence to target for changes.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-TimeoutMins
Specify an integer value that represents how long Configuration Manager allows the script to run. This value can be from 1 minute to 999 minutes. The default value is 15 minutes.
If you enter a value that doesn't allow enough time for the specified script to complete successfully, this step fails. The entire task sequence could fail depending on step or group conditions. If the timeout expires, Configuration Manager terminates the PowerShell process.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | TimeoutInMinutes |
Parameter sets
-UserName
Use this parameter to run the script as a Windows user account and not the local system account. Specify the name of the Windows user account. To specify the account password, use the UserPassword parameter.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-UserPassword
Use this parameter to specify the password of the account that you specify with UserName.
Parameter properties
| Type: | SecureString |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Password |
Parameter sets
-ValueType
Specify the type of value for a registry condition.
Parameter properties
| Type: | RegistryValueType |
| Default value: | None |
| Accepted values: | RegistrySZ, RegistryExpandSZ, RegistryDWord |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-VersionOperator
Specify an operator to use with a file condition.
Parameter properties
| Type: | VariableOperatorType |
| Default value: | None |
| Accepted values: | Equals, NotEquals, Greater, GreaterEqual, Less, LessEqual |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet doesn't run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
-WorkingDirectory
Specify the folder in which the command starts. This path can be up to 127 characters.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | StartIn |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
Microsoft.ConfigurationManagement.ManagementProvider.IResultObject
Outputs
System.Object
Related Links
Feedback
Was this page helpful?
