How to run a command line within a elevated cmd.exe launched by a VBScript. RRS feed

  • Question

  • I am looking for some assistance on how to create a Vb Script to run a command line within an elevated command prompt and that would prompt the administrator to log in using his credentials to run the commands. (If the user does not have the admin privileges). For instance, let's say I wanted to run this script below on a users machine. How would I go about opening this within an elevated command prompt using a VB script?

      Broken SCCM client

    ·         Open an elevated command prompt

    ipconfig /flushdns

     nbtstat –R
     arp –d
    ipconfig /registerdns

    net stop winmgmt and answer Y when prompted

    winmgmt /salvagerepository

    net start winmgmt

    • Moved by Bill_Stewart Wednesday, September 4, 2019 6:03 PM Unanswerable drive-by question
    Tuesday, February 26, 2019 4:34 AM

All replies

  • IPCONFIG does not require elevation.

    Winmgmt can only be run by opening an elevated command prompt.

    There is no point in using VBScript to run this.  It is a batch file that requires elevation.  If it was VBScript it would still require that you start an elevated session to run it.  There is no way to bypass UAC.


    Tuesday, February 26, 2019 5:50 AM