Windows Server 2012R2 Core - can't run powershell DSC

382 views Asked by At

After installing a fresh Windows Server 2012R2 Core installation I created a sample DSC to test and received: Term "Setup" is not recognized as a name ...

c:\src\dsc.ps1

Configuration Setup
{
  Node .
  {

    WindowsFeature "IIS"
    {
        Ensure            = "Present"
        Name              = "Web-Server"
    }
  }
}

C:\src> .\dsc.ps1
C:\src> Setup

Setup : The term 'Setup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Setup
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (Setup:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

On my local Windows machine this works without any issues. Is there something I need to install or configure to make this work?

1

There are 1 answers

0
Peter Hahndorf On BEST ANSWER

There is a small mistake in the line:

.\dsc.ps1

it should say

. .\dsc.ps1

to load the Setup configruation into the current session so you can use it.