【问题标题】:DSC, having a simple script executed on a target nodeDSC,在目标节点上执行一个简单的脚本
【发布时间】:2016-11-17 09:03:19
【问题描述】:

我创建了一个简单的 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

问题

  1. 它说“正在运行”,但我如何确定它已完成?
  2. 即使我在配置文件中出错,说我写的是 NNNode,它根本不会出错,但也会显示“正在运行”。它应该如何工作?

【问题讨论】:

    标签: powershell dsc


    【解决方案1】:

    与此 cmdlet 关联的其他 cmdlet 位于此处: https://msdn.microsoft.com/powershell/reference/5.1/PSDesiredStateConfiguration/Start-DscConfiguration?f=255&MSPPError=-2147217396

    Get-DscConfiguration

    获取-DscConfigurationStatus

    恢复-DscConfiguration

    停止-DscConfiguration

    测试-DscConfiguration

    更新-DscConfiguration

    默认情况下,此 cmdlet 作为作业运行。这将在后台运行。如果您希望它以交互方式运行,请使用 -wait 参数。

    start-dscconfiguration -path "c:\example\configurations" -wait
    

    要查看有关工作使用的更多信息:

        get-job -name job1
    

    作业将定期运行以保持系统所需的状态。

    希望这会有所帮助。

    谢谢,蒂姆。

    【讨论】:

      猜你喜欢
      • 2018-07-25
      • 2019-08-28
      • 1970-01-01
      • 2018-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-09-23
      • 2018-05-25
      相关资源
      最近更新 更多