hi,
Nice, our own DSC forum, very, very good idea ![]()
From time to time I find my self needing to “run” an configuration that requires network access. I had this great idea to use register-pssessionconfiguration on the node and use the runascredential parameter for the cmdlet. Took me about 10 minutes to create the custom DSC resource, however that left me hanging in a catch 22 since the register command need to restart the winrm service (which I am using to push the configuration). I tried launching a new powershell session (with a new PID) to restart the winRM service from my custom DSC resource that (restart-service winrm -force), however that resulted in winrm service status Stop(pending). If i terminate the Svchost.exe process manually, the configuration is unable to continue (see error below).
Two questions:
- Am I barking up the wrong tree since this will never ever work or
- Do anyone have an idea to solve the catch 22?
The error:
WARNING: [S002]: [[FPsessionProxy]sccmProxy] Changes made by Register-PSSessionConfiguration cannot take effect until the WinRM service is restarted.
WARNING: [WSManNetworkFailureDetected] The network connection to s002 has been interrupted. Attempting to reconnect for up to 4 minutes…
WARNING: [WSManConnectionRetryAttempt] Attempting to reconnect to s002 …
WARNING: [WSManConnectionRetryAttempt] Attempting to reconnect to s002 …
WARNING: [WSManConnectionRetryAttempt] Attempting to reconnect to s002 …
WARNING: [WSManConnectionRetryAttempt] Attempting to reconnect to s002 …
WARNING: [WSManConnectionRetryAttempt] Attempting to reconnect to s002 …
WARNING: [WSManConnectionRetrySucceeded] The network connection to s002 has been restored.
The WS-Management service cannot process the operation. The operation is being attempted on a client session that is unusable. This may be related to a recent restart of the WS-Management service. Please create a new
client session and retry the operation if re-executing the operation does not have undesired behavior.
+ CategoryInfo : InvalidOperation: (root/Microsoft/…gurationManager:String) , CimException
+ FullyQualifiedErrorId : HRESULT 0x803381fa
+ PSComputerName : s002
VERBOSE: Operation ‘Invoke CimMethod’ complete.
VERBOSE: Time taken for configuration job to complete is 126.693 seconds
Please be gentle
cheers
Tore