Examples/SimpleOneResourceExample/SimpleOneResourceExample.ps1

Configuration SimpleOneResourceExample
{
    param
    (
        [PSCredential]$ShellCreds
    )

    Import-DscResource -Module xExchange

    Node $AllNodes.NodeName
    {
        #Used when passing credentials securely. This configures the thumbprint of the
        #cert that will be used to decrypt the creds
        LocalConfigurationManager
        {
            CertificateId = $Node.Thumbprint
        }
        
        xExchOwaVirtualDirectory OWAVdir
        {
            Identity                      = "$($Node.NodeName)\owa (Default Web Site)"
            Credential                    = $ShellCreds
            BasicAuthentication           = $false
            ExternalAuthenticationMethods = 'Ntlm','WindowsIntegrated'
            ExternalUrl                   = "https://mail-ext.mikelab.local/owa"
            FormsAuthentication           = $false
            InternalUrl                   = "https://mail-int.mikelab.local/owa"    
            WindowsAuthentication         = $true
            AllowServiceRestart           = $true
        }
    }
}

$Config = @{
    AllNodes = @(
        #Settings in this section will apply to all nodes.
        @{
            NodeName        = '*'

            #The path to the .cer file containing the public key of the Encryption
            #Certificate used to encrypt credentials for this node
            CertificateFile = 'C:\publickey.cer' 

            #The thumbprint of the Encryption Certificate used to decrypt the credentials
            #on target node
            Thumbprint      = '98e1858ee4da01e4fb9f0519bc60d9c30f33b1c6' 
        }

        #Each individual server that will be configured needs to be defined next.
        @{
            NodeName = 'e15-1'
        }

        @{
            NodeName = 'e15-2'
        }
    );
}

#Get credentials if they haven't already been passed
if ($ShellCreds -eq $null)
{
    $ShellCreds = Get-Credential -Message 'Enter credentials for establishing Remote Powershell sessions to Exchange'
}

###Compiles the example
SimpleOneResourceExample -ConfigurationData $Config -ShellCreds $ShellCreds

###Sets up LCM on specified computer to decrypt credentials (if passing creds securely)
Set-DscLocalConfigurationManager -Path .\SimpleOneResourceExample -Verbose -ComputerName "E15-1"

###Pushes configuration to specified computer
Start-DscConfiguration -Verbose -Wait -Path .\SimpleOneResourceExample -ComputerName "E15-1"