1
votes

May I know in the following PowerShell DSC, what is the difference if I remove the Ensure property (not ensure attribute)?

In another sense, any default if no value specified for Ensure property?

Node WebServer
{
WindowsFeature IIS {
Ensure = "Present",
Name = "Web–Server"
}
}
2

2 Answers

3
votes

I'm not sure what you mean by Ensure property vs Ensure attribute, but the default value is Present. You can see in the documentation for the DSC WindowsFeature Resource that Ensure is not required; Name is the only required property:

WindowsFeature [string] #ResourceName
{
    Name = [string]
    [ Credential = [PSCredential] ]
    [ Ensure = [string] { Absent | Present }  ]
    [ IncludeAllSubFeature = [bool] ]
    [ LogPath = [string] ]
    [ DependsOn = [string[]] ]
    [ Source = [string] ]
}
0
votes

To add the role or feature (default):

Ensure = 'Present'

To remove the role or feature:

Ensure = 'Absent'