Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NikCharlebois committed Nov 25, 2020
2 parents 9dbb602 + a028402 commit bbb96e4
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 24 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- SPWebAppPolicy
- Fixed a blocking issue introduced in version 4.4.0 when extracting cache
accounts

## [4.4.0] - 2020-11-14

### Added

- SharePointDsc
- Added logging to the event log when the code throws an exception
- Added support for trusted domains to Test-SPDscIsADUser helper function
- SPInstall
- Added documentation about a SharePoint 2019 installer issue

### Changed

- SPAlternateUrl
- Fixed issue where trailing '/' cause Url not to be recognized.
- SharePointDsc
- Updated Convert-SPDscHashtableToString to output the username when
parameter is a PSCredential
- SPFarm
- Switched from creating a Lock database to a Lock table in the TempDB.
This to allow the use of precreated databases.
- Updated code to properly output used credential parameters to verbose
logging
- SPSite
- Added more explanation to documentation on which parameters are checked
- SPWeb
Expand All @@ -39,7 +55,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed issue where provisioning the service app requires a second run to
update all specified parameters
- SPWorkflowService
- Fixed issue configuring workflow service when no workflow service is currently configured.
- Fixed issue configuring workflow service when no workflow service is
currently configured

## [4.3.0] - 2020-09-30

Expand Down
23 changes: 22 additions & 1 deletion SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,20 @@ function Set-TargetResource
{
try
{
Write-Verbose -Message "Connecting to existing Config database"
Write-Verbose -Message "executeArgs is:"
foreach ($arg in $executeArgs.Keys)
{
if ($executeArgs.$arg -is [System.Management.Automation.PSCredential])
{
Write-Verbose -Message "$arg : $($executeArgs.$arg.UserName)"
}
else
{
Write-Verbose -Message "$arg : $($executeArgs.$arg)"
}
}

Connect-SPConfigurationDatabase @executeArgs | Out-Null
$connectedToFarm = $true
}
Expand Down Expand Up @@ -1031,7 +1045,14 @@ function Set-TargetResource
Write-Verbose -Message "executeArgs is:"
foreach ($arg in $executeArgs.Keys)
{
Write-Verbose -Message "$arg $($executeArgs[$arg])"
if ($executeArgs.$arg -is [System.Management.Automation.PSCredential])
{
Write-Verbose -Message "$arg : $($executeArgs.$arg.UserName)"
}
else
{
Write-Verbose -Message "$arg : $($executeArgs.$arg)"
}
}
New-SPConfigurationDatabase @executeArgs

Expand Down
22 changes: 22 additions & 0 deletions SharePointDsc/DSCResources/MSFT_SPInstall/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ stream is added to indicate that the file is potentially from an unsafe source.
To use these files, make sure you first unblock them using Unblock-File.
SPInstall will throw an error when it detects the file is blocked.

NOTE 3:
The SharePoint 2019 installer has an issue with the Visual C++ Redistributable.
The Prerequisites Installer accepts a lower version than the SharePoint Setup
requires, resulting in the setup throwing an error message. The solution is to
download the most recent version of the Redistributable and using the Package
resource to install it through DSC:

```PowerShell
Package 'Install_VC2017ReDistx64'
{
Name = 'Microsoft Visual C++ 2015-2019 Redistributable (x64) - 14.24.28127'
Path = 'C:\Install\SharePoint\prerequisiteinstallerfiles\vc_redist.x64.exe'
Arguments = '/quiet /norestart'
ProductId = '282975d8-55fe-4991-bbbb-06a72581ce58'
Ensure = 'Present'
Credential = $InstallAccount
}
```

More information:
https://docs.microsoft.com/en-us/sharepoint/troubleshoot/installation-and-setup/sharepoint-server-setup-fails

## Multilingual support

Where possible, resources in SharePointDsc have been written in a way that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function Set-TargetResource
throw $message
}

$cacheAccounts = Get-SPDscCacheAccountConfiguration -InputParameters $WebAppUrl
$cacheAccounts = Get-SPDscCacheAccountConfiguration -WebApplicationUrl $WebAppUrl

if ($SetCacheAccountsPolicy)
{
Expand Down Expand Up @@ -692,7 +692,7 @@ function Test-TargetResource
return $false
}

$cacheAccounts = Get-SPDscCacheAccountConfiguration -InputParameters $WebAppUrl
$cacheAccounts = Get-SPDscCacheAccountConfiguration -WebApplicationUrl $WebAppUrl
if ($SetCacheAccountsPolicy)
{
if (($cacheAccounts.SuperUserAccount -eq "") -or `
Expand Down Expand Up @@ -944,18 +944,18 @@ function Get-SPDscCacheAccountConfiguration()
[OutputType([System.Collections.Hashtable])]
param (
[Parameter()]
[Object[]]
$InputParameters
[string]
$WebApplicationUrl
)

$cacheAccounts = Invoke-SPDscCommand -Credential $InstallAccount `
-Arguments @($InputParameters, $MyInvocation.MyCommand.Source) `
-Arguments @($WebApplicationUrl, $MyInvocation.MyCommand.Source) `
-ScriptBlock {
Write-Verbose -Message "Retrieving CacheAccounts"
$params = $args[0]
$webApplicationUrl = $args[0]
$eventSource = $args[1]

$wa = Get-SPWebApplication -Identity $params -ErrorAction SilentlyContinue
$wa = Get-SPWebApplication -Identity $webApplicationUrl -ErrorAction SilentlyContinue

if ($null -eq $wa)
{
Expand Down
47 changes: 32 additions & 15 deletions SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ function Convert-SPDscHashtableToString
{
$str = "$($pair.Key)=$(Convert-SPDscCIMInstanceToString -CIMInstance $pair.Value)"
}
elseif ($pair.Value -is [System.Management.Automation.PSCredential])
{
$str = "$($pair.Key)=$($pair.Value.UserName)"
}
else
{
$str = "$($pair.Key)=$($pair.Value)"
Expand Down Expand Up @@ -1345,33 +1349,46 @@ function Test-SPDscIsADUser
{
[OutputType([System.Boolean])]
[CmdletBinding()]
param (
[Parameter()]
param
(
[Parameter(Mandatory = $true)]
[System.String]
$IdentityName
)

$DomainNetbiosName = ""

if ($IdentityName -like "*\*")
{
$DomainNetbiosName = $IdentityName.Split('\')[0]
$IdentityName = $IdentityName.Substring($IdentityName.IndexOf('\') + 1)
}

$searcher = New-Object -TypeName System.DirectoryServices.DirectorySearcher
$searcher.filter = "((samAccountName=$IdentityName))"
$searcher.SearchScope = "subtree"
$searcher.PropertiesToLoad.Add("objectClass") | Out-Null
$searcher.PropertiesToLoad.Add("objectCategory") | Out-Null
$searcher.PropertiesToLoad.Add("name") | Out-Null
$result = $searcher.FindOne()
$domainContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext("Domain", $DomainNetbiosName)
try
{
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetDomain($domainContext)
$root = $domain.GetDirectoryEntry()

$searcher = [System.DirectoryServices.DirectorySearcher]::new()
$searcher.filter = "((samAccountName=$IdentityName))"
$searcher.SearchScope = "subtree"
$searcher.SearchRoot = $root

$searcher.PropertiesToLoad.Add("objectClass") | Out-Null
$searcher.PropertiesToLoad.Add("objectCategory") | Out-Null
$searcher.PropertiesToLoad.Add("name") | Out-Null
$result = $searcher.FindOne()
}
catch
{
return $false
}

if ($null -eq $result)
{
$message = "Unable to locate identity '$IdentityName' in the current domain."
Add-SPDscEvent -Message $message `
-EntryType 'Error' `
-EventID 100 `
-Source $MyInvocation.MyCommand.Source
throw $message
Write-Host "Unable to locate identity '$IdentityName' in the current domain."
return $false
}

if ($result[0].Properties.objectclass -contains "user")
Expand Down

0 comments on commit bbb96e4

Please sign in to comment.