Skip to content

Commit

Permalink
Merge pull request #1423 from ykuijs/master
Browse files Browse the repository at this point in the history
Fixing two issues
  • Loading branch information
ykuijs committed Mar 17, 2023
2 parents 0cc9fef + 48e6989 commit 8dba53d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 28 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
55 changes: 29 additions & 26 deletions SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
}
}
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit 8dba53d

Please sign in to comment.