Last active
October 22, 2016 19:27
-
-
Save PlagueHO/f3215ef69a5bacbace96bc6600e36831 to your computer and use it in GitHub Desktop.
Create a Scheduled Task to Validate the DNS using OVF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Cred = Get-Credential -Message 'User to run task as' | |
$Action = New-ScheduledTaskAction ` | |
–Execute 'PowerShell.exe' ` | |
-Argument '-WindowStyle Hidden -Command "Import-Module ValidateDNS; Invoke-ValidateDNS;"' | |
$Trigger = New-ScheduledTaskTrigger ` | |
-Once ` | |
-At (Get-Date -Hour 0 -Minute 0 -Second 0) ` | |
-RepetitionInterval (New-TimeSpan -Minutes 60) ` | |
-RepetitionDuration ([System.TimeSpan]::MaxValue) | |
$Task = New-ScheduledTask ` | |
-Description 'Validate DNS' ` | |
-Action $Action ` | |
-Trigger $Trigger | |
Register-ScheduledTask ` | |
-TaskName 'Validate DNS' ` | |
-InputObject $Task ` | |
-User $Cred.UserName ` | |
-Password $Cred.GetNetworkCredential().Password | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment