2016-05-27 20 views
0

由於我是PowerShell和DSC(以及總體編程)的新手,我有一個問題,我無法在Web中找到答案。PowerShell DSC節點「localhost」的MOF定義無效

我想安裝一個msi(或一個exe)與PS DSC。我成功編寫了一個腳本來檢查和安裝windows-features並安裝JDK並設置資源。 但隨着我的下一步,我似乎受到挑戰。

因此,繼承人到目前爲止我的代碼:

$ConfigurationData = @{ 
AllNodes = @(
      @{ 
       NodeName="*" 
       PSDscAllowPlainTextPassword=$true 
      } 
     ) 
    } 



    Configuration AppFabric 
    { 
     param (
      $TargetNodes, 

      [Parameter(Mandatory=$false)] 
      [PSCredential]$Credential 
     ) 

     Import-DscResource –ModuleName ’PSDesiredStateConfiguration’ 

     Node localhost 
     { 

      Package AppFabric 
      { 
       Ensure = "Present" 
       Name = "AppFabric" 
       Path = "$PWD\src\AppFabric\package\appfabric-1.1-for-windows-server-64.msi" 
       ProductId = "" 
       LogPath = "$PWD\logs\$env:computername-AppFabric" 
       Arguments = "/i HostingServices,CacheClient,HostingServicesAdmin" 
       Credential = "$Credential" 
      } 
     } 
     } 

     AppFabric -OutputPath $PWD\mof\AppFabric\ 

     Start-DscConfiguration -Path $PWD\mof\AppFabric\ -wait -verbose -Force 

所以你看我試圖在基於Windows Server 2012R2安裝AppFabric的最新版本。

當我運行該腳本,我得到以下錯誤:

enter image description here

我不知道,這意味着什麼,不能在網上找到,可以幫助任何東西。

如果您需要了解更多信息,請讓我知道,就像我說的,我是新來的:X

謝謝!

編輯: 如果我嘗試做沒有憑據我得到如下:

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'. 

回答

0

您治療憑證屬性作爲字符串而不是PSCredential的。 從刪除雙引號憑證屬性來解決問題。

Package AppFabric 
      { 
       Ensure = "Present" 
       Name = "AppFabric" 
       Path = "$PWD\src\AppFabric\package\appfabric-1.1-for-windows-server-64.msi" 
       ProductId = "" 
       LogPath = "$PWD\logs\$env:computername-AppFabric" 
       Arguments = "/i HostingServices,CacheClient,HostingServicesAdmin" 
       Credential = $Credential 
      } 
+0

是的,那是愚蠢的。謝謝。我認爲這部分解決了我的問題,但我不確定這是怎麼回事。我希望我可以跳過所有的憑證過程,因爲它在以前的安裝中不是必需的,但是如果沒有它,腳本就會停止在 「VERBOSE:執行操作'使用以下參數調用CimMethod','methodName '= SendConfigurationApply,'className'= MSFT_DSCLocalConfigurationManager,'namespaceName'= root/Microsoft/Windows/DesiredStateConfiguration'。「 – Joshude