Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- OfficeOnlineServerFarm
- Added hierarchy and LDAP:// support for FarmOU

### Changed

- OfficeOnlineServerDsc
Expand Down
4 changes: 4 additions & 0 deletions src/DSCResources/MSFT_OfficeOnlineServerFarm/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ have already been installed, but when this is run it will establish a new farm.
means that this resource only needs to be used on the first server in a deployment,
all other servers should use the OfficeOnlineServerMachine resource to join
the farm.

FarmOU can be specified using path or LDAP syntax. For example "Servers/OOS" or
"LDAP://OU=OOS,OU=Servers". ntds:// format is supported by the underlying
Office Online Server Management Shell but is not implemented in OfficeOnlineServerDSC.
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ function Get-OosDscInstalledProductVersion
param ()

return Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | `
Select-Object DisplayName, DisplayVersion | `
Where-Object {
$_.DisplayName -eq "Microsoft Office Web Apps Server 2013" -or `
$_.DisplayName -eq "Microsoft Office Online Server"
} | ForEach-Object -Process {
return [Version]::Parse($_.DisplayVersion)
} | Select-Object -First 1
Select-Object DisplayName, DisplayVersion | `
Where-Object {
$_.DisplayName -eq "Microsoft Office Web Apps Server 2013" -or `
$_.DisplayName -eq "Microsoft Office Online Server"
} | ForEach-Object -Process {
return [Version]::Parse($_.DisplayVersion)
} | Select-Object -First 1
}


Expand Down Expand Up @@ -332,12 +332,30 @@ function Test-OosDscFarmOu
$ExistingOU
)

if ($DesiredOU -like "LDAP://*")
{
$sanitizedFarmOU = $DesiredOU -replace 'LDAP://'
}
elseif ($DesiredOU -like "ntds://*")
{
throw "FarmOU in ntds:// format is not supported";
}
else
{
$str = ($DesiredOU -replace '/', '\').Trim('\');
$splitOu = $str -split '\\'
[array]::Reverse($splitOu)
$sanitizedFarmOU = "OU=" + ($splitOu -join ",OU=");
}

$adsi = [adsisearcher]'(objectCategory=organizationalUnit)'
$adsi.Filter = "name=$DesiredOU"
$ou = $adsi.FindAll()
$searchRoot = "," + $adsi.SearchRoot.Path -replace 'LDAP://'

$adsi.Filter = "distinguishedName=$($sanitizedFarmOU)$searchRoot"
$ou = $adsi.FindOne()

if ($ou.path)
{
$searchRoot = "," + $adsi.SearchRoot.Path -replace 'LDAP://'
$ldapResult = $ou.path -replace $searchRoot
Write-Verbose -Message "LDAP search result: $ldapResult"
Write-Verbose "Current Farm OU: $ExistingOU"
Expand Down