none
How to Run .Bat File from a Non admin account in Windows Server 2003

    Question

  • I have a scheduled task ( .Net Exe ) which creates a text file. Then it runs a .Bat file which has commands for transferring files to another server with the help of PSFTP.exe.

    Problem is the task creates the file but it is not starting the .Bat file. The account which runs this scheduled task is not an Admin. When it is added in Admin group, the task runs .Bat file like charm.

    I found many solutions online from mentioning the StartIn path to Checking the Run with Highest privileges checkbox. But my task runs in Windows server 2003 which doesnt have Run with Highest privileges option. I have mentioned my Start-In path already. So that is not a problem.

    Please let me know how I can run a .Bat file from Non admin account in Windows 2003 server OS.

    Friday, December 09, 2011 7:53 AM

Answers

  • Hi,

     

    You may perform the following methods as workarounds:

     

    Method 1

    Grant the Cmd.exe program Read and Execute permissions for the user account that the batch job runs under. To do this, follow these steps:

    1.Click Start, and then click Windows Explorer.

    2.Locate and then right-click the Cmd.exe file. The Cmd.exe file is located in the %windir%\System32 folder.

    3.Click Properties.

    4.Click the Security tab.

    5.Click Add.

    6.In the Enter the object names to select box, type the user name that the batch job runs under, and then click OK two times.

     

    Note When you add the user, the user is automatically granted Read and Execute permissions.

    7.Click Yes when you are prompted to continue.

     

    Method 2

    Grant Read and Execute permissions for the Cmd.exe file to the Batch group. This permits all batch processes to run the command processor. To do this, follow these steps:

    1.Click Start, and then click Windows Explorer.

    2.Locate and then right-click the Cmd.exe file. The Cmd.exe file is located in the %windir%\System32 folder.

    3.Click Properties.

    4.Click the Security tab.

    5.Click Add.

    6.In the Enter the object names to select box, type Batch, and then click OK two times.

    7.Click Yes when you are prompted to continue.

     

    For more information, please refer to the following Microsoft KB article:

     

    "Access is denied" error message when you run a batch job on a Windows Server 2003-based computer

    http://support.microsoft.com/kb/867466

     

    Regards,


    Arthur Li

    TechNet Community Support

    • Marked as answer by Arjun_MS Thursday, December 15, 2011 12:03 PM
    Wednesday, December 14, 2011 5:16 AM
    Moderator

All replies

  • Hi,

     

    You may perform the following methods as workarounds:

     

    Method 1

    Grant the Cmd.exe program Read and Execute permissions for the user account that the batch job runs under. To do this, follow these steps:

    1.Click Start, and then click Windows Explorer.

    2.Locate and then right-click the Cmd.exe file. The Cmd.exe file is located in the %windir%\System32 folder.

    3.Click Properties.

    4.Click the Security tab.

    5.Click Add.

    6.In the Enter the object names to select box, type the user name that the batch job runs under, and then click OK two times.

     

    Note When you add the user, the user is automatically granted Read and Execute permissions.

    7.Click Yes when you are prompted to continue.

     

    Method 2

    Grant Read and Execute permissions for the Cmd.exe file to the Batch group. This permits all batch processes to run the command processor. To do this, follow these steps:

    1.Click Start, and then click Windows Explorer.

    2.Locate and then right-click the Cmd.exe file. The Cmd.exe file is located in the %windir%\System32 folder.

    3.Click Properties.

    4.Click the Security tab.

    5.Click Add.

    6.In the Enter the object names to select box, type Batch, and then click OK two times.

    7.Click Yes when you are prompted to continue.

     

    For more information, please refer to the following Microsoft KB article:

     

    "Access is denied" error message when you run a batch job on a Windows Server 2003-based computer

    http://support.microsoft.com/kb/867466

     

    Regards,


    Arthur Li

    TechNet Community Support

    • Marked as answer by Arjun_MS Thursday, December 15, 2011 12:03 PM
    Wednesday, December 14, 2011 5:16 AM
    Moderator
  • Hi Arthur,

    Thanks a lot for this solution. It solved my long time issue. I permissioned almost every folder and .exe's with this account that i can think of in my box but I did'nt consider this simple solution of permissioning CMD.exe.

    Thanks again.. :)

    Cheers,

    Arjun

    Thursday, December 15, 2011 12:07 PM