Windows 10: Trying to run Powershell command in a .BAT file via scheduled tasks results in UAC request.

Discus and support Trying to run Powershell command in a .BAT file via scheduled tasks results in UAC request. in Windows 10 Network and Sharing to solve the problem; As above - I'm trying to run a simple Powershell command via a Batch File to capture the programs that are accessing the Internet. I'm running this... Discussion in 'Windows 10 Network and Sharing' started by DavidWall, Oct 6, 2018.

  1. DavidWall Win User

    Trying to run Powershell command in a .BAT file via scheduled tasks results in UAC request.


    As above - I'm trying to run a simple Powershell command via a Batch File to capture the programs that are accessing the Internet.

    I'm running this via Scheduled Tasks in order to check when a particular program has finished its own task.

    This will run all night if necessary at 15 min intervals.


    If I run this manually in Powershell (as administrator) it runs fine (obviously without the Powershell Command bits)

    but if I run it from a shortcut or Scheduled Tasks I get the output message.


    The requested operation requires elevation.

    I'm have Run with highest priviledges set in Sch Tsks


    The command I'm trying to run is shown below.


    Powershell -Command "& {Netstat -b | Out-File 0Active.xxx -Encoding ASCII}"


    I 'presume' it's because the Netstat requires elevation - so how the fh do I do it ??.


    Thanks in anticipation

    :)
     
    DavidWall, Oct 6, 2018
    #1
  2. floundo Win User

    Scheduled Task Won't Launch Program with .bat File

    I just created a powershell script to both start and stop the application. Running both on their own, just like the bat files I created, open and close the program with no issue.

    However same as the bats, when I schedule a task to run the powershell script, the same three adobe background processes show up, but the application doesn't open.
     
    floundo, Oct 6, 2018
    #2
  3. Kari Win User
    bat job started by Task Scheduler does not pause


    I mentioned this in my last post, also sceptical about a batch "running in PowerShell":

    However, you are only half right right: OP mentioned it by himself, although first after it was suggested:

     
    Kari, Oct 6, 2018
    #3
  4. Kari Win User

    Trying to run Powershell command in a .BAT file via scheduled tasks results in UAC request.

    bat job started by Task Scheduler does not pause


    First, this issue of yours is interesting; I have never seen a batch file (.bat or .cmd) when run as a task to start PowerShell instead of Command Prompt.

    That being said, this should take care of that:


    Trying to run Powershell command in a .BAT file via scheduled tasks results in UAC request. [​IMG]


    Program: cmd, argument: /c MyBatchFile.bat

    When saved it looks like this:


    Trying to run Powershell command in a .BAT file via scheduled tasks results in UAC request. [​IMG]
     
    Kari, Oct 6, 2018
    #4
Thema:

Trying to run Powershell command in a .BAT file via scheduled tasks results in UAC request.

Loading...
  1. Trying to run Powershell command in a .BAT file via scheduled tasks results in UAC request. - Similar Threads - Trying run Powershell

  2. Windows Task Scheduler - Running a .BAT File whether user is logged on or not

    in Windows 10 Software and Apps
    Windows Task Scheduler - Running a .BAT File whether user is logged on or not: Hi,I am using Windows 10 Pro. I created a simple .BAT file with the following location and filename:C:\PK_Temp\test.batCurrently, my test.bat file consists of just the following two commands ...Echo "Hi Paul" pause... When I run this .BAT file manually, the Windows Command...
  3. Scheduled Task to run powershell script via GPOcomputer on a particular day

    in Windows 10 Gaming
    Scheduled Task to run powershell script via GPOcomputer on a particular day: Hi Reader, How to create a scheduled task to run a powershell script whether user is logged on or not during a specific time via GPO. I have implemented it locally using the following settings, which prompts for the user account password while creating the scheduled task....
  4. Scheduled Task to run powershell script via GPOcomputer on a particular day

    in Windows 10 Software and Apps
    Scheduled Task to run powershell script via GPOcomputer on a particular day: Hi Reader, How to create a scheduled task to run a powershell script whether user is logged on or not during a specific time via GPO. I have implemented it locally using the following settings, which prompts for the user account password while creating the scheduled task....
  5. Scheduled Task to run powershell script via GPOcomputer on a particular day

    in Windows 10 Network and Sharing
    Scheduled Task to run powershell script via GPOcomputer on a particular day: Hi Reader, How to create a scheduled task to run a powershell script whether user is logged on or not during a specific time via GPO. I have implemented it locally using the following settings, which prompts for the user account password while creating the scheduled task....
  6. Powershell script does not run via Task Scheduler

    in Windows 10 Customization
    Powershell script does not run via Task Scheduler: PowerShell script runs fine manually, but doesn't run in Task scheduler. The script: [ATTACH] I tried another command$env:COMPUTERNAME and works fine both manually and via PowerShell....
  7. Start VM via bat file in Windows Task Scheduler

    in Windows 10 Virtualization
    Start VM via bat file in Windows Task Scheduler: I'm attempting to start a VM from a bat file with Windows 10 Task Scheduler. The bat by itself and the script via CMD execute correctly, though I cannot get it to run as a bat in Task Scheduler. I've tried different configurations, directly from a CMD, etc. Interesting...
  8. Task Scheduler and Bat File Problem

    in Windows 10 Support
    Task Scheduler and Bat File Problem: Hi, Not sure which forum to post this in, but hopefully someone has some insight and can help me with this. I have a simple .bat file that stops my media server, creates an archive of a folder (for backup purposes), and then starts the media server again. It works...
  9. Run a scheduled task via command line via command line

    in Windows 10 Support
    Run a scheduled task via command line via command line: i want start a Run a scheduled task via command line like this: Code: %SystemRoot%\system32\taskschd.msc /Run /TN "RegIdleBackup" when i run the cmd in the prompt as admin the shedular task GUI pop up but the task not start. Is there a solution? Is the...
  10. Cannot run BAT file with Task Scheduler "Access Denied".

    in Windows 10 Support
    Cannot run BAT file with Task Scheduler "Access Denied".: Hi all. I am learning some basic batch scripting and I've created a file with the following code: [img] All this does is move various file types to various folders to clean up my desktop. If I click on the .bat file directly it works great. But if I try to run it...