dsccommunity / SharePointDsc

The SharePointDsc PowerShell module provides DSC resources that can be used to deploy and manage a SharePoint farm
MIT License
245 stars 107 forks source link

SPPublishServiceApplication - Set-TargetResource does not work #1420

Closed scoreman closed 1 year ago

scoreman commented 1 year ago

Problem description

If-statements checking Present/Absent never becomes true since they are within Invoke-SPDscCommand and using $Ensure istead of $params.Ensure.

Verbose logs

Setting service application publish status '<...>'
Executing as the local run as user <...>
Leaving BeginProcessing Method of Get-SPServiceApplication.
Leaving ProcessRecord Method of Get-SPServiceApplication.
Leaving EndProcessing Method of Get-SPServiceApplication.
 in 0.1870 seconds.

DSC configuration

-

Suggested solution

replace:

if ($Ensure -eq "Present") .... if ($Ensure -eq "Absent")

with:

if ($params.Ensure -eq "Present") .... if ($params.Ensure -eq "Absent")

SharePoint version and build

SPSE

Operating system the target node is running

-

PowerShell version and build the target node is running

-

SharePointDsc version

5.3.0