1、导出 .XML 配置文件,如 D:\Scripts\DeploymentConfigTemplate.xml:
2、使用记事本创建脚本,并执行脚本:
function Invoke-WindowsFeatureBatchDeployment {param ([parameter(mandatory)][string[]] $ComputerNames,[parameter(mandatory)][string] $ConfigurationFilePath)# Deploy the features on multiple computers simultaneously.$jobs = @()foreach($ComputerName in $ComputerNames) {$jobs += Start-Job -Command {Install-WindowsFeature -ConfigurationFilePath $using:ConfigurationFilePath -ComputerName $using:ComputerName -Restart}}Receive-Job -Job $jobs -Wait |