Func AutoSched ($astaskname, $asindate = "", $asstarttime = "") ; $asindate in mm/dd/yyyy format $asstarttime in hh:mm:ss format If Not IsAdmin () Then MsgBox (1, "Error", "Must Be Run As An Aministrator", 20) Return EndIf ; Path to your PowerShell scripts $aspowershellpath = "C:\Utility\PowerScripts\" ; Set up PowerShell privileges $astaskrc = ShellExecuteWait ("PowerShell", "set-executionpolicy unrestricted", "", "", @SW_HIDE) ; Convert mm/dd/yyyy to yyyy-mm-dd for PowerShell $asstartdate = StringRight ($asindate, 4) & "-" & StringLeft ($asindate, 2) & "-" & StringMid ($asindate, 4, 2) ; Format the command line $ascommand = $aspowershellpath & "MySched.ps1 " & $astaskname & " " & $asstartdate & " " & $asstarttime ; Run the PowerShell script $astaskrc = ShellExecuteWait ("PowerShell", $ascommand, "", "", @SW_HIDE) If $astaskrc <> 0 Then MsgBox (40000, "*** Scheduler Failed ", $ascommand) EndFunc