Hiya, i have trawled through closed tickets but cant seem to find anything that points me in the right direction, i have updated $searchroot with my domain name, machine is connected through VPN and additional variables have been added as per below -
$class = cimclass MSFT_TaskEventTrigger root/Microsoft/Windows/TaskScheduler
$trigger2 = $class | New-CimInstance -ClientOnly
$trigger2.Enabled = $True
$trigger2.Subscription = '*[System[Provider[@name=''Microsoft-Windows-NetworkProfile''] and EventID=10002]]'
$trigger3 = $class | New-CimInstance -ClientOnly
$trigger3.Enabled = $True
$trigger3.Subscription = '*[System[Provider[@name=''Microsoft-Windows-NetworkProfile''] and EventID=4004]]'
#Execute task in users context
$principal= New-ScheduledTaskPrincipal -GroupId "S-1-5-32-545" -Id "Author"
#call the vbscript helper and pass the PosH script as argument
$action = New-ScheduledTaskAction -Execute $wscriptPath -Argument ""$dummyScriptPath
" "$scriptPath
""
$settings= New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
$null=Register-ScheduledTask -TaskName $schtaskName -Trigger $trigger,$trigger2,$trigger3 -Action $action -Principal $principal -Settings $settings -Description $schtaskDescription -Force
Start-ScheduledTask -TaskName $schtaskName
upon reviewing the log file it states that 'The running command stopped because the preference variable "ErrorActionPreference" or comman parameter is set to stop: the system cannont contact a domain controller to service the authentication request. please try again later" i am able to ping the DC so have a route to it.
Any help appreciated,
Ryan