### Get Install Application Step by Task Sequence Object Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMTSStepInstallApplication.md This example demonstrates how to get the 'Install Application' step by first retrieving a task sequence object using Get-CMTaskSequence and then passing it as input to Get-CMTSStepInstallApplication. ```powershell $tsNameOsd = "Default OS deployment" $tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast $tsStepNameInstallApp = "Install Application" $tsStepInstallApp = Get-CMTSStepInstallApplication -InputObject $tsOsd -StepName $tsStepNameInstallApp ``` -------------------------------- ### Get Setup Windows and ConfigMgr Step by Task Sequence Object Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMTSStepSetupWindowsAndConfigMgr.md This example demonstrates how to retrieve the 'Setup Windows and ConfigMgr' step by first obtaining a task sequence object using its name and then passing that object to the cmdlet. This method is useful when you already have the task sequence object or need to perform operations on it before retrieving the step. ```powershell $tsNameOsd = "Default OS deployment" $tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast $tsStepNameSetupWinCM = "Setup Windows and ConfigMgr" $tsStepSetupWinCM = Get-CMTSStepSetupWindowsAndConfigMgr -InputObject $tsOsd -StepName $tsStepNameSetupWinCM ``` -------------------------------- ### Set-CMTSStepInstallApplication Example Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepInstallApplication.md This example changes the **Install Application** step in the **Default OS deployment** task sequence to install apps according to a dynamic variable list **ITApps**. ```APIDOC ## Set-CMTSStepInstallApplication ### Description Modifies an existing Install Application step in a task sequence. ### Parameters #### -TaskSequenceName Specifies the name of the task sequence to modify. - Type: String - Parameter Sets: ByName - Required: True - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -StepName Specifies the name of the Install Application step to modify. - Type: String - Parameter Sets: ByName - Required: True - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -NewStepName Specifies a new name for the Install Application step. - Type: String - Parameter Sets: ByValue, ById, ByName - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -BaseVariableName Use this parameter to install applications according to a dynamic variable list. Then the task sequence installs applications using this base variable name. - Type: String - Parameter Sets: ByValue, ById, ByName - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -ContinueOnInstallError Set this parameter to `$true` to continue installing other applications in the list if an application fails to install. If you set this parameter to `$false`, and the installation fails, the step immediately ends. - Type: Boolean - Parameter Sets: ByValue, ById, ByName - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -RetryCount Specifies the number of times to retry installing an application if it fails. - Type: Int32 - Parameter Sets: ByValue, ById, ByName - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -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](Get-CMTSStepConditionVariable.md). - Type: IResultObject[] - Parameter Sets: ByValue, ById, ByName - Aliases: AddConditions - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -Application Specify one or more application objects to install. To get this object, use the [Get-CMApplication](Get-CMApplication.md) cmdlet. - Type: IResultObject[] - Parameter Sets: ByValue, ById, ByName - Aliases: Applications - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -ClearCache Set this parameter to `$true` to clear application content from the client cache after installing the app. This behavior is beneficial on devices with small hard drives or when installing lots of large apps in succession. - Type: Boolean - Parameter Sets: ByValue, ById, ByName - Aliases: RemoveFromCache - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -ClearCondition Remove a condition from this step. Use the **-Condition** parameter to specify the condition to remove. - Type: SwitchParameter - Parameter Sets: ByValue, ById, ByName - Aliases: ClearConditions - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -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](Get-CMTSStepConditionVariable.md). - Type: IResultObject[] - Parameter Sets: ByIdSetConditionIfStatement, ByNameSetConditionIfStatement, ByValueSetConditionIfStatement - Aliases: SubCondition, SubConditions - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -ConditionVariableName Specify the name of the task sequence variable to use as a condition. - Type: String - Parameter Sets: ByIdSetConditionVariable, ByNameSetConditionVariable, ByValueSetConditionVariable - Aliases: Variable - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -ConditionVariableValue Specify the value of the task sequence variable to use in a condition. - Type: String - Parameter Sets: ByIdSetConditionVariable, ByNameSetConditionVariable, ByValueSetConditionVariable - Aliases: Value - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -Description Specify an optional description for this task sequence step. - Type: String - Parameter Sets: ByValue, ById, ByName - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -DisableWildcardHandling This parameter treats wildcard characters as literal character values. You can't combine it with **ForceWildcardHandling**. - Type: SwitchParameter - Parameter Sets: (All) - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False #### -EnableContinueOnInstallError Set this parameter to `$true` to continue installing other applications in the list if an application fails to install. If you set this parameter to `$false`, and the installation fails, the step immediately ends. - Type: Boolean - Parameter Sets: ByValue, ById, ByName - Required: False - Position: Named - Default value: None - Accept pipeline input: False - Accept wildcard characters: False ### Request Example ```powershell $tsNameOsd = "Default OS deployment" $tsStepNameInstallApp = "Install Application" Set-CMTSStepInstallApplication -TaskSequenceName $tsNameOsd -StepName $tsStepNameInstallApp -NewStepName "Install IT apps" -BaseVariableName "ITApps" -ContinueOnInstallError $true -RetryCount 5 ``` ``` -------------------------------- ### Example: Change Install Package step to install packages from a dynamic variable list Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepInstallSoftware.md This example demonstrates how to modify the 'Install Package' task sequence step to install packages dynamically based on a variable list named 'ITtools'. It also sets the step to continue execution even if a package installation fails. ```powershell $tsNameOsd = "Default OS deployment" $tsStepNameInstallPkg = "Install Package" Set-CMTSStepInstallSoftware -TaskSequenceName $tsNameOsd -StepName $tsStepNameInstallPkg -NewStepName "Install IT tools" -BaseVariableName "ITtools" -ContinueOnInstallError ``` -------------------------------- ### Get Install Package Step by Task Sequence Object Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMTSStepInstallSoftware.md This example demonstrates how to retrieve the 'Install Package' step by first obtaining a task sequence object using Get-CMTaskSequence and then passing it as input to Get-CMTSStepInstallSoftware. ```powershell $tsNameOsd = "Default OS deployment" $tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast $tsStepNameInstallPkg = "Install Package" $tsStepInstallPkg = Get-CMTSStepInstallSoftware -InputObject $tsOsd -StepName $tsStepNameInstallPkg ``` -------------------------------- ### Distribute Content by Operating System Installer Name Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Start-CMContentDistribution.md This example shows how to start content distribution for an operating system installer by its name. ```APIDOC ## Start-CMContentDistribution -OperatingSystemInstallerName ### Description Starts content distribution for an operating system installer to specified distribution points or groups. ### Method Start-CMContentDistribution ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **OperatingSystemInstallerName** (String[]) - Required - The name of the operating system installer to distribute. - **CollectionName** (String[]) - Optional - The name of the collection to distribute the content to. - **DistributionPointGroupName** (String[]) - Optional - The name of the distribution point group to distribute the content to. - **DistributionPointName** (String[]) - Optional - The name of the distribution point to distribute the content to. - **DisableWildcardHandling** - Optional - Indicates whether wildcard handling is disabled. - **ForceWildcardHandling** - Optional - Indicates whether wildcard handling is forced. - **WhatIf** - Optional - Shows what would happen if the cmdlet runs. - **Confirm** - Optional - Prompts you for confirmation before running the cmdlet. - **CommonParameters** - Optional - Includes standard PowerShell parameters like Verbose, Debug, ErrorAction, etc. ``` -------------------------------- ### Create an installation source file from a secondary site location Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMInstallationSourceFile.md This example demonstrates creating an installation source file when the installation files are already present on the secondary site server. ```APIDOC ## New-CMInstallationSourceFile -CopyFromSecondarySiteLocation ### Description Indicates that the installation files for a secondary site installation reside on the secondary site server. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Query Parameters - **-LocalPath** (String) - Required - Specifies a path to source files in the local file system of the secondary site server. ### Request Example ```powershell New-CMInstallationSourceFile -CopyFromSecondarySiteLocation -LocalPath "C:\SCCM\SourceFiles" ``` ### Response #### Success Response (200) This cmdlet does not return a value. #### Response Example None ``` -------------------------------- ### Configure Install Software Updates Step Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepInstallUpdate.md This example shows how to configure the Install Software Updates step in a task sequence to install all available software updates. ```APIDOC ## Set-CMTSStepInstallUpdate ### Description Configures the Install Software Updates step in a task sequence. ### Parameters #### Path Parameters - **TaskSequenceId** (String) - Required - Specify the package ID of the task sequence. - **StepName** (String) - Optional - Specify the name of the step to select for changes. #### Query Parameters - **Target** (TargetType) - Optional - Specify a value for the type of updates to install. Accepted values: `All`, `Mandatory`. - **UseCache** (Boolean) - Optional - Set to `$true` to evaluate software updates from cached scan results. ### Example ```powershell Set-CMTSStepInstallUpdate -TaskSequenceId "XYZ00858" -Target "All" -UseCache $true ``` ``` -------------------------------- ### Example Usage Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepInstallUpdate.md Example of changing the Install Software Updates step in a task sequence. ```APIDOC ## Example 1 This example changes the **Install Software Updates** step in the **Default OS deployment** task sequence to only install required updates and not use the scan cache. ```powershell $tsNameOsd = "Default OS deployment" $tsStepNameInstallUpd = "Install Software Updates" Set-CMTSStepInstallUpdate -TaskSequenceName $tsNameOsd -StepName $tsStepNameInstallUpd -Target Mandatory -UseCache $false ``` ``` -------------------------------- ### Create an installation source file by copying from a network location Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMInstallationSourceFile.md This example shows how to create an installation source file for a secondary site by specifying a UNC path on the network. ```APIDOC ## New-CMInstallationSourceFile -CopyFromNetworkLocation ### Description Creates an installation source file for a secondary site installation by copying the installation files from a specified Universal Naming Convention (UNC) path. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Query Parameters - **-UncPath** (String) - Required - Specifies a UNC path to source files. ### Request Example ```powershell New-CMInstallationSourceFile -CopyFromNetworkLocation -UncPath "\\Server\Share\Path" ``` ### Response #### Success Response (200) This cmdlet does not return a value. #### Response Example None ``` -------------------------------- ### Change Client Push Installation Settings Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMClientPushInstallation.md This example demonstrates how to enable automatic client push installation for discovered computers and site system servers, specify an account for client installation, and set the site code property for the Windows Installer package. ```APIDOC ## Set-CMClientPushInstallation ### Description Changes the site configuration for client push installation, which installs the Configuration Manager client on discovered computers. ### Method `Set-CMClientPushInstallation` ### Parameters #### Path Parameters None #### Query Parameters None #### Cmdlet Parameters - **SiteCode** (string) - Required - The site code of the Configuration Manager site. - **EnableAutomaticClientPushInstallation** (bool) - Required - Enables or disables automatic client push installation for discovered computers. - **EnableSystemTypeConfiguationManager** (bool) - Required - Enables or disables pushing the client to site system servers. - **ChosenAccount** (string) - Required - The account to use for connecting to the computer to install the client software. - **InstallationProperty** (string) - Optional - Sets properties for the Windows Installer package, such as `SMSSITECODE` to assign the client to a specific site. ### Request Example ```powershell Set-CMClientPushInstallation -SiteCode "CM1" -EnableAutomaticClientPushInstallation $True -EnableSystemTypeConfiguationManager $True -ChosenAccount "contoso\svc_smspush" -InstallationProperty "SMSSITECODE=CM1" ``` ### Response This cmdlet does not return a value. It modifies the client push installation settings on the site. ``` -------------------------------- ### Change Install Application Step to Install Dynamic Apps Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepInstallApplication.md This example modifies the 'Install Application' step within a task sequence named 'Default OS deployment'. It renames the step to 'Install IT apps', configures it to install applications based on a dynamic variable list named 'ITApps', allows up to 5 retries on installation failure, and continues to the next step even if an application fails to install. ```powershell $tsNameOsd = "Default OS deployment" $tsStepNameInstallApp = "Install Application" Set-CMTSStepInstallApplication -TaskSequenceName $tsNameOsd -StepName $tsStepNameInstallApp -NewStepName "Install IT apps" -BaseVariableName "ITApps" -ContinueOnInstallError $true -RetryCount 5 ``` -------------------------------- ### Change Setup Windows and ConfigMgr step to use a pre-production client package Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepSetupWindowsAndConfigMgr.md Use this example to modify the 'Setup Windows and ConfigMgr' step in a task sequence to specify a pre-production client package ID. ```powershell Set-CMTSStepSetupWindowsAndConfigMgr -TaskSequenceName $tsNameOsd -StepName $tsStepNameSetupWinCM -PreproductionPackageId "XYZ00045" ``` -------------------------------- ### Set-CMTSStepSetupWindowsAndConfigMgr Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepSetupWindowsAndConfigMgr.md This example changes the **Setup Windows and ConfigMgr** step in the **Default OS deployment** task sequence to also use a pre-production client package. ```APIDOC ## Set-CMTSStepSetupWindowsAndConfigMgr ### Description Modifies the Setup Windows and Configuration Manager step in a task sequence. ### 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](Get-CMTSStepConditionVariable.md). ```yaml Type: IResultObject[] Parameter Sets: ByValue, ById, ByName Aliases: AddConditions Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -ClearCondition Remove a condition from this step. Use the **-Condition** parameter to specify the condition to remove. ```yaml Type: SwitchParameter Parameter Sets: ByValue, ById, ByName Aliases: ClearConditions Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -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](Get-CMTSStepConditionVariable.md). ```yaml Type: IResultObject[] Parameter Sets: ByIdSetConditionIfStatement, ByNameSetConditionIfStatement, ByValueSetConditionIfStatement Aliases: SubCondition, SubConditions Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -ConditionVariableName Specify the name of the task sequence variable to use as a condition. ```yaml Type: String Parameter Sets: ByIdSetConditionVariable, ByNameSetConditionVariable, ByValueSetConditionVariable Aliases: Variable Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -ConditionVariableValue Specify the value of the task sequence variable to use in a condition. ```yaml Type: String Parameter Sets: ByIdSetConditionVariable, ByNameSetConditionVariable, ByValueSetConditionVariable Aliases: Value Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -Description Specify an optional description for this task sequence step. ```yaml Type: String Parameter Sets: ByValue, ById, ByName Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -DisableWildcardHandling This parameter treats wildcard characters as literal character values. You can't combine it with **ForceWildcardHandling**. ```yaml Type: SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -FileDateTimeOperator Specify a variable operator type for a file date/time condition. ```yaml Type: VariableOperatorType Parameter Sets: ByIdSetConditionFile, ByNameSetConditionFile, ByValueSetConditionFile Aliases: Accepted values: Equals, NotEquals, Greater, GreaterEqual, Less, LessEqual Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -FilePath Specify the path for a file condition. ```yaml Type: String Parameter Sets: ByIdSetConditionFile, ByNameSetConditionFile, ByValueSetConditionFile Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -FileTimestamp Specify a date/time value to use for a file condition. ```yaml Type: DateTime Parameter Sets: ByIdSetConditionFile, ByNameSetConditionFile, ByValueSetConditionFile Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -FileVersion Specify a version string for a file condition. ```yaml Type: String Parameter Sets: ByIdSetConditionFile, ByNameSetConditionFile, ByValueSetConditionFile Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` #### -FolderDateTimeOperator Specify a variable operator for a folder date/time condition. ```yaml Type: VariableOperatorType Parameter Sets: ByIdSetConditionFolder, ByNameSetConditionFolder, ByValueSetConditionFolder Aliases: Accepted values: Equals, NotEquals, Greater, GreaterEqual, Less, LessEqual Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### Example This example changes the **Setup Windows and ConfigMgr** step in the **Default OS deployment** task sequence to also use a pre-production client package. ```powershell $tsNameOsd = "Default OS deployment" $tsStepNameSetupWinCM = "Setup Windows and ConfigMgr" Set-CMTSStepSetupWindowsAndConfigMgr -TaskSequenceName $tsNameOsd -StepName $tsStepNameSetupWinCM -PreproductionPackageId "XYZ00045" ``` ``` -------------------------------- ### Get Install Behaviors for a Specific Deployment Type Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMDeploymentTypeInstallBehavior.md This example retrieves the install behaviors for an MSI deployment type named 'InterDept - Windows Installer (.msi file)' associated with the application 'CenterApp'. It first gets the deployment type object using Get-CMDeploymentType and then passes it to Get-CMDeploymentTypeInstallBehavior. ```powershell $appName = "CenterApp" $dtName = "InterDept - Windows Installer (.msi file)" $msi_dt = Get-CMDeploymentType -ApplicationName $appName -DeploymentTypeName $dtName Get-CMDeploymentTypeInstallBehavior -InputObject $msi_dt ``` -------------------------------- ### Create an installation source file by copying from the parent site server Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMInstallationSourceFile.md This example demonstrates how to create an installation source file for a secondary site by copying the necessary files from the primary site server. ```APIDOC ## New-CMInstallationSourceFile -CopyFromParentSiteServer ### Description Creates an installation source file for a secondary site installation by copying the installation files from the primary site. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```powershell New-CMInstallationSourceFile -CopyFromParentSiteServer ``` ### Response #### Success Response (200) This cmdlet does not return a value. #### Response Example None ``` -------------------------------- ### Remove Setup Windows and ConfigMgr Step by Input Object Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Remove-CMTSStepSetupWindowsAndConfigMgr.md This example gets a task sequence object and then uses it to remove the 'Setup Windows and ConfigMgr' step. The -Force parameter is used to suppress confirmation prompts. ```powershell $tsNameOsd = "Default OS deployment" $tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast $tsStepNameSetupWinCM = "Setup Windows and ConfigMgr" Remove-CMTSStepSetupWindowsAndConfigMgr -InputObject $tsOsd -StepName $tsStepNameSetupWinCM -Force ``` -------------------------------- ### Create and Add Install Application Task Sequence Step Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMTSStepInstallApplication.md This example demonstrates how to retrieve an application object, create a new Install Application task sequence step using that object, and then add the step to a specified task sequence at a particular index. Ensure you have the Configuration Manager PowerShell module imported and are connected to your site. ```powershell $app = Get-CMApplication -Name "Central app" $step = New-CMTSStepInstallApplication -Name "Install Application" -Application $app $tsNameOsd = "Default OS deployment" $tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast $tsOsd | Add-CMTaskSequenceStep -Step $step -InsertStepStartIndex 11 ``` -------------------------------- ### Get Install Software Updates Step by Task Sequence Object Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMTSStepInstallUpdate.md This example retrieves the 'Install Software Updates' step from a task sequence object. Ensure the task sequence object is obtained first using Get-CMTaskSequence. ```powershell $tsNameOsd = "Default OS deployment" $tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast $tsStepNameInstallUpd = "Install Software Updates" $tsStepInstallUpd = Get-CMTSStepInstallUpdate -InputObject $tsOsd -StepName $tsStepNameInstallUpd ``` -------------------------------- ### Create a Site System Server Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMSiteSystemServer.md Use this example to create a new site system server with specified parameters, including proxy settings and account information. Ensure the necessary accounts and server names are valid for your environment. ```powershell New-CMSiteSystemServer -SiteSystemServerName "Server1.contoso.com" -SiteCode "MP5" -PublicFqdn "Internetsrv1.contoso.com" -FdmOperation $True -UseSiteServerAccount -EnableProxy $True -ProxyServerName "ProxyServer1" -ProxyServerPort 80 -ProxyAccessAccount (Get-CMAccount "contoso\proxysvc") ``` -------------------------------- ### Get Deployments for a Specific Configuration Policy Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMConfigurationPolicyDeployment.md This example first retrieves a specific configuration policy by name and then gets all deployments associated with that policy, displaying the target collection ID, start time, and enabled status. The -Fast parameter is used for performance. ```powershell $policy = Get-CMConfigurationPolicy -Name "ODfB policy" -Fast Get-CMConfigurationPolicyDeployment -InputObject $policy -Fast | Select-Object TargetCollectionID,StartTime,Enabled ``` -------------------------------- ### Create Bootable Media Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMBootableMedia.md This example demonstrates how to create bootable media in dynamic mode using the New-CMBootableMedia cmdlet. It first retrieves necessary objects like the boot image, distribution point, and management point, then uses them to create the media. ```APIDOC ## New-CMBootableMedia ### Description Creates bootable media for Configuration Manager. ### Parameters #### -AllowUacPrompt Adds a parameter to allow Windows to prompt you to elevate your administrator permissions with User Account Control (UAC). This cmdlet requires elevated permissions to run. - Type: SwitchParameter - Required: False - Position: Named #### -AllowUnattended Adds a parameter to allow an unattended OS deployment. An unattended OS deployment doesn't prompt for network configuration or optional task sequences. - Type: SwitchParameter - Required: False - Position: Named #### -AllowUnknownMachine Adds a parameter to allow Configuration Manager to provision unknown computers. An unknown computer is a computer that the site hasn't discovered yet. - Type: SwitchParameter - Required: False - Position: Named #### -BootImage Specifies a boot image object. To get this object, use the [Get-CMBootImage](Get-CMBootImage.md) cmdlet. - Type: IResultObject - Required: True - Position: Named - Aliases: BootImagePackage #### -CertificateExpireTime If you create a self-signed media certificate for HTTP communication, this parameter specifies the certificate's expiration date and time. Specify a datetime sufficiently in the future. When this certificate expires, you can't use the bootable media. Use the **-CertificateStartTime** parameter to set the start date. - Type: DateTime - Required: False - Position: Named #### -CertificatePassword If you use the **-CertificatePath** parameter to import a PKI certificate for HTTPS communication, use this parameter to specify the password for the certificate file. - Type: SecureString - Required: False - Position: Named #### -CertificatePath Specify the path to a PKI certificate to import. Use the **-CertificatePassword** parameter to specify the password for this certificate file. Use these parameters if you configure the site for HTTPS client communication. - Type: String - Required: False - Position: Named #### -CertificateStartTime To create a self-signed certificate for HTTP communication, this parameter specifies the certificate's start date and time. Use the **-CertificateExpireTime** parameter to set the expiration date. You can't use the bootable media until this date. - Type: DateTime - Required: False - Position: Named #### -DisableWildcardHandling This parameter treats wildcard characters as literal character values. You can't combine it with **ForceWildcardHandling**. - Type: SwitchParameter - Required: False - Position: Named ### Example 1: Create bootable media The first command gets the boot image object named **Boot image (x64)** and stores it in the **$BootImage** variable. The second command gets the distribution point role for **SiteServer01.Contoso.com** and stores it in the **$DistributionPoint** variable. The third command gets the management point role for **SiteServer02.Contoso.com** and stores it in the **$ManagementPoint** variable. The last command creates bootable media in dynamic mode. It uses the objects stored in the previous variables. ```powershell $BootImage = Get-CMBootImage -Name "Boot image (x64)" $DistributionPoint = Get-CMDistributionPoint -SiteCode CM1 $ManagementPoint = Get-CMManagementPoint -SiteSystemServerName "SiteSystemServer02.Contoso.com" New-CMBootableMedia -MediaMode Dynamic -MediaType CdDvd -Path "\\Server\share\test.iso" -AllowUnknownMachine -BootImage $BootImage -DistributionPoint $DistributionPoint -ManagementPoint $ManagementPoint ``` ``` -------------------------------- ### Create a site system server Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMSiteSystemServer.md This example demonstrates how to create a new site system server, specifying various configuration options including proxy settings and account information. ```APIDOC ## New-CMSiteSystemServer ### Description Creates a new site system server in Configuration Manager. ### Parameters #### Site System Server Name - **-SiteSystemServerName** (String) - Required - The name of the site system server to configure. #### Site Code - **-SiteCode** (String) - Optional - The site code for this site system. #### Public FQDN - **-PublicFqdn** (String) - Optional - Specify an FQDN for the site system to use on the internet. #### FDM Operation - **-FdmOperation** (Boolean) - Optional - Set to `$true` to require the site server to initiate connections to this site system. #### Use Site Server Account - **-UseSiteServerAccount** (SwitchParameter) - Optional - Use the site server's computer account to install this site system. #### Enable Proxy - **-EnableProxy** (Boolean) - Optional - Set to `$true` for the site system to use a proxy server when it synchronizes information from the internet. #### Proxy Server Name - **-ProxyServerName** (String) - Optional - If **EnableProxy** is `$true`, specify the name of the proxy server. #### Proxy Server Port - **-ProxyServerPort** (UInt32) - Optional - If **EnableProxy** is `$true`, specify the proxy server port number. #### Proxy Access Account - **-ProxyAccessAccount** (IResultObject) - Optional - If **EnableProxy** is `$true`, specify an account object for proxy authentication. #### Account Name - **-AccountName** (String) - Optional - Specify the account for installing this site system and for all connections from the site server. #### Disable Wildcard Handling - **-DisableWildcardHandling** (SwitchParameter) - Optional - Treats wildcard characters as literal character values. #### Force Wildcard Handling - **-ForceWildcardHandling** (SwitchParameter) - Optional - Processes wildcard characters and may lead to unexpected behavior. ### Request Example ```powershell New-CMSiteSystemServer -SiteSystemServerName "Server1.contoso.com" -SiteCode "MP5" -PublicFqdn "Internetsrv1.contoso.com" -FdmOperation $True -UseSiteServerAccount -EnableProxy $True -ProxyServerName "ProxyServer1" -ProxyServerPort 80 -ProxyAccessAccount (Get-CMAccount "contoso\proxysvc") ``` ``` -------------------------------- ### Get Access Account by Operating System Installer ID Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMAccessAccount.md Gets an access account associated with an operating system installer, identified by its ID. Username filtering is available. ```powershell Get-CMAccessAccount -OperatingSystemInstallerId "klmno" -UserName "MyDomain\MyUser" ``` -------------------------------- ### Create and Add Setup Windows and ConfigMgr Step Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMTSStepSetupWindowsAndConfigMgr.md Creates a Setup Windows and ConfigMgr step object using a specified package ID and then adds it to an existing task sequence at a specific index. ```powershell $step = New-CMTSStepSetupWindowsAndConfigMgr -Name "Setup Windows and ConfigMgr" -PackageId "XYZ0002" $tsNameOsd = "Default OS deployment" $tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast $tsOsd | Add-CMTaskSequenceStep -Step $step -InsertStepStartIndex 11 ``` -------------------------------- ### Create Bootable Media Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMBootableMedia.md This example demonstrates how to create bootable media in dynamic mode. It first retrieves the necessary boot image, distribution point, and management point objects, and then uses them to create the media. ```powershell $BootImage = Get-CMBootImage -Name "Boot image (x64)" $DistributionPoint = Get-CMDistributionPoint -SiteCode CM1 $ManagementPoint = Get-CMManagementPoint -SiteSystemServerName "SiteSystemServer02.Contoso.com" New-CMBootableMedia -MediaMode Dynamic -MediaType CdDvd -Path "\\Server\share\test.iso" -AllowUnknownMachine -BootImage $BootImage -DistributionPoint $DistributionPoint -ManagementPoint $ManagementPoint ``` -------------------------------- ### Get an application group by ID Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMApplicationGroup.md This example gets an application group by its unique ID. ```APIDOC ## Get-CMApplicationGroup -Id ### Description Gets an application group by its unique ID. ### Method GET ### Endpoint Not applicable (PowerShell cmdlet) ### Parameters #### Path Parameters None #### Query Parameters - **Id** (Int32) - Required - Specify the ID of the app group to get. This value is the same as the CI_ID. - **ShowHidden** (SwitchParameter) - Optional - Add this parameter to show hidden application groups. - **DisableWildcardHandling** (SwitchParameter) - Optional - Treats wildcard characters as literal character values. - **ForceWildcardHandling** (SwitchParameter) - Optional - Processes wildcard characters and may lead to unexpected behavior. ### Request Example ```powershell Get-CMApplicationGroup -Id 1025866 ``` ### Response #### Success Response (200) Returns an SMS_ApplicationGroup object. #### Response Example ```json { "__cimclass": "SMS_ApplicationGroup", "__server": "YourSMSProviderServer", "__namespace": "root\sms\site_XYZ", "__க்கல்": 1, "ApplicationGroupCI_ID": 1025866, "ApplicationGroupModelName": "ScopeId_.../ApplicationGroup_...", "CI_ID": 1025866, "CI_UniqueID": "ScopeId_.../ApplicationGroup_...", "DisplayName": "Example App Group", "IsHidden": false, "IsSuperseded": false, "IsUserDrivenDeploymentAllowed": false, "ModelName": "SMS_ApplicationGroup" } ``` ``` -------------------------------- ### Test for a specific GUID Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMDuplicateHardwareIdGuid.md This example script checks if a specific GUID exists in the site. It then writes a message indicating whether the GUID was found. ```powershell $guid = "AB83D231-8C12-9413-FEBA-C0F9888B9290" if ( Get-CMDuplicateHardwareIdGuid -Id $guid ) { Write-Host $guid "exists in the site" } else { Write-Host $guid "doesn't exist!" } ``` -------------------------------- ### Basic Usage Example Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Add-CMComplianceSettingWqlQuery.md This example shows the basic structure of running the Add-CMComplianceSettingWqlQuery cmdlet. It requires specifying the WQL query, the namespace, and the compliance setting name. ```powershell PS XYZ:\> Add-CMComplianceSettingWqlQuery -WqlQuery "SELECT * FROM Win32_OperatingSystem" -Namespace "ROOT\CIMV2" -Name "OSInfo" ``` -------------------------------- ### Get an application group by name Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMApplicationGroup.md This example gets an app group named 'Central app'. ```APIDOC ## Get-CMApplicationGroup -Name ### Description Gets an application group by its name. ### Method GET ### Endpoint Not applicable (PowerShell cmdlet) ### Parameters #### Path Parameters None #### Query Parameters - **Name** (String) - Optional - Specify the name of the app group to get. - **ShowHidden** (SwitchParameter) - Optional - Add this parameter to show hidden application groups. - **DisableWildcardHandling** (SwitchParameter) - Optional - Treats wildcard characters as literal character values. - **ForceWildcardHandling** (SwitchParameter) - Optional - Processes wildcard characters and may lead to unexpected behavior. ### Request Example ```powershell Get-CMApplicationGroup -Name 'Central app' ``` ### Response #### Success Response (200) Returns an array of SMS_ApplicationGroup objects. #### Response Example ```json [ { "__cimclass": "SMS_ApplicationGroup", "__server": "YourSMSProviderServer", "__namespace": "root\sms\site_XYZ", "__க்கல்": 1, "ApplicationGroupCI_ID": 123456, "ApplicationGroupModelName": "ScopeId_.../ApplicationGroup_...", "CI_ID": 123456, "CI_UniqueID": "ScopeId_.../ApplicationGroup_...", "DisplayName": "Central app", "IsHidden": false, "IsSuperseded": false, "IsUserDrivenDeploymentAllowed": false, "ModelName": "SMS_ApplicationGroup" } ] ``` ``` -------------------------------- ### Configure Prepare ConfigMgr Client step by value Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepPrepareConfigMgrClient.md This example shows how to configure the Prepare ConfigMgr Client step using the InputObject parameter. ```APIDOC ## Set-CMTSStepPrepareConfigMgrClient - ByValue ### Description Configures an instance of the **Prepare ConfigMgr Client for Capture** task sequence step using an input object. ### Method Set-CMTSStepPrepareConfigMgrClient ### Parameters #### Path Parameters - **InputObject** (IResultObject) - Required - The task sequence step to configure. #### Optional Parameters - **AddCondition** (IResultObject[]) - Adds a condition to the task sequence step. - **ClearCondition** - Clears all conditions from the task sequence step. - **Description** (String) - The description of the task sequence step. - **IsContinueOnError** (Boolean) - Specifies whether to continue execution if the step fails. - **IsEnabled** (Boolean) - Specifies whether the task sequence step is enabled. - **MoveToIndex** (Int32) - Moves the task sequence step to the specified index. - **NewStepName** (String) - The new name for the task sequence step. - **RemoveConditionFile** - Removes the file condition from the task sequence step. - **RemoveConditionFolder** - Removes the folder condition from the task sequence step. - **RemoveConditionIfStatement** - Removes the If statement condition from the task sequence step. - **RemoveConditionOperatingSystem** - Removes the Operating System condition from the task sequence step. - **RemoveConditionQueryWmi** - Removes the WMI query condition from the task sequence step. - **RemoveConditionRegistry** - Removes the registry condition from the task sequence step. - **RemoveConditionSoftware** - Removes the software condition from the task sequence step. - **RemoveConditionVariable** - Removes the variable condition from the task sequence step. - **StepName** (String) - The name of the task sequence step. - **StepOrder** (ReorderType) - Specifies the order of the task sequence step. - **DisableWildcardHandling** - Enables wildcard handling. - **ForceWildcardHandling** - Forces wildcard handling. - **WhatIf** - Shows what would happen if the cmdlet runs. - **Confirm** - Prompts for confirmation before running the cmdlet. ### Request Example ```powershell # Example usage (assuming $tsStep is an IResultObject representing the step) Set-CMTSStepPrepareConfigMgrClient -InputObject $tsStep -IsEnabled $true -Description "Prepare client for capture" ``` ### Response This cmdlet does not return a value. It modifies the task sequence step in place. ``` -------------------------------- ### Set Certificate Start Date Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMBootableMedia.md This example demonstrates how to set the start date for a self-signed certificate used for HTTP communication. ```powershell $date = [datetime]::parseexact("11/16/2020", 'MM/dd/yyyy', $null) ``` -------------------------------- ### View all GUIDs Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMDuplicateHardwareIdGuid.md This example displays all duplicate hardware GUIDs from the site. It pipes the output to Select-Object to show only the SMBIOS_GUID property. ```powershell Get-CMDuplicateHardwareIdGuid | Select-Object SMBIOS_GUID ``` -------------------------------- ### Add optional components Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMBootImage.md This example gets the .NET and PowerShell optional components, and then adds them to the boot image. ```APIDOC ## Set-CMBootImage -Id 'XYZ00556' -AddOptionalComponent $OCs ### Description Adds specified optional components to a boot image. ### Parameters #### Path Parameters - **Id** (string) - Required - The package ID of the boot image to modify. - **AddOptionalComponent** (array) - Required - An array of optional component objects to add to the boot image. ### Request Example ```powershell $netfxOC = Get-CMWinPEOptionalComponentInfo -Architecture 'x64' -Name 'WinPE-NetFX' -LanguageId 1033 $pwshOC = Get-CMWinPEOptionalComponentInfo -Architecture 'x64' -Name 'WinPE-PowerShell' -LanguageId 1033 $OCs = @($netfxOC, $pwshOC) Set-CMBootImage -Id 'XYZ00556' -AddOptionalComponent $OCs ``` ``` -------------------------------- ### Get Client Installation by Site Code Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Get-CMSoftwareUpdateBasedClientInstallation.md Retrieves the client installation associated with a specific Configuration Manager site code. ```powershell PS XYZ:\> Get-CMSoftwareUpdateBasedClientInstallation -SiteCode "CM1" ``` -------------------------------- ### Configure Network Settings Step by Value Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepCaptureNetworkSettings.md This example shows how to get the 'Capture Network Settings' task sequence step by its name and then configure it to migrate adapter settings and network membership. ```powershell Set-CMTSStepCaptureNetworkSettings -InputObject $tsStep -MigrateAdapterSettings $true -MigrateNetworkMembership $true ``` -------------------------------- ### Example: Configure Install Software Updates step Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/Set-CMTSStepInstallUpdate.md Changes the Install Software Updates step in a task sequence to install only required updates and disable the use of the scan cache. ```powershell $tsNameOsd = "Default OS deployment" $tsStepNameInstallUpd = "Install Software Updates" Set-CMTSStepInstallUpdate -TaskSequenceName $tsNameOsd -StepName $tsStepNameInstallUpd -Target Mandatory -UseCache $false ``` -------------------------------- ### Create Capture Media Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMCaptureMedia.md This example demonstrates how to create capture media. It first retrieves the boot image and distribution point objects, then uses them to create the capture media. Ensure you have the correct boot image name and distribution point site code. ```powershell PS XYZ:\> $BootImage = Get-CMBootImage -Name "Boot image (x64)" PS XYZ:\> $DistributionPoint = Get-CMDistributionpoint -SiteCode CM1 PS XYZ:\> New-CMCaptureMedia -MediaType CdDvd -Path "\\server\share\CaptureMedia.iso" -BootImage $BootImage -DistributionPoint $DistributionPoint ``` -------------------------------- ### Create and Add Install Package Step to Task Sequence Source: https://github.com/microsoftdocs/sccm-docs-powershell-ref/blob/main/sccm-ps/ConfigurationManager/New-CMTSStepInstallSoftware.md This example demonstrates how to create an Install Package step and add it to a task sequence. It first retrieves a specific program from a package, then creates the step object, and finally adds it to a specified task sequence at a particular index. ```powershell $program = Get-CMProgram -PackageId "XYZ0000F" -ProgramName "Install" $step = New-CMTSStepInstallSoftware -Name "Install Package" -Program $program $tsNameOsd = "Default OS deployment" $tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast $tsOsd | Add-CMTaskSequenceStep -Step $step -InsertStepStartIndex 11 ```