#---------DSC Basic PowerShell---------#
#GET DSC Modules
#Get Windows Feature
#Find Module Over Internet
#Find and Install Module
#Get DSC Status
#GET DSC Local Configuration Manager
#---------DSC Configuration to Update LCM properties---------#
#DSC Configuration
[DSCResource()]
Configuration LCMSetUp
{
param()
LocalConfigurationManager
{
ActionAfterReboot = 'ContinueConfiguration'
RebootNodeIfNeeded = $True
ConfigurationMode = 'ApplyAndAutoCorrect'
ConfigurationModeFrequencyMins = 240
RefreshMode = 'PUSH'
}
}
#Generate MOF File
LCMSetUp -Outputpath "c:\DSC\LCMSetUp"
#Update LCM Properties
Set-DscLocalConfigurationManager -path "c:\DSC\LCMSetUp" -force -verbose
#GET DSC Local Configuration Manager
#DSC Configuration
[DSCResource()]
Configuration WindowFeatureInstall
{
param()
Node localhost
{
WindowsFeature
IISInstall
{
Name="Web-Server"
Ensure="Present"
IncludeAllSubfeature = $true
}
WindowsFeature
SMTP
{
Name =
"SMTP-Server"
Ensure =
"Present"
IncludeAllSubFeature = $true
DependsOn =
"[WindowsFeature]IISInstall"
}
LocalConfigurationManager
{
ActionAfterReboot = 'ContinueConfiguration'
RebootNodeIfNeeded = $True
}
}
}
#Generate MOF File
WindowFeatureInstall -Outputpath
"c:\DSC\WFInstall"
#Intall Configuration
No comments:
Post a Comment