This post contains the script and output for my post. I figured making a page would be easier than battling the formatting on my blog.
Configuration MonitoringSoftware
{
param([string[]]$MachineName=“localhost”)
Node $MachineName
{
WindowsFeature GotBITS #you can name these whatever you like,remember the best practices and pick a good name
{
Ensure = “Present”
Name = “BITS”
IncludeAllSubFeature=$true
}
WindowsFeature HasRDC
{
Ensure = “Present”
Name = “RDC”
DependsOn = “[WindowsFeature]GotBits”
}
WindowsFeature NotRDSServer
{
Ensure = “Absent”
Name = “Remote-Desktop-Services”
DependsOn =“[WindowsFeature]HasRDC”
}
File InstallFilesPresent
{
Ensure = “Present”
SourcePath = “\\dc01\Software\Monitoring”
DestinationPath = “C:\Temp\Monitoring”
Type = “Directory”
Recurse=$true # can only use this parameter on a Directory
DependsOn=“[WindowsFeature]NotRDSServer”
}
Package MonitoringSoftware
{
Ensure = “Present” # You can also set Ensure to “Absent”
Path = “$Env:SystemDrive\Temp\Monitoring\7z920-x64.msi”
Name = “7-Zip”
ProductId = “23170F69-40C1-2702-0920-000001000000”
DependsOn= “[File]InstallFilesPresent”
}
}
}
MonitoringSoftware
Start-DscConfiguration -Path $env:windir\system32\MonitoringSoftware -Wait -Verbose -Force
And the output:
VERBOSE: Perform operation ‘Invoke CimMethod‘
with following parameters, ”methodName‘ = SendConfigurationApply,’className‘
= MSFT_DSC
LocalConfigurationManager,’namespaceName‘ =
root/Microsoft/Windows/DesiredStateConfiguration‘.
VERBOSE: An LCM method call arrived from computer CONFIGUREME with user sid S-1-5-21-60217445-2180679093-1106216334-1002.
VERBOSE: [CONFIGUREME]: LCM: [ Start Set ]
VERBOSE: [CONFIGUREME]: LCM: [ Start Resource ] [[WindowsFeature]GotdemBITS]
VERBOSE: [CONFIGUREME]: LCM: [ Start Test ] [[WindowsFeature]GotdemBITS]
VERBOSE: [CONFIGUREME]: [[WindowsFeature]GotdemBITS] The operation ‘Get-WindowsFeature‘ started: BITS
VERBOSE: [CONFIGUREME]: [[WindowsFeature]GotdemBITS] The operation ‘Get-WindowsFeature‘ succeeded: BITS
VERBOSE: [CONFIGUREME]: LCM: [ End Test ] [[WindowsFeature]GotdemBITS] in 1.1590 seconds.
VERBOSE: [CONFIGUREME]: LCM: [ Start Set ] [[WindowsFeature]GotdemBITS]
VERBOSE: [CONFIGUREME]: [[WindowsFeature]GotdemBITS] Installation started…
VERBOSE: [CONFIGUREME]: [[WindowsFeature]GotdemBITS] Prerequisite processing started…
VERBOSE: [CONFIGUREME]: [[WindowsFeature]GotdemBITS] Prerequisite processing succeeded.
WARNING: [CONFIGUREME]: [[WindowsFeature]GotdemBITS] Windows automatic updating is not enabled. To ensure that your newly-installed role or feature is automatically updated, turn on Windows Update.
VERBOSE: [CONFIGUREME]: [[WindowsFeature]GotdemBITS] Installation succeeded.
VERBOSE: [CONFIGUREME]: [[WindowsFeature]GotdemBITS] successfully installed the feature BITS
VERBOSE: [CONFIGUREME]: LCM: [ End Set ] [[WindowsFeature]GotdemBITS] in 51.8510 seconds.
VERBOSE: [CONFIGUREME]: LCM: [ End Resource ] [[WindowsFeature]GotdemBITS]
VERBOSE: [CONFIGUREME]: LCM: [ Start Resource ] [[WindowsFeature]HasRDC]
VERBOSE: [CONFIGUREME]: LCM: [ Start Test ] [[WindowsFeature]HasRDC]
VERBOSE: [CONFIGUREME]: [[WindowsFeature]HasRDC] The operation ‘Get-WindowsFeature‘ started: RDC
VERBOSE: [CONFIGUREME]: [[WindowsFeature]HasRDC] The operation ‘Get-WindowsFeature‘ succeeded: RDC
VERBOSE: [CONFIGUREME]: LCM: [ End Test ] [[WindowsFeature]HasRDC] in 1.8330 seconds.
VERBOSE: [CONFIGUREME]: LCM: [ Start Set ] [[WindowsFeature]HasRDC]
VERBOSE: [CONFIGUREME]: [[WindowsFeature]HasRDC] Installation started…
VERBOSE: [CONFIGUREME]: [[WindowsFeature]HasRDC] Prerequisite processing started…
VERBOSE: [CONFIGUREME]: [[WindowsFeature]HasRDC] Prerequisite processing succeeded.
WARNING: [CONFIGUREME]: [[WindowsFeature]HasRDC] Windows automatic updating is not enabled. To ensure that your newly-installed role or feature is automatically updated, turn on Windows Update.
VERBOSE: [CONFIGUREME]: [[WindowsFeature]HasRDC] Installation succeeded.
VERBOSE: [CONFIGUREME]: [[WindowsFeature]HasRDC] successfully installed the feature RDC
VERBOSE: [CONFIGUREME]: LCM: [ End Set ] [[WindowsFeature]HasRDC] in 10.4820 seconds.
VERBOSE: [CONFIGUREME]: LCM: [ End Resource ] [[WindowsFeature]HasRDC]
VERBOSE: [CONFIGUREME]: LCM: [ Start Resource ] [[WindowsFeature]NotRDSServer]
VERBOSE: [CONFIGUREME]: LCM: [ Start Test ] [[WindowsFeature]NotRDSServer]
VERBOSE: [CONFIGUREME]: [[WindowsFeature]NotRDSServer] The operation ‘Get-WindowsFeature‘ started: Remote-Desktop-Services
VERBOSE: [CONFIGUREME]: [[WindowsFeature]NotRDSServer] The operation ‘Get-WindowsFeature‘ succeeded: Remote-Desktop-Services
VERBOSE: [CONFIGUREME]: LCM: [ End Test ] [[WindowsFeature]NotRDSServer] in 0.3280 seconds.
VERBOSE: [CONFIGUREME]: LCM: [ Start Set ] [[WindowsFeature]NotRDSServer]
VERBOSE: [CONFIGUREME]: [[WindowsFeature]NotRDSServer] Uninstallation started…
VERBOSE: [CONFIGUREME]: [[WindowsFeature]NotRDSServer] Prerequisite processing started…
VERBOSE: [CONFIGUREME]: [[WindowsFeature]NotRDSServer] Prerequisite processing succeeded.
WARNING: [CONFIGUREME]: [[WindowsFeature]NotRDSServer] You must restart this server to finish the removal process.
VERBOSE: [CONFIGUREME]: [[WindowsFeature]NotRDSServer] Uninstallation succeeded.
VERBOSE: [CONFIGUREME]: [[WindowsFeature]NotRDSServer] successfully unInstalled the feature Remote-Desktop-Services.
VERBOSE: [CONFIGUREME]: [[WindowsFeature]NotRDSServer] The Target machine needs to be restarted.
VERBOSE: [CONFIGUREME]: LCM: [ End Set ] [[WindowsFeature]NotRDSServer] in 10.7180 seconds.
VERBOSE: [CONFIGUREME]: LCM: [ End Resource ] [[WindowsFeature]NotRDSServer]
VERBOSE: [CONFIGUREME]: [] A reboot is required to progress further. Please reboot the system.
VERBOSE: [CONFIGUREME]: LCM: [ End Set ]
VERBOSE: [CONFIGUREME]: LCM: [ End Set ] in 77.8020 seconds.
VERBOSE: Operation ‘Invoke CimMethod‘ complete.
VERBOSE: Time taken for configuration job to complete is 78.072 seconds
–>
In the sixth line, shouldn’t it be “WindowsFeature GotdemBits” instead of “WindowsFeature GotBITS” ?
LikeLike
You’re right. I decided to change it and forgot to adjust it here. Thanks for the heads up
LikeLike