Run a Script with administrative privileges via GPO

Page 1 of 3 123 LastLast

  1. Posts : 54
    win 10
       #1

    Run a Script with administrative privileges via GPO


    I'm trying to run a script using the GPO Startup option (on the PCs OU) which, as we know, uses the same privileges of a local system account.
    The batch file updates (imports settings through a separate file) a program already present on the PC client (win 10).
    After applied the GPO and restarted the PC client an error message appears asking elevated privileges for this program.

    How can I solve?



    Thanks
      My Computer


  2. Posts : 5,299
    Windows 11 Pro 64-bit
       #2

    Why don't you use Task Scheduler to schedule your script to start at logon with administrative privileges.
      My Computer


  3. Posts : 54
    win 10
    Thread Starter
       #3

    I have tried but the option run as in Computer configuration>preferences>control panel >scheduled task = remain grey ...I am not able to activate it. I couldn't understand why

      My Computer


  4. Posts : 5,299
    Windows 11 Pro 64-bit
       #4

    Don't use GPO use Control Panel > Administrative Tools > Task Scheduler app.
      My Computer


  5. Posts : 54
    win 10
    Thread Starter
       #5

    Sorry I didn't explain it well.... I have to run a batch file to 100 PC on a lab.local domain
      My Computer


  6. Posts : 5,299
    Windows 11 Pro 64-bit
       #6

    Oh okay sorry check out below tutorial.

    "Run a Script or Batch File with Administrative Privileges as Windows Starts"
    Run a Script or Batch File with Administrative Privileges as Windows Starts
      My Computer


  7. Posts : 317
    Microsoft Windows 10 x64
       #7

    Code:
    %SystemRoot%\System32\runas.exe /user:PC-NAME\USERNAME /savecred "%SystemRoot%\System32\cmd.exe"
    Create a shorcut with above (of course replace PC-NAME\USERNAME... who should have administrator rights)
    Replace cmd.exe by your program
    The password will be asked only the first time
      My Computer


  8. Posts : 54
    win 10
    Thread Starter
       #8

    FreeBooter said:
    Oh okay sorry check out below tutorial.

    "Run a Script or Batch File with Administrative Privileges as Windows Starts"
    Run a Script or Batch File with Administrative Privileges as Windows Starts
    Thanks FreeBooter I show this tutorial and I believe I settled well the script property in GPO ...the error I am receiving is related to the admin right ...

    Run a Script with administrative privileges via GPO-run-admin-right.png
      My Computer


  9. Posts : 54
    win 10
    Thread Starter
       #9

    D4ni3l said:
    Code:
    %SystemRoot%\System32\runas.exe /user:PC-NAME\USERNAME /savecred "%SystemRoot%\System32\cmd.exe"
    Create a shorcut with above (of course replace PC-NAME\USERNAME... who should have administrator rights)
    Replace cmd.exe by your program
    The password will be asked only the first time
    I won't be able to use this option as I would like to deploy the script to 100 PCs at once.
      My Computer


  10. Posts : 5,299
    Windows 11 Pro 64-bit
       #10

    Place the batch script in C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup folder its a hidden folder so you have to enable viewing of hidden folders.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:34.
Find Us




Windows 10 Forums