Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile DSC Configuration from NodePS #1

Open
giordyb opened this issue Feb 15, 2016 · 6 comments
Open

Cannot compile DSC Configuration from NodePS #1

giordyb opened this issue Feb 15, 2016 · 6 comments

Comments

@giordyb
Copy link

giordyb commented Feb 15, 2016

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>
"@
@TLaborde
Copy link
Owner

My first guesses would be a network issue to connect to the target, or a credential issue. I will try it tomorrow. and give you an update.

@giordyb
Copy link
Author

giordyb commented Feb 15, 2016

Well, the target is the server itself and it already runs as admin.I'm not even calling start-dscconfiguration yet, it just stops when trying to compile the .mof...but if I hit CTRL-C it goes ahead, writes the file and stops the NodePS instance.

@TLaborde
Copy link
Owner

Ok, just tried it. Your script works for me. It does generate a mof file, so I cannot really help you, are you using a domain account to run NodePS ? does it have enough rights on both systems?
edit: even targetting the local server it works.

@giordyb
Copy link
Author

giordyb commented Feb 15, 2016

Ok it seems to only work if I login as Administrator.
I just tried it on a Win10 VM, a Win2012R2 VM with WMF5 and a Win2012VM standard they all show the same behavior: If I login as a user *other than Administrator *(but that is in the admins group), start a powershell session with "run as administrator", then import-module nodeps and run
start-nodepsserver then it hangs when it tries to create the mof.
If I login as Administrator and do the same exact steps then it works.

@TLaborde
Copy link
Owner

I made it run as a domain user member of local admin group. Have you tried this configuration?

@giordyb
Copy link
Author

giordyb commented Feb 16, 2016

I tried running it as local admin on a Windows 10 Workstation joined to a 2013 domain, here is a gif of what happens.
it basically hangs until I press ctrl-c to stop the server, as you can see as soon as I do that it goes ahead and compiles the mof, creating the myconfig folder.

nodeps

it's really weird, as every other .ps1 script that I throw at it work, even remote invoke-commands!
it's not a big deal though, as long as it works for you...maybe it's something with my environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants