Scripts/Reskit9/All Resources/xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.psm1
function Get-TargetResource { [CmdletBinding()] [OutputType([System.Collections.Hashtable])] param ( [parameter(Mandatory = $true)] [System.String] $Identity, [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $Credential, [parameter(Mandatory = $true)] [ValidateSet("TCP","TLS","Dual")] [System.String] $UMStartupMode, [System.String] $DomainController ) #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference #Establish remote Powershell session GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*UMService" -VerbosePreference $VerbosePreference RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" $umService = Get-UMService @PSBoundParameters if ($umService -ne $null) { $returnValue = @{ Identity = $Identity UMStartupMode = $umService.UMStartupMode } } $returnValue } function Set-TargetResource { [CmdletBinding()] param ( [parameter(Mandatory = $true)] [System.String] $Identity, [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $Credential, [parameter(Mandatory = $true)] [ValidateSet("TCP","TLS","Dual")] [System.String] $UMStartupMode, [System.String] $DomainController ) #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference #Establish remote Powershell session GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*UMService" -VerbosePreference $VerbosePreference RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential" Set-UMService @PSBoundParameters } function Test-TargetResource { [CmdletBinding()] [OutputType([System.Boolean])] param ( [parameter(Mandatory = $true)] [System.String] $Identity, [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $Credential, [parameter(Mandatory = $true)] [ValidateSet("TCP","TLS","Dual")] [System.String] $UMStartupMode, [System.String] $DomainController ) #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference $umService = Get-TargetResource @PSBoundParameters if ($umService -eq $null) { return $false } else { if (!(VerifySetting -Name "UMStartupMode" -Type "String" -ExpectedValue $UMStartupMode -ActualValue $umService.UMStartupMode -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) { return $false } } return $true } Export-ModuleMember -Function *-TargetResource |