diff --git a/CHANGELOG.md b/CHANGELOG.md index 88f376f8d..c43f4ca50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Export + - Fixed issue where the export would not run on Subscription Edition - SPTrustedRootAuthority - Added `-Recurse` flag to `Get-ChildItem` when setting certificate by Thumbprint. +- SPPublishServiceApplication + - Fixed issue where the Set method never did anything because it was checking incorrect + values ## [5.3.0] - 2022-11-15 @@ -24,9 +31,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Export + - Fixed issue where the export would not run on Subscription Edition - SPInstallPrereqs - Fix issue where a failed VC++ upgrade results in two versions being present, which the code didn't handle properly +- SPPublishServiceApplication + - Fixed issue where the Set method never did anything because it was checking incorrect + values - SPShellAdmins - Fix issue where Get-SPDatabase could not be found - SPUserProfileServiceApp diff --git a/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 b/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 index 0b8da1771..cb96a7ba5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 @@ -104,13 +104,13 @@ function Set-TargetResource throw $message } - if ($Ensure -eq "Present") + if ($params.Ensure -eq "Present") { Write-Verbose -Message "Publishing Service Application $Name" Publish-SPServiceApplication -Identity $serviceApp } - if ($Ensure -eq "Absent") + if ($params.Ensure -eq "Absent") { Write-Verbose -Message "Unpublishing Service Application $Name" Unpublish-SPServiceApplication -Identity $serviceApp diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 index 8c7ad4900..53d0d7508 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 @@ -374,7 +374,7 @@ function Get-SPDscFarmAccount [System.Reflection.BindingFlags]::Instance -bor ` [System.Reflection.BindingFlags]::NonPublic - $pw = $account.GetType().GetField("m_Password", $bindings).GetValue($account); + $pw = $account.GetType().GetField("m_Password", $bindings).GetValue($account) return New-Object -TypeName System.Management.Automation.PSCredential ` -ArgumentList $farmaccount, $pw.SecureStringValue @@ -533,18 +533,18 @@ function Get-SPDscServerPatchStatus $farm = Get-SPFarm $productVersions = [Microsoft.SharePoint.Administration.SPProductVersions]::GetProductVersions($farm) $server = Get-SPServer $env:COMPUTERNAME - $serverProductInfo = $productVersions.GetServerProductInfo($server.Id); + $serverProductInfo = $productVersions.GetServerProductInfo($server.Id) if ($null -ne $serverProductInfo) { - $statusType = $serverProductInfo.InstallStatus; + $statusType = $serverProductInfo.InstallStatus if ($statusType -ne 0) { - $statusType = $serverProductInfo.GetUpgradeStatus($farm, $server); + $statusType = $serverProductInfo.GetUpgradeStatus($farm, $server) } } else { - $statusType = [Microsoft.SharePoint.Administration.SPServerProductInfo+StatusType]::NoActionRequired; + $statusType = [Microsoft.SharePoint.Administration.SPServerProductInfo+StatusType]::NoActionRequired } return $statusType @@ -561,22 +561,22 @@ function Get-SPDscAllServersPatchStatus [array]$srvStatus = @() foreach ($server in $servers) { - $serverProductInfo = $productVersions.GetServerProductInfo($server.Id); + $serverProductInfo = $productVersions.GetServerProductInfo($server.Id) if ($null -ne $serverProductInfo) { - $statusType = $serverProductInfo.InstallStatus; + $statusType = $serverProductInfo.InstallStatus if ($statusType -ne 0) { - $statusType = $serverProductInfo.GetUpgradeStatus($farm, $server); + $statusType = $serverProductInfo.GetUpgradeStatus($farm, $server) } } else { - $statusType = [Microsoft.SharePoint.Administration.SPServerProductInfo+StatusType]::NoActionRequired; + $statusType = [Microsoft.SharePoint.Administration.SPServerProductInfo+StatusType]::NoActionRequired } $srvStatus += [PSCustomObject]@{ - Name = $server.Name + Name = $server.Name Status = $statusType } } @@ -1674,36 +1674,39 @@ function Export-SPConfiguration $Global:spFarmAccount = "" $sharePointSnapin = Get-PSSnapin | Where-Object { $_.Name -eq "Microsoft.SharePoint.PowerShell" } - if ($null -ne $sharePointSnapin) + if ($null -eq $sharePointSnapin) { - if ($Quiet -or $ComponentsToExtract.Count -gt 0) + $sharePointModule = Get-Module SharePointServer -ListAvailable + if ($null -eq $sharePointModule) { - if ($StandAlone) + Write-Host -Object " - We couldn't detect a SharePoint installation on this machine. Please execute the SharePoint ReverseDSC script on an existing SharePoint server." -BackgroundColor Red -ForegroundColor Black + return + } + } + + if ($Quiet -or $ComponentsToExtract.Count -gt 0) + { + if ($StandAlone) + { + if ($DynamicCompilation) { - if ($DynamicCompilation) - { - Get-SPReverseDSC -ComponentsToExtract $ComponentsToExtract -Credentials $Credentials -OutputPath $OutputPath -Standalone -DynamicCompilation -ProductKey $ProductKey -BinaryLocation $BinaryLocation - } - else - { - Get-SPReverseDSC -ComponentsToExtract $ComponentsToExtract -Credentials $Credentials -OutputPath $OutputPath -Standalone -ProductKey $ProductKey -BinaryLocation $BinaryLocation - } + Get-SPReverseDSC -ComponentsToExtract $ComponentsToExtract -Credentials $Credentials -OutputPath $OutputPath -Standalone -DynamicCompilation -ProductKey $ProductKey -BinaryLocation $BinaryLocation } else { - Get-SPReverseDSC -ComponentsToExtract $ComponentsToExtract -Credentials $Credentials -OutputPath $OutputPath -ProductKey $ProductKey -BinaryLocation $BinaryLocation + Get-SPReverseDSC -ComponentsToExtract $ComponentsToExtract -Credentials $Credentials -OutputPath $OutputPath -Standalone -ProductKey $ProductKey -BinaryLocation $BinaryLocation } } else { - [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null - [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null - DisplayGUI + Get-SPReverseDSC -ComponentsToExtract $ComponentsToExtract -Credentials $Credentials -OutputPath $OutputPath -ProductKey $ProductKey -BinaryLocation $BinaryLocation } } else { - Write-Host -Object " - We couldn't detect a SharePoint installation on this machine. Please execute the SharePoint ReverseDSC script on an existing SharePoint server." -BackgroundColor Red -ForegroundColor Black + [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null + [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null + DisplayGUI } }