Publish-DscConfiguration
将 DSC 配置发布到一组计算机。
语法
Publish-DscConfiguration
[-Path] <String>
[-Force]
[[-ComputerName] <String[]>]
[-Credential <PSCredential>]
[-ThrottleLimit <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Publish-DscConfiguration
[-Path] <String>
[-Force]
[-ThrottleLimit <Int32>]
-CimSession <CimSession[]>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Publish-DscConfiguration
cmdlet 在一组计算机上发布 Windows PowerShell Desired State Configuration (DSC) 配置文档。 此 cmdlet 不应用配置。
当 UseExisting 参数或 DSC 引擎运行其一致性周期时,Start-DscConfiguration cmdlet 应用配置。 DSC 引擎也称为本地配置管理器(LCM)。
传递多个配置文档的片段时,此 cmdlet 特别有用。 交付多个配置文档片段时,会覆盖较旧的配置文档片段。
示例
示例 1:将配置发布到远程计算机
Publish-DscConfiguration -Path '$home\WebServer' -ComputerName "ContosoWebServer" -Credential (get-credential Contoso\webadministrator)
此命令将配置发布到远程计算机。 运行 cmdlet 的用户应是远程计算机上的管理员。
参数
-CimSession
在远程会话或远程计算机上运行 cmdlet。 输入计算机名或会话对象,例如 New-CimSession 或 Get-CimSession cmdlet 的输出。 默认值为本地计算机上的当前会话。
类型: | CimSession[] |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ComputerName
指定此 cmdlet 发布配置的一台或多台计算机。
类型: | String[] |
别名: | CN, ServerName |
Position: | 1 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Credential
指定用于访问目标设备的凭据。
类型: | PSCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Force
强制 cmdlet 完成。 如果本地 Configuration Manager 刷新模式设置为 PULL,则此参数的用法将更改为 PUSH,并启用 DSC 配置的发布。 此外,如果存在挂起的 DSC 配置,则此参数的用法将覆盖该挂起的配置。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Path
指定一个路径,其中包含要发布到目标计算机的配置。
类型: | String |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-ThrottleLimit
指定可以建立以运行 cmdlet 的最大并发作数。 如果省略此参数或输入 0
值,则 Windows PowerShell 会根据计算机上运行的 CIM cmdlet 数计算 cmdlet 的最佳限制。 限制限制仅适用于当前 cmdlet,不适用于会话或计算机。
类型: | Int32 |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |