How do I make a script "Run as administrator" on its own?

Hello,
Win 8.1, VB scripts or PowerShell
Having discovered I previously failed to fully study UAC, I now understand why scripts transferred to a new Win 8.1 machine quit working.  They have to be 'Run As Administrator' on the new machine; then they work as before.  While I'm still
a little hazy on UAC, but continuing to study, it seems I'm left with a choice.  Please correct my perception of this choice if it's wrong:
1) I can change my UAC settings (which I actually prefer not to do - I'm a safety guy...)
2) I must always run my scripts by right clicking to the context menu and clicking "Run As Administrator"
3) I learn if there is a way for my script to "Run As Administrator" on its own
Assuming my choices above are correct, I would like to focus on choice 3.
I've done some amount of research, but I'm not sure any of the solutions I saw actually accomplish choice 3.  Most of those posts indicate that the individual still had to enter a password or perform some other interaction after the script ran, so I'm
not sure why the solutions posted were an answer to what was basically the same as my question here.
Can a script be setup to Run As Administrator without requiring any further user interaction?  I'm wondering if this is actually a self-defeating question, because if a script can be setup as such, then wouldn't it bypass the very purpose
UAC was put in place, for protection?  Am I thinking incorrectly?
If it is possible to write the script so it really runs without further interaction, please point me where I might need to study more.
Thanks.
Best Regards,
Alan

Hi jrv,
So, I think we've unofficially become friends since you answered my question in .vbs because you know that's where I've been.  I really am trying to transition to .ps1, but thanks for the thought. :-)  I actually did write a test .ps1 using get-vm
(which is very cool thank you) but wasn't able to execute it other than running a batch file from the context menu selection 'Run As Administrator'.  The following is the operative line I used in the batch file (it doesn't seem like the -Verb runas
worked as I expected it to):
powershell -executionpolicy remotesigned -file C:\batchFiles\ps\vmstatus.ps1 -Verb runas
I am getting a book on Powershell to study.
But, regarding your line above, I think I applied your guidance correctly.  I created a shortcut with the following line in the target box (I'm assuming this is what you were directing me to do. I also assumed I was supposed to add powershell.exe
at the beginning of the line you posted above):
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
start-process cscript C:\batchFiles\vmStatus.vbs -Verb RunAs
Windows seem to add the full path for powershell.exe automatically.  It runs without requiring the context menu selection "Run As Administrator", but it
still brings up the UAC message box for permission to continue, which is what I was trying to address in my initial post when I was speaking to the possible self-defeating nature of my question to allow
a script to bypass UAC.
I'm asking to confirm: having the UAC popup is in fact normal behavior that can't be side stepped unless other steps are taken.  So I guess I need to continue research to understand
what must be done to allow simple double-clicking of a shortcut to get a seamless execution without actually changing UAC.
Regarding STscripter's solution, I experienced the same UAC message box, so this post is also in response to that answer.
Thanks again for your help.
Best Regards,
Alan

Similar Messages

  • Launchd: how to make a script run every weekday?

    I'm trying to make a script run every weekday as a LaunchAgent. Is there a way to do this like you could in cron?
    Here is the relevant portion of my LaunchAgent plist:
    <key>StartCalendarInterval</key>
    <dict>
    <key>Hour</key>
    <integer>9</integer>
    <key>Minute</key>
    <integer>0</integer>
    <key>Weekday</key>
    <integer>3</integer>
    </dict>
    I have tried changing the Weekday integer to 1-5 or 1,2,3,4,5 but neither worked. It only works with a single integer. Do I have to create 5 separate plists for each weekday?
    Any ideas?

    Thanks VK, for others who are looking to do something similar, here is the relevant part of the code to make the command run every day (since that field is missing) at 7:00pm and 7:01pm:
    <key>StartCalendarInterval</key>
    <array>
    <dict>
    <key>Hour</key>
    <integer>19</integer>
    <key>Minute</key>
    <integer>00</integer>
    </dict>
    <dict>
    <key>Hour</key>
    <integer>19</integer>
    <key>Minute</key>
    <integer>01</integer>
    </dict>
    </array>

  • How do I make the plugin run automatically when a photo is imported?

    I am trying to write a new plugin where the metadata will be automatically added to the photo when I import the photo in the Lightroom.
    How do I make the plugin run automatically when a photo is imported?
    Thanks for  your help!
    Regards,
    Prosenjit

    psaha84 wrote:
    What I want is, when I import a photo in Lightroom the plugin will run and assign the metadata.
    As John said, there is no mechanism to receive notification of import. The likely recourse is continuous polling (unless you get very creative..).
    You can try optimizing. e.g.: every second (or less), see if the count has changed, if it's gone up, something's been imported, if not then probably not (check anyway once in a while..).
    psaha84 wrote:
    How do I save the custom metadata with the image file?
    Lightroom 5 has the limitation, plugin  cannot link the custom metadata fields to XMP file or save them with image file.
    So, is there any alternative way to save the custom metadata?
    Yeah: Lightroom won't save custom metadata in xmp, nor read it if it's there, so you are pretty much on your own - you can save in a file, but if you save as non-standard sidecar Lr won't attend to it like it will jpg or xmp sidecar. For that reason it's often better to save in a separate dedicated location. You can save in image file itself, e.g. using exiftool if raw file, but that would make me nervous, and of course you'd have to have the logic to read it somewhere too..
    Good luck,
    Rob

  • How can i make my mac run powerpc applications?

    i want to play my downloaded game n every time i click it it gives me a message saying that power pc appliations arnt supported so i want to if theres a way how i can make y mac run power pc applications?

    Thanks Niel - I've deleted my post as it's obviously wrong. I learn something every day on here

  • How can I make my phone run faster?

    anytime I have to download or upload or search the web it is very very slow .

    ray miranda wrote:
    I have my iMac purchased in 2008 and it is running very slow.  I have a time capsule.  I believe it only has 1 GB of SD Ram.  Will it run faster/better if I increase the Ram?
    YUP!
    How large is you HD and how much space do you have left?
    Care to share which OS you are using?
    How can I make my iMac run faster?

  • How can i make my iphone run faster

    How can I make my iphone 4 run faster?

    ray miranda wrote:
    I have my iMac purchased in 2008 and it is running very slow.  I have a time capsule.  I believe it only has 1 GB of SD Ram.  Will it run faster/better if I increase the Ram?
    YUP!
    How large is you HD and how much space do you have left?
    Care to share which OS you are using?
    How can I make my iMac run faster?

  • I want to make a new computer my "home" computer for itunes. How do I make it the new "system administrator" for home sharing?

    I want to make a new computer my home computer for my itunes library. How do I make it the new 'system administrator' for home sharing?

    Yes, on the right side of the U.K. Apple Store homepage there will be an "Education Store." You can get something like 10% off, it seems.

  • Running Os 9 in its own window

    How do i run Os 9 in its own window when running OS 10.3.9?
    Specifically i'm trying to run one of my favorite old school games. escape velocity. it only works in os9. my computer doesn't have a enough ram to run the game full screen with out having glitches. i think if i run it in a smaller window it will work but i cant figure that out. its not in the os9 prefs on my computer.
    question 2.
    Is it possible to restart my g4 in os9 with out having os10 running? thanks
    G4   Mac OS X (10.3.9)  

    Hi, homeboy.
    How do i run Os 9 in its own window when running OS 10.3.9
    You don't. You run OS 9-based applications in their own windows, and use their preferences to exercise whatever control they offer, which (depending on the application) may or may not allow you to accomplish what you want to accomplish. All hardware and hardware parameters are controlled by OS X whenever it is running, so OS 9 operating as Classic has no ability to create a lower-resolution "virtual machine" window inside OS X. In this respect Classic mode is very diffferent from, say, using Virtual PC to run Windoze on a Mac.
    Booting your Mac in OS 9, if possible, is the solution to your problem. If the machine isn't OS 9-bootable, you're stuck.

  • BPC 10.0 NW - How do I make Business Rules run one Period at a time

    I was wondering if anyone has a way to make business rules run one period at a time before moving on to the next to the next time period (i.e. January 2014 calc prior to moving on to February 2014).  In past SQL this could be achieved with a piece of script *CALC_EACH_PERIOD.  Is there anything like this that can be applied in the NW platform for Business Rules?  I have some logic that I want to run through a package on multiple periods at once.  Part of this logic contains a Business Rule that uses a value from the preceding period.  the Business rule appears to be calculating all time periods selected in the package at once so it is missing the piece that is supposed to come from the prior month unless the package is run one period at a time.  I need the logic to run sequentially by time period (oldest first) when more than one time period is selected.
    thanks,
    Keith

    Hi Vadim,
    Script for the business rule is below, it runs along with the FX_Trans rule in the same package  ( I have also attached a screen shot of the actual Business rule its self)
    *RUN_PROGRAM CALC_ACCOUNT CATEGORY = %CATEGORY_SET% ENTITY = %ENTITY_SET% CURRENCY = USD //GROUPS = %GROUPS_SET% TID_RA = %TIME_SET% //OTHER = [AUDITTRAIL=%AUDITTRAIL_SET%] CALC = CALC_HIST_USD *ENDRUN_PROGRAM
    Thanks, Keith Carlson

  • How can I make a program run in the background?

    I'm working on a custom console program. I plan to have the commands as seperate applications and create a server/client relationship so they can communicate with each other. However whenever I call a command I don't want to have a console window pop up, flicker out, etc. I want it to look like it's one complete app. So I'm wondering how can I have the app run in the background?

    If you're using a unix system, use the "&" argument (or character, what is its name anyway?) at the end of the command line.
    I think you can use javaw in the MS-Windows world.

  • How can i make my mac run like new

    What can I do to make my computer run like when I first bought? Thanks

    I am confused. You posted in the FaceTime for Mac Forum and your profile says iPhone and iOS. So what is you are asking about here that is performing slowly? More details would really help.
    Allan

  • How can i make my macbook run faster again?

    Hey, i own 15 inch macbook pro 2011 that came with snow leopard and i upgraded it to lion but i observed that my computer got slower speacially when i start up i wait much more longer than i used to.I don't have many programs downloaded i mean only 130 gb is used out 500 so, is there anything i can do to make my mac run faster? In addition i am thinking about to make participation with win7 does it affect the speed of my computer negative? Thank you.

    If you have only 4GBs of RAM, this article may help you - https://discussions.apple.com/thread/3238726
    You may need to upgrade the RAM or make changes to the apps you use..  Since your Hard Drive is nicely underutilized and is probably behaving well, that should not be the problem.
    Check to see if you are getting Page Outs and read the article above

  • How can I make my program Run forever?

    I would like to know how can I make my program execute some method while the GUI still open. I have something like this.
      public static void main(String args[]) {
        System.out.println("****************************");
        System.out.println("    PACKET READER CONSOLE   ");
        System.out.println("****************************");
        IPDetector window = new IPDetector(); // IPDetector is the JFrame
        window.setTitle("IPDetector Analyzer");
        window.pack();
        window.show();
        PortListener pl = new PortListener();// Is my portlistener class
        PacketReader c = new PacketReader();
        while(JFrame still open){// I dont know how to put a statemente here
          pl.start();// this method reads from a port and returns a string
          String cc = pl.data;// gets the string from the port listener
          while(!cc.equals("")){
            c.portWriter(cc);// writes the string into a file
      }I want that my portlistener keeps reading all the time, and if is something in the socket information.
    Should I use a thread? Any ideas? thanks.
    Chris

    I still not understanding how to make it thread. My main class is this one IPDetector. and it looks like this.
    public class IPDetector extends JFrame {
      // Declaration of the instance variables
      private static ArrayofDisplay  ad = new ArrayofDisplay();
      private ArrayofCreators database = new ArrayofCreators();
      JLabel sourceLabel;//etc..
      public IPDetector() {
        IPDetectorLayout customLayout = new IPDetectorLayout();
        getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
        getContentPane().setLayout(customLayout);
        sourceLabel = new JLabel("Source IP Add.");
        getContentPane().add(sourceLabel); 
        addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
      // I get confused here...
      private boolean alive; // Do I need to declared here?
      public void setAlive(boolean val) { // This one also?
        alive = val;
      // IPDetector Methods...
      public void displayCaller(ArrayofDisplay aD){  }
      public void setAndReplace(String text)  {    }
      public void refresh(){ }
      public boolean action(Event evt, Object arg){ }
      //etc...
      public static void main(String args[]) {
        System.out.println("***********************************************");
        IPDetector window = new IPDetector();
        window.setTitle("IPDetector");
        window.pack();
        window.show();
        PortListener pl = new PortListener();
        PacketReader c = new PacketReader();
        while (alive) {// Is this correct here?
          pl.start();
          String cc = pl.data;
          while(!cc.equals("")){
            c.portWriter(cc);
            window.refresh();
            cc = "";
    class IPDetectorLayout implements LayoutManager {
      public IPDetectorLayout() {  }
      public void addLayoutComponent(String name, Component comp) {  }
      public void layoutContainer(Container parent) {  }
    }

  • How can I prevent my iPhone from making calls on its own?

    I often put my iPhone in my pocket. Sometimes I then discover that it is making calls on its own.
    How can I prevent this?
    Thanks.

    Turn on auto lock. I have never had my iPhone once do anything without me doing it.

  • How to stop your blackberry curve 9320 from rebooting on its own

    Take a piece of paper and place it on top of the battery(not where its written blackberry) force it to stay still, that will keep it from switching off. Try it n see if it would help you because my phone has not even switched off once on its own since I did that, it might help u 2.

    nyathi wrote:
    Take a piece of paper and place it on top of the battery(not where its written blackberry) force it to stay still, that will keep it from switching off. Try it n see if it would help you because my phone has not even switched off once on its own since I did that, it might help u 2.
    Hi! Thank you for your input. I personally recommend this method as well in certain occasions, but we need to remember that not all issues regarding BlackBerry Curve devices not powering up (specifically 9320's) is an issue  can be rectified by this method. It can be an issue with monitor, a software, battery, faulty hardware etc., that's why we need to probe and not assume that placing a piece of paper is the snake oil for 9320 issues. Although it may help sometimes, let's not assure users that this is the solution to their problem. 
    I saw you across the forum posting the same message. 
    here http://supportforums.blackberry.com/t5/notifications/notifymoderatorpage/message-uid/3030658
    and here:http://supportforums.blackberry.com/t5/notifications/notifymoderatorpage/message-uid/3030654
    Again, thank your for your input. We appreciae your contributions! Cheers!
    Click if you want to Thank someone. If Problem is resolved, so that others can make use of it.

Maybe you are looking for

  • Wipe BBID (lost password / recovery answer Android/iPhone)

    Does anyone know how I can wipe my BBID using windows, I used to have a Blackberry years ago, I've since forgotten my BBID password and I must have typed my security answer wrong back then, I am now using a iPhone and have no ability to wipe my accou

  • My ipad2 is stuck in negative color mode!

    I am new to the iPad world. But my ipad2 is stuck in like the negative color mode whereas everything is in off color. I forgot how to change it back, I know it is something to do with holding a button down. Please help!

  • Customize default folders

    How can I customize the default folder icons Bb curve 8530. OS 5.0.0.654? The default folder choices are very bland and generic. For example I am using the green star folder for my financial apps when a folder with a pile of cash or a bank would be m

  • Help on learning Forms 6i

    Hi everyone !!! I'm a newbie Need help on learning how to build applications using Forms 6i. Any link to a site or guide step by step on converting the typical activities of developer. Thanks.

  • When trying to use the Apple Hardware utility on my iMac, I get a "?"

    When trying to debug issues with the iMac hanging up (rotating color wheel) I tried to run the Apple Hardware utility by restarting when holding down the "D" key. I get a flashing arrow on a filder icon.  Does anyonw know what this means?