Jump to content

Script to run CMD as Admin


Recommended Posts

Hi

 

i have a script to activate Office 2019 as a bat file, which i which to run through SCCM as a script to execute

please can someone help

cd C:\Program Files\Microsoft Office\Office16\
cscript ospp.vbs /setprt:
cscript ospp.vbs /unpkey:6MWKP >nul
cscript ospp.vbs /inpkey:
cscript ospp.vbs /unpkey: >nul
cscript ospp.vbs /inpkey:
cscript ospp.vbs /sethst:
cscript ospp.vbs /act

i have removed my keys for now

Link to comment
Share on other sites

1 hour ago, Jos said:

What exactly is the AutoIt3 question?
Help with what?

Jos
 

i need to convert it to run in CMD and run as admin automatically and avoid AUC, or for it to auto accept AUC dialog box after its run

Link to comment
Share on other sites

  • Developers

Assume you mean UAC and isn't that what SCCM does for you already when the execution is set the correct way?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

so, if it's a batch file (.bat or /cmd extension) why can't you just set it to run as admin by default by creating a shortcut? right click on the batch file shortcut, choose properties, then click Shortcut tab, then click the Advanced... button, then choose to run as administrator so whenever  it is run it runs as admin by default.

but it is possible to run your batch as admin in AutoIt script. use the RunAs() function. You can read about it in the great Help file that is included with AutoIt

then we can have a look at the UAC UDF on this forum for the other part.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...