Schedule Task with ASP3 Windows Server 2019 [Answered]RSS

2 replies

Last post Jan 08, 2020 05:06 PM by Erick Gomes

  • Schedule Task with ASP3 Windows Server 2019

    Jan 07, 2020 08:30 PM|Erick Gomes|LINK

    Hello everyone.

    I need to create a Scheduled Task through an ASP page.

    I have privilege as an Administrator and can even create a task, but when performing this task, nothing happens. I created a simple ASP script to send an email when the task was executed. Changing the user of this task to System in "When performing the task, use the following user account", the task runs perfectly. It seems that the user "Administrator" does not have all the privileges.

    Follows code:

    linha_exe = """'C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe' \""Start-Process -FilePath https://url/envio.asp""""""
    
    comando = "SCHTASKS /CREATE /TN ""teste""" /SC ONCE /F /RU ""Administrator"" /RP ""******"" /NP /RL HIGHEST /SD "07/01/2020" /ST "17:00:00" /TR "&linha_exe
    
    Set objShell = CreateObject("WScript.Shell")
    Set objExec = objShell.Exec("cmd /c " & comando)
    Set objStdOut = objExec.StdOut

    Could anyone tell me how to create this task to run as System?

  • Re: Schedule Task with ASP3 Windows Server 2019

    Jan 08, 2020 03:33 AM|Yuk Ding|LINK

    Hi Erick Gomes,

    Have you ever tried to host it in IIS and set application to Local system. Then set anonymous authentication to use application pool identity?

    Best Regards,

    Jokies Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: Schedule Task with ASP3 Windows Server 2019

    Jan 08, 2020 05:06 PM|Erick Gomes|LINK

    Hi Yuk Ding,

    thanks for answering.

    I followed your guidance. The task was created as System, but only runs the url if it has connected to the server.

    would you have any more ideas?