New-Item -Path 'C:\WEF' -ItemType Directory
Copy-Item ${PSScriptRoot}\wef_hc_son.ps1 -Destination C:\WEF\
$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "C:\WEF\wef_hc_son.ps1" # Specify what program to run and with its parameters
$trigger = New-ScheduledTaskTrigger -Daily -At 12am
$User= "NT AUTHORITY\SYSTEM"
$task = Register-ScheduledTask -TaskName "Wef Logging" -Trigger $trigger -User $User -Action $action -RunLevel Highest –Force 
#$task.Triggers.Repetition.Duration = "P1D" #//Repeat for a duration of one day
$task.Triggers.Repetition.Interval = "PT1H" #//Repeat every 30 minutes, use PT1H for every hour
$task | Set-ScheduledTask
