none
How To Run CMD File Visible As Administrator On Logon With Non Administrator ID RRS feed

  • Question

  • Windows 10 Pro x64 1607

    Because of the forced reboot I have to setup a machine with autologon for a non administrator id.  It needs to start a CMD file as an administrator.  I set it up in Task Scheduler to run when a specific id logons and it starts but is not visible.

    So I need to do the equivalent of right clicking on the cmd file and selecting run as administrator, selecting an administrator id, entering password and press ok when the specific user logs on.


    http://www.saberman.com

    vendredi 7 octobre 2016 16:43

Toutes les réponses

  • Hi ,

    If you right click this task in task Schedule, then click "run", will it run as expected?

    Based on your description, it seems to be relate to privileges. Here is a similar case for your reference, hope it helps.
    Schedule a task with admin privileges without a user prompt in windows 7
    http://superuser.com/questions/770420/schedule-a-task-with-admin-privileges-without-a-user-prompt-in-windows-7
    NOTE: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites.

    Best regards


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    lundi 10 octobre 2016 09:36
    Modérateur
  • Launching the task via Task Scheduler at user login is not the problem.  That works.  The problem is the CMD window is not visible.

    If I login, right click on the CMD file, select run as an administrator, select an administrator id, enter the password and press OK the CMD file runs with administrator privileges and is visible.

    If I set it up to start on user login in Task Scheduler I have to have it under a userid with administrative privileges.  So the CMD file starts but the CMD window is not visible.

    The CMD file contains two commands that need to be run with administrative rights, a pause statement followed by a goto that takes it back to the first command.  This way the user, who does not have administrative rights can click on the CMD window, press enter and the two commands will be issued again.  If the CMD window is not visible the user cannot do that.


    http://www.saberman.com

    lundi 10 octobre 2016 21:13
  • Hi ,

    If we create a shortcut for the CMD file, then set the shortcut to run as administrator as shown blew, will it work?
    1.Right click the shortcut
    2.Choose Properties
    3.In the Shortcut tab, click Advanced
    4.Select the checkbox "Run as administrator"
    5.Click OK, OK


    Best regards


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    mercredi 19 octobre 2016 07:37
    Modérateur
  • >If we create a shortcut for the CMD file, then set the shortcut to run as administrator as shown blew, will it work?
    No. 


    http://www.saberman.com

    mercredi 19 octobre 2016 19:18