我可以在下面的PowerShell DSC中知道,如果我删除Ensure属性(不是确保属性)有什么区别?
在另一种意义上,如果没有为Ensure属性指定值,则是否为默认值?
Node WebServer
{
WindowsFeature IIS {
Ensure = "Present",
Name = "Web–Server"
}
}
我不确定您对Ensure property vs Ensure属性的含义,但默认值为Present
。你可以在documentation for the DSC WindowsFeature Resource看到不需要Ensure
; Name
是唯一必需的财产:
WindowsFeature [string] #ResourceName { Name = [string] [ Credential = [PSCredential] ] [ Ensure = [string] { Absent | Present } ] [ IncludeAllSubFeature = [bool] ] [ LogPath = [string] ] [ DependsOn = [string[]] ] [ Source = [string] ] }
要添加角色或功能(默认):
Ensure = 'Present'
要删除角色或功能:
Ensure = 'Absent'