Examples/Resources/WaitForADDomain/5-WaitForADDomain_WaitForDomainControllerWithReboot_Config.ps1
<#PSScriptInfo
.VERSION 1.0 .GUID 2ada2ead-8736-4d5e-9587-e14bacc28761 .AUTHOR Microsoft Corporation .COMPANYNAME Microsoft Corporation .COPYRIGHT (c) Microsoft Corporation. All rights reserved. .TAGS DSCConfiguration .LICENSEURI https://github.com/PowerShell/ActiveDirectoryDsc/blob/master/LICENSE .PROJECTURI https://github.com/PowerShell/ActiveDirectoryDsc .ICONURI .EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES .PRIVATEDATA #> #Requires -module ActiveDirectoryDsc <# .DESCRIPTION This configuration will wait for an Active Directory domain controller to respond within 300 seconds (default) in the domain 'contoso.com' before returning and allowing the configuration to continue run. If the timeout is reached the node will be restarted up to two times and again wait after each restart. If the no domain controller is found after the second restart an error will be thrown. This will use the user credential passes to the built-in PsDscRunAsCredential parameter when determining if the domain is available. #> Configuration WaitForADDomain_WaitForDomainControllerWithReboot_Config { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] $Credential ) Import-DscResource -Module ActiveDirectoryDsc Node localhost { WaitForADDomain 'contoso.com' { DomainName = 'contoso.com' RestartCount = 2 PsDscRunAsCredential = $Credential } } } |