DSCResources/myAdExchPrepareAllDomains/myAdExchPrepareAllDomains.psm1
Import-Module $PSScriptRoot\..\myAdHelper.psm1 -Verbose:$false function Get-TargetResource { param ( [System.String]$Path, [System.String]$Arguments, [Parameter(Mandatory = $true)] [System.Management.Automation.PSCredential]$Credential ) $PSBoundParameters } function Set-TargetResource { [CmdletBinding()] param ( [System.String]$Path, [System.String]$Arguments, [Parameter(Mandatory = $true)] [System.Management.Automation.PSCredential]$Credential ) StartAndWaitWaitForProcessEnd -Path $Path -Arguments $Arguments -Credential $Credential -Delay 7200 -Verbose -TaskName 'EXCHANGE - PrepareAllDomains' -ProcessToWaitFor 'ExSetup*' } function Test-TargetResource { [CmdletBinding()] [OutputType([System.Boolean])] param ( [System.String]$Path, [System.String]$Arguments, [Parameter(Mandatory = $true)] [System.Management.Automation.PSCredential]$Credential ) $Result = $true $Domain = ReplacePartitionTokens -Identity "%%domain%%" -Credential $Credential try { $Member = Get-ADGroup "CN=Exchange Install Domain Servers,CN=Microsoft Exchange System Objects,$Domain" $result = ((Get-ADGroupMember "CN=Exchange Servers,OU=Microsoft Exchange Security Groups,$Domain").distinguishedName -contains $Member.distinguishedName) } catch { $result = $false } try { $Member = Get-ADGroup "CN=Exchange Servers,OU=Microsoft Exchange Security Groups,$Domain" $result = ((Get-ADGroupMember "CN=Windows Authorization Access Group,CN=Builtin,$Domain").distinguishedName -contains $Member.distinguishedName) } catch { $result = $false } $result } Export-ModuleMember -Function *-TargetResource |