简体   繁体   English

使用Powershell,如何添加任务序列以安装SCCM软件包

[英]Using Powershell, how to add a task sequence for installing an SCCM package

My Google-FU is not working today. 我的Google-FU今天不工作。 I am needing to automate adding steps to a series of Task Sequences that simply install a SCCM package. 我需要自动向一系列仅安装SCCM软件包的任务序列添加步骤。 I have automated the package creation, Task Sequence creation. 我已经自动化了程序包的创建,任务序列的创建。 Now just need to add the one step to the Task Sequence. 现在只需要向“任务序列”添加一个步骤。 Basically Add Step/Software/Install Package... Name it, and point to the already created package (preferably via Name, but can use Package ID if needed). 基本上,添加“步骤/软件/安装软件包...”,将其命名,并指向已创建的软件包(最好通过“名称”,但必要时可以使用“软件包ID”)。

Any Ideas? 有任何想法吗? Microsoft's documentation is woeful at best. Microsoft的文档充其量只能说是糟糕的。 Found several examples of adding Command Line steps, but nothing for Packages. 找到了几个添加命令行步骤的示例,但对于Packages却找不到。

TIA Stephen 蒂亚·斯蒂芬(TIA Stephen)

firstly we need to create "install software" step using New-CMTSStepInstallSoftware , then add the step into TS using Add-CMTaskSequenceStep . 首先,我们需要使用New-CMTSStepInstallSoftware创建“安装软件”步骤,然后使用Add-CMTaskSequenceStep将步骤Add-CMTaskSequenceStep到TS中。

This is an example. 这是一个例子。

$a = Get-CMProgram -PackageName "YOURPACKAGENAME"
$b = New-CMTSStepInstallSoftware -Program $a -Name test
Get-CMTaskSequence -Name "YOURTSNAME" | Add-CMTaskSequenceStep -Step $b -InsertStepStartIndex 1

Best Regards, Ray 最好的问候,雷

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM