Windows Server 2012R2核心 - 无法运行PowerShell DSC

时间:2015-06-11 14:07:14

标签: powershell windows-server dsc

安装新的Windows Server 2012R2 Core安装后,我创建了一个样本DSC来测试和接收:术语“设置”不被识别为名称...

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

在我的本地Windows机器上,这没有任何问题。是否需要安装或配置才能使其正常工作?

1 个答案:

答案 0 :(得分:2)

行中有一个小错误:

.\dsc.ps1

应该说

. .\dsc.ps1

将Setup configruation加载到当前会话中,以便您可以使用它。