This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Description
When running the resource using
Invoke-DscResource -ModuleName JustEnoughAdministration -Name JeaEndpoint -Method Set -Verbose -Property @{
EndpointName = 'Microsoft.PowerShell'
RoleDefinitions = "@{ 'CONTOSO\DnsAdmins' = @{ RoleCapabilities = 'DnsAdmin' } }"
TranscriptDirectory = 'C:\ProgramData\JeaEndpoint\Transcripts'
ScriptsToProcess = @('C:\ProgramData\JeaEndpoint\startup.ps1')
VisibleCmdlets = "'DnsServer\*',
@{
'Name' = 'Restart-Service'
'Parameters' = @{
'Name' = 'Name'
'ValidateSet' = 'Dns'
}
}"
}
At one point it restarts the WinRM service, which then fails the DSC run.
VERBOSE: [SQLTEST]: [[JeaEndpoint]DirectResourceAccess] Restarting WinRM service
WARNING: [WSManNetworkFailureDetected] The network connection to localhost has been interrupted. Attempting to reconnect for up to 4 minutes...
WARNING: [WSManConnectionRetryAttempt] Attempting to reconnect to localhost ...
WARNING: [WSManConnectionRetrySucceeded] The network connection to localhost 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 ses
sion 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 : localhost
Would it be better to override the restart the service, and instead allow the resource to restart the node using $global:DSCMachineStatus = 1. 🤔