DSC,在目标节点上执行一个简单的脚本
DSC, having a simple script executed on a target node
我创建了一个简单的 MOF 文件:
Configuration ConfigName
{
Node NB05
{
File ResName
{
}
编辑 1
这不是一个mof文件,而是一个必须编译成mof文件的文件。这将是另一个问题的焦点,因为这个问题仍然适用。
我尝试使用以下命令应用它:
PS C:\var\DSC> Start-DscConfiguration
Cmdlet Start-DscConfiguration at position 1 in the command pipeline
Please specify values for the follwing parameters:
Path: .\Configurations
Id Name PSJobTypeName State HasMoreData Location Command
-- ---- ------------- ----- ----------- -------- -------
1 Job1 Configuratio... Running True c1 Start-DscConfiguration
问题
- 它说 "runnning" 但我如何确定它已经完成?
- 即使我在配置文件中犯了一个错误,说我写了 NNNode,它根本不会给出错误,但也会说 "Running"。它应该如何工作?
与此 cmdlet 关联的其他 cmdlet 位于此处:
https://msdn.microsoft.com/powershell/reference/5.1/PSDesiredStateConfiguration/Start-DscConfiguration?f=255&MSPPError=-2147217396
Get-DscConfiguration
获取 DscConfigurationStatus
恢复 Dsc 配置
停止 Dsc 配置
Test-DscConfiguration
更新 Dsc 配置
此 cmdlet 默认 运行s 作为一项作业。这将在后台 运行。如果您希望它以交互方式 运行,请使用 -wait 参数。
start-dscconfiguration -path "c:\example\configurations" -wait
要查看有关作业用途的更多信息:
get-job -name job1
该作业将 运行 定期保持系统的理想状态。
希望这对您有所帮助。
谢谢,蒂姆。
我创建了一个简单的 MOF 文件:
Configuration ConfigName
{
Node NB05
{
File ResName
{
}
编辑 1
这不是一个mof文件,而是一个必须编译成mof文件的文件。这将是另一个问题的焦点,因为这个问题仍然适用。
我尝试使用以下命令应用它:
PS C:\var\DSC> Start-DscConfiguration
Cmdlet Start-DscConfiguration at position 1 in the command pipeline
Please specify values for the follwing parameters:
Path: .\Configurations
Id Name PSJobTypeName State HasMoreData Location Command
-- ---- ------------- ----- ----------- -------- -------
1 Job1 Configuratio... Running True c1 Start-DscConfiguration
问题
- 它说 "runnning" 但我如何确定它已经完成?
- 即使我在配置文件中犯了一个错误,说我写了 NNNode,它根本不会给出错误,但也会说 "Running"。它应该如何工作?
与此 cmdlet 关联的其他 cmdlet 位于此处: https://msdn.microsoft.com/powershell/reference/5.1/PSDesiredStateConfiguration/Start-DscConfiguration?f=255&MSPPError=-2147217396
Get-DscConfiguration
获取 DscConfigurationStatus
恢复 Dsc 配置
停止 Dsc 配置
Test-DscConfiguration
更新 Dsc 配置
此 cmdlet 默认 运行s 作为一项作业。这将在后台 运行。如果您希望它以交互方式 运行,请使用 -wait 参数。
start-dscconfiguration -path "c:\example\configurations" -wait
要查看有关作业用途的更多信息:
get-job -name job1
该作业将 运行 定期保持系统的理想状态。
希望这对您有所帮助。
谢谢,蒂姆。