【问题标题】:DSC configuration errorDSC 配置错误
【发布时间】:2023-03-11 15:57:01
【问题描述】:

我正在使用 DSC 来管理 2 个节点,我已经能够设置我的 pull-server,但现在的问题是从 pull-server 推送/拉取配置不起作用。

我尝试对问题进行故障排除,我可以在 GetAction 请求的响应中看到错误,但我不知道这意味着什么。

http://server1:8080/PSDSCPullServer.svc/Action(ConfigurationId='8394f90e-0525-4d0d-aa75-653b64981fc4')/GetAction

{
  "odata.error": {
    "code": "",
    "message": {
      "lang": "en-US",
      "value": "nodeComplianceStatus or mofChecksum not found for MSFT.PSDSCAction."
    },
    "innererror": {
      "message": "nodeComplianceStatus or mofChecksum not found for MSFT.PSDSCAction.",
      "type": "System.ArgumentException",
      "stacktrace": ""
    },
    "MODATA.Exception.ErrorRecord": {
      "odata.type": "MODATA.Exception.DataServiceException",
      "ErrorCode": "",
      "MessageLanguage": "en-US",
      "StatusCode": 400,
      "Message": "nodeComplianceStatus or mofChecksum not found for MSFT.PSDSCAction.",
      "Data": [],
      "InnerException": {
        "Message": "nodeComplianceStatus or mofChecksum not found for MSFT.PSDSCAction.",
        "Data": [],
        "InnerException": null,
        "TargetSite": null,
        "StackTrace": null,
        "HelpLink": null,
        "Source": null,
        "HResult": -2147024809
      },
      "TargetSite": null,
      "StackTrace": "   at Microsoft.Management.Odata.Core.OperationManagerAdapter.InvokeMethod(IInvoker invoker, String functionName, String resourceTypeName, Boolean ignoreNotImplementedException)\r\n   at Microsoft.Management.Odata.Core.OperationManagerAdapter.InvokeOperationManagerFunction[T](Func`1 func, String functionName, String resourceTypeName, Boolean ignoreNotImplementedException, T defaultResultForNotImplementedException)\r\n   at Microsoft.Management.Odata.Core.OperationManagerAdapter.InvokeAction(ResourceType resourceType, IEnumerable`1 resourceKeys, String actionName, IEnumerable`1 inputParameters, ResourceType returnType)\r\n   at Microsoft.Management.Odata.Core.DataServiceInvokable.InvokeActionOnAst(RequestAstNode root)\r\n   at Microsoft.Management.Odata.Core.DataServiceInvokable.Invoke()\r\n   at Microsoft.Management.Odata.Core.DataServiceUpdateProvider.SaveChanges()\r\n   at System.Data.Services.DataService`1.HandleNonBatchRequest(RequestDescription description)\r\n   at System.Data.Services.DataService`1.HandleRequest()",
      "HelpLink": null,
      "Source": "Microsoft.Management.OData",
      "HResult": -2146233079
    }
  }
}

知道有什么问题吗?

【问题讨论】:

    标签: powershell dsc


    【解决方案1】:

    当您将配置放在拉取服务器上时,您必须包含从配置生成的校验和文件。您可以使用the New-DscChecksum cmdlet 生成它。

    【讨论】:

    • 我做到了,不过我可以开始配置,它可以工作Start-DscConfiguration –Computer server1 -Path .\DashboardWebsite –Verbose
    • @AdetiloyePhilipKehinde 您的错误消息明确指出它找不到校验和文件。每个配置都有 2 个文件?除了.checksum 之外的名称相同?请注意,推送配置不需要校验和文件,因此Start-DscConfiguration 不会因缺少校验和而失败。
    • 是的,我的配置目录\\server1\c$\program files\windowspowershell\dscservice\configuration 中有两个文件8394f90e-0525-4d0d-aa75-653b64981fc4.mof8394f90e-0525-4d0d-aa75-653b64981fc4.mof.checksum
    • 我确定我有.checksum,但我不知道nodeComplianceStatus到底是什么
    【解决方案2】:

    从错误看来,调用未到达 DSC 拉取服务端点,并且由于请求正文中缺少某些内容而被 OData 服务拒绝。您可以使用 Invoke-WebRequest 尝试请求进行故障排除。

    $bodyArgs = @{Checksum="somechecksum"; ChecksumAlgorithm="SHA 256";NodeCompliant="false"} 
    $jsonBodyArgs = $bodyArgs|ConvertTo-Json
    
    Invoke-WebRequest -Uri "http://server1:8080/PSDSCPullServer.svc/Action(ConfigurationId='8394f90e-0525-4d0d-aa75-653b64981fc4')/GetAction"
    -UseBasicParsing -Method Post -Body $jsonBodyArgs -Headers @{Accept="application/json"} -ContentType "application/json;odata=minimalmetadata;charset=utf-8"
    

    拉取服务器日志将包含有关向节点报告的故障的信息。可以使用以下方式获取日志:

    Get-WinEvent -LogName
    "Microsoft-Windows-Powershell-DesiredStateConfiguration-PullServer/Operational"
    
    Get-WinEvent -LogName
     "Microsoft-Windows-ManagementOdataService/Operational"
    

    这些日志通常包含足够的信息来解决根本问题。

    【讨论】:

      【解决方案3】:

      尝试检查您的 pullserver 是否确实指向 proram files\windowspowershell 而不是 program files(x86)\windowspowershell。 这可能是问题所在。 DSC 错误消息并不总是很有帮助。
      查看您的 pullservers webconfig 文件以查看 pullserver 尝试将其配置拉取到客户端的位置。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-20
        • 2020-09-01
        • 2018-11-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多