kevinsea/dsc-generator

Correct PowerShell command not present

Closed this issue · 2 comments

When I run on one of our servers I get only one feature exported:

WindowsFeature IIS_Feature  # Correct PowerShell command not present, settting IIS Base
{
   Name = "Web-Server"
   Ensure = "Present"
}

What does Correct PowerShell command not present, settting IIS Base mean? Is some Powershell version required which I don't have?

Using version: 2.1.1

Hi,

Yeah, its looking for one of these:

if (featureLookupSupport == FeatureLookupSupport.GetWindowsFeature)  // Windows server >= 2008
...
else if (featureLookupSupport == FeatureLookupSupport.GetWindowsOptionalFeature) // Windows 8

If you are running a prior OS, you might get support by upgrading to the most recent version of PowerShell your OS supports...I believe my comment is just talking about the PowerShell version installed with the OS.

(For reference the code is here https://github.com/kevinsea/dsc-generator/blob/a7857418543ec5f68266e0e48183447a90161ff9/DesiredStateGenerator/Windows/WindowsFeatureReader.cs)

I looked it up, our server is running Windows Server 2008 R2 but has PowerShell version 2.0.
Looks like for PowerShell 2.0 it is required to import servermanager: import-module servermanager.

So for now I've exported the list manually from this command but if you like maybe you can add support for this 😄

Thanks anyway!