Hi Everyone!
Recently i started to follow the Powershell:Beginner learningpath and got stuck at the DSC part.
I followed the following steps:
Step 1:
configuration Configname {
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Node $Computername {
Windowsfeature IIS{
Name = 'web-server'
Ensure = 'Present'
}
}
}
$computername = 'serverx'
ConfigName -outputpath c:\DSC\Config
Result:
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 12/05/2017 13:45 1858 serverx.mof
Step 2:
Start-DscConfiguration -Path C:\DSC\Config\ -ComputerName 'serverx' -Verbose -Wait
Result: Installation of the Web-server feature has succeeded.
Step 3:
Invoke-Command -ComputerName serverx {Remove-WindowsFeature -Name web-server -Restart}
Result:
Success Restart Needed Exit Code Feature Result PSComputerName
------- -------------- --------- -------------- --------------
True Yes SuccessRest... {Common HTTP Features, Default Document, D... serverx
WARNING: You must restart this server to finish the removal process.
Server rebooted and the feature was indeed removed
Step 4:
Test-DscConfiguration -CimSession nl-wrt-oefen
Result: False
And there is the problem, it doesn’t seem to restore. Not even after about 15 minutes.
Anyone any suggestions on what i’m doing wrong?
Hi There!
Recently i started the PowerShell: Beginner learning path and got stuck at the DSC part.
I followed the following steps:
Step 1:
configuration Configname {
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Node $Computername {
Windowsfeature IIS{
Name = 'web-server'
Ensure = 'Present'
}
}
}
$computername = 'serverx'
ConfigName -outputpath c:\DSC\Config
Result:
Directory: C:\DSC\Config
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 12/05/2017 13:45 1858 serverx.mof
Step 2:
PS C:\Windows\system32> Start-DscConfiguration -Path C:\DSC\Config\ -ComputerName 'serverx' -Verbose -Wait
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsof
t/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer servery with user sid S-1-5-21-1375646641-2800936017-3851355188-4723.
VERBOSE: [serverx]: LCM: [ Start Set ]
VERBOSE: [serverx]: LCM: [ Start Resource ] [[WindowsFeature]IIS]
VERBOSE: [serverx]: LCM: [ Start Test ] [[WindowsFeature]IIS]
VERBOSE: [serverx]: [[WindowsFeature]IIS] The operation 'Get-WindowsFeature' started: web-server
VERBOSE: [serverx]: [[WindowsFeature]IIS] The operation 'Get-WindowsFeature' succeeded: Web-Server
VERBOSE: [serverx]: LCM: [ End Test ] [[WindowsFeature]IIS] in 1.8520 seconds.
VERBOSE: [serverx]: LCM: [ Start Set ] [[WindowsFeature]IIS]
VERBOSE: [serverx]: [[WindowsFeature]IIS] Installation started...
VERBOSE: [serverx]: [[WindowsFeature]IIS] Continue with installation?
VERBOSE: [serverx]: [[WindowsFeature]IIS] Prerequisite processing started...
VERBOSE: [serverx]: [[WindowsFeature]IIS] Prerequisite processing succeeded.
WARNING: [serverx]: [[WindowsFeature]IIS] Windows automatic updating is not enabled. To ensure that your newly-installed role or feature is automatically updat
ed, turn on Windows Update.
VERBOSE: [serverx]: [[WindowsFeature]IIS] Installation succeeded.
VERBOSE: [serverx]: [[WindowsFeature]IIS] Successfully installed the feature web-server.
VERBOSE: [serverx]: LCM: [ End Set ] [[WindowsFeature]IIS] in 50.0290 seconds.
VERBOSE: [serverx]: LCM: [ End Resource ] [[WindowsFeature]IIS]
VERBOSE: [serverx]: LCM: [ End Set ]
VERBOSE: [serverx]: LCM: [ End Set ] in 53.1560 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 59.469 seconds
Step 3:
Invoke-Command -ComputerName serverx {Remove-WindowsFeature -Name web-server -Restart}
Success Restart Needed Exit Code Feature Result PSComputerName
------- -------------- --------- -------------- --------------
True Yes SuccessRest... {Common HTTP Features, Default Document, D... serverx
WARNING: You must restart this server to finish the removal process.
Step 4:
Test-DscConfiguration -CimSession serverx
False
and there lies the problem, even after 15 minutes or longer i still get the “false” and the web-server feature isn’t restored.
Anyone any suggestions on what i’m doing wrong?
What is the LCM set to “Get-DscLocalConfigurationManager” under ConfigurationMode? In order for it to auto re-run this would need to be set to “ApplyAndAutoCorrect”
What happens if you re-run “Start-DscConfiguration -Path C:\DSC\Config\ -ComputerName ‘serverx’ -Verbose -Wait”