Skip to content

Cannot compile DSC Configuration from NodePS #1

@giordyb

Description

@giordyb

I was thinking of using NodePS as a web front end for a DSC Configuration writer/distributor.
Unfortunately when I try to compile a simple DSC Configuration it stops right before creating the .mof until I hit ctrl-c, then it completes but stops the NodePS server instance. But if I start the instance and connect to the powershell session via VS2015 debugger then it works just fine.
This is the .ps1 that I am using

if ($NodePSPost.ServerName -ne $null)
{
     Write-Host "setup dsc config for $($NodePSPost.ServerName)"
     Configuration MyConfig {
        param (
            [Parameter(Mandatory=$true)]
            [ValidateNotNullOrEmpty()]
            [string]
            $NodeName
        )
        Node $NodeName
        {
            File Data
            {
                Ensure = "Present"
                Type = "Directory"
                DestinationPath = "C:\Data"
            }
        }
    }
    Write-Host "end dsc config for $($NodePSPost.ServerName)"
    #Import-DscResource –ModuleName PSDesiredStateConfiguration
    $(MyConfig -NodeName $NodePSPost.ServerName)
    Write-Host $NodePSPost.ServerName
}


@"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>DscDemo</title>
</head> 
<H1>Send DSC Config to server</H1>
    <form action="dsctest.ps1" method="post">
    Server Name:<br>
    <input type="text" name="ServerName" value=""><br>
    <br>
    <input type="submit" value="Submit">
</form>
<table>
</table>
</body>
</html>
"@

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions