【问题标题】:Windows Server 2012R2 Core - can't run powershell DSCWindows Server 2012R2 Core - 无法运行 powershell DSC
【发布时间】:2015-08-27 06:56:40
【问题描述】:

安装全新的 Windows Server 2012R2 Core 安装后,我创建了一个示例 DSC 进行测试并收到:术语“Setup”未被识别为名称...

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 机器上,这可以正常工作。是否需要安装或配置一些东西才能使其正常工作?

【问题讨论】:

    标签: powershell windows-server dsc


    【解决方案1】:

    一行有一个小错误:

    .\dsc.ps1
    

    应该说

    . .\dsc.ps1
    

    将设置配置加载到当前会话中,以便您可以使用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-27
      • 2014-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-31
      相关资源
      最近更新 更多