Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

DSC configuration file execution error

$
0
0

Hello,

I read Ed Wilson's post intro-to-powershell-4-0-desired-state-configuration and set up a simple configuration script like so:

#Requires -version 4.0

Configuration NG_BackendDSC 
{
param (
[String[]]$MachineName = $env:COMPUTERNAME
)

Node $MachineName
{
File BackendInstallationFiles
{
Ensure = "Present"
        SourcePath = "d:\download\etc"
DestinationPath = "d:\mypath"
Type = "Directory"
Recurse = $true
}

    }
}

I ran the script on a Windows Server 2008 R2 with PowerShell 4.0 install in ISE, then created the MOF, then ran Start-DscConfiguration:

PS D:\DSC\Start-DscConfiguration -Path D:\DSC\MOF -Verbose -Force

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command                 
--     ----            -------------   -----         -----------     --------             -------                 
6      Job6            Configuratio... Running       True            [theservername]       Start-DscConfiguration...
VERBOSE: Time taken for configuration job to complete is 0.028 seconds

So it did run, but Receive-Job shows that it failed.

PS D:\dsc> receive-Job -Id 6 -Keep
receive-Job : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management 
service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".
At line:1 char:1
+ receive-Job -Id 6 -Keep
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ConnectionError: (root/Microsoft/...gurationManager:String) [Receive-Job], CimException
    + FullyQualifiedErrorId : HRESULT 0x80338012,Microsoft.PowerShell.Commands.ReceiveJobCommand
    + PSComputerName        : [theservername]

I ran winrm quickconfig, but the first time it said:

PS D:\dsc> winrm quickconfig
WinRM service is already running on this machine.
WinRM is not set up to allow remote access to this machine for management.
The following changes must be made:

Create a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.
Enable the WinRM firewall exception.

Then it hung the ISE.  That's where I was when I started writing this post.  

However if I ran the winrm quickconfig command from a PowerShell prompt, it gave me the option to create the listener and enable the firewall exception.  

Make these changes [y/n]? y

WinRM has been updated for remote management.

Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.
WinRM firewall exception enabled.

I ran the Start-DscConfiguration command again, and this time it worked:

PS D:\dsc> get-job -id 6

Id     Name            PSJobTypeName   State
--     ----            -------------   -----
6      Job6            Configuratio... Completed

So I am happy, and this is more of a comment now that it might be helpful to include something about this in a followup article sometime!

Thank you,

Scott


Scott


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>