DSC fails when using a script resource with Invoke-SPDscCommand
See original GitHub issueHi guys,
I’m using a script resource for setting SPSecurityTokenServiceConfig:
$scriptParams = @{
"FormsTokenLifetime" = $ConfigurationData.NonNodeData.SharePoint.SecurityTokenServiceConfig.FormsTokenLifetime;
"WindowsTokenLifetime" = $ConfigurationData.NonNodeData.SharePoint.SecurityTokenServiceConfig.WindowsTokenLifetime;
"LogonTokenCacheExpirationWindow" = $ConfigurationData.NonNodeData.SharePoint.SecurityTokenServiceConfig.LogonTokenCacheExpirationWindow;
}
Script SetSPSecurityTokenServiceConfig
{
GetScript = {
return @{ Result = "false" }
}
SetScript = {
Invoke-SPDscCommand -ScriptBlock {
$params = $args[0]
$sts = Get-SPSecurityTokenServiceConfig -ErrorAction SilentlyContinue | `
Where-Object { $_.TypeName -eq "Microsoft.SharePoint.Administration.Claims.SPSecurityTokenServiceManager" }
$sts.FormsTokenLifetime = (New-TimeSpan -Minutes $params.FormsTokenLifetime)
$sts.WindowsTokenLifetime = (New-TimeSpan -Minutes $params.WindowsTokenLifetime)
$sts.LogonTokenCacheExpirationWindow = (New-TimeSpan -Minutes $params.LogonTokenCacheExpirationWindow)
$sts.Update()
} -Arguments @($using:scriptParams)
}
TestScript = {
return $false
}
PsDscRunAsCredential = $SPSetupAccount
DependsOn = $FarmWaitTask
}
This resource worked fine with older versions of SharePointDSC, it fails with SharePointDSC 4.5.1:
Verbose logs showing the problem
VERBOSE: [V00PEEE50SPP201]: LCM: [ Start Resource ] [[Script]SetSPSecurityTokenServiceConfig] VERBOSE: [V00PEEE50SPP201]: LCM: [ Start Test ] [[Script]SetSPSecurityTokenServiceConfig] DEBUG: [V00PEEE50SPP201]: [[Script]SetSPSecurityTokenServiceConfig] Begin executing Test Script. DEBUG: [V00PEEE50SPP201]: [[Script]SetSPSecurityTokenServiceConfig] Executing Script: return $false DEBUG: [V00PEEE50SPP201]: [[Script]SetSPSecurityTokenServiceConfig] End executing Test Script. VERBOSE: [V00PEEE50SPP201]: LCM: [ End Test ] [[Script]SetSPSecurityTokenServiceConfig] in 0.2820 seconds. VERBOSE: [V00PEEE50SPP201]: LCM: [ Start Set ] [[Script]SetSPSecurityTokenServiceConfig] VERBOSE: [V00PEEE50SPP201]: LCM: [ End Set ] [[Script]SetSPSecurityTokenServiceConfig] in 0.7030 seconds. PowerShell DSC resource MSFT_ScriptResource failed to execute Set-TargetResource functionality with error message: Processing data for a remote command failed with the following error message: The WSMan provider host process did not return a proper response. A provider in the host process may have behaved improperly. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : InvalidOperation: (😃 [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : V00PEEE50SPP201 PowerShell DSC resource MSFT_ScriptResource failed to execute Set-TargetResource functionality with error message: Processing data for a remote command failed with the following error message: The WSMan provider host process did not return a proper response. A provider in the host process may have behaved improperly. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : InvalidOperation: (😃 [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : Server01
Did some checks with some other simple script resources using Invoke-SPDSCCommand and they all failed with the same error message.
OS: Windows Server 2016 SharePoint: 2019
Any help is appreciated…
Regards, Thomas
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13 (11 by maintainers)
Hi Yorick,
it returns exactly the same value…
Mit freundlichen Grüßen / Kind regards
Thomas Lieftüchter
Lieftüchter IT Consulting & Hausverwaltung GbR Römerweg 10a 63303 Dreieich - Germany
Fon: +49 171.2625166 Email: @.@.> Web: https://www.lieftuechter.com/TL
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
Von: Yorick Kuijs @.> Gesendet: Dienstag, 22. Juni 2021 15:51 An: dsccommunity/SharePointDsc @.> Cc: Thomas Lieftüchter @.>; Author @.> Betreff: Re: [dsccommunity/SharePointDsc] DSC fails when using a script resource with Invoke-SPDscCommand (#1298)
What is the value when you run the following command:
Get-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB
This should be something like:
WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Shell
Type Name SourceOfValue Value
System.String MaxMemoryPerShellMB 2147483647
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dsccommunity/SharePointDsc/issues/1298#issuecomment-866002364, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALR4I45OELVDVO4HMLOFKETTUCIOBANCNFSM4ZUWO4WA.
Closing this issue