Run elevated powershell command from bashHow to determine if a bash variable is empty?When ran as a scheduled...

When was drinking water recognized as crucial in marathon running?

What am I? I am in theaters and computer programs

Why doesn't Object.keys return a keyof type in TypeScript?

What is a term for a function that when called repeatedly, has the same effect as calling once?

Why is it "take a leak?"

Is 長 in Japanese related to “naga” in Thai and Sanskrit?

What Does the Heart In Gyms Mean?

Pure Functions: Does "No Side Effects" Imply "Always Same Output, Given Same Input"?

Non-Italian European mafias in USA?

Dystopian novel where telepathic humans live under a dome

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

lead or lag function to get several values, not just the nth

What is this waxed root vegetable?

Plagiarism of code by other PhD student

Six real numbers so that product of any five is the sixth one

Canadian citizen, on US no-fly list. What can I do in order to be allowed on flights which go through US airspace?

Is it possible to make a clamp function shorter than a ternary in JS?

How can I be pwned if I'm not registered on the compromised site?

What happened to QGIS 2.x LTR?

How to mitigate "bandwagon attacking" from players?

Citing contemporaneous (interlaced?) preprints

At what level can a party fight a mimic?

How do you say "powers of ten"?

If nine coins are tossed, what is the probability that the number of heads is even?



Run elevated powershell command from bash


How to determine if a bash variable is empty?When ran as a scheduled task, cannot save an Excel workbook when using Excel.Application COM object in PowerShellRun an interactive bash subshell with initial commands without returning to the (“super”) shell immediatelyWhy powershell runs executables in separate window?How can I run an elevated powershell script as part of VMWare Customization Specification?Run Elevated Powershell prompt from command-lineWindows client powershell reportingHow to obtain IP Address of Windows 2008 R2 VM on Hyper-V with PowerShell?Run SCHTasks command against a list of servers via PowerShellHyper-V Powershell - Resume-VMReplication object not found













0















I'm kind of just being lazy here but I'm sure I'm not the only person trying to do something like this.



I'm using bash on Windows to SSH into Linux VMs in hyper-v on my local machine and I'm not giving the VMs static IPs. I want to run the following powershell command from bash:



Get-VM | Select-Object -ExpandProperty NetworkAdapters | Select-Object VMName,IPAddresses



This works in powershell if I run it as admin and shows me the IPs hyper-v assigned to each VM. I can call powershell.exe from bash but I get an error saying I don't have the required permission to complete the task.



Anybody know how to run an elevated powershell command from bash?
My ultimate goal is to do everything within the same bash window.









share







New contributor




Mike is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I'm kind of just being lazy here but I'm sure I'm not the only person trying to do something like this.



    I'm using bash on Windows to SSH into Linux VMs in hyper-v on my local machine and I'm not giving the VMs static IPs. I want to run the following powershell command from bash:



    Get-VM | Select-Object -ExpandProperty NetworkAdapters | Select-Object VMName,IPAddresses



    This works in powershell if I run it as admin and shows me the IPs hyper-v assigned to each VM. I can call powershell.exe from bash but I get an error saying I don't have the required permission to complete the task.



    Anybody know how to run an elevated powershell command from bash?
    My ultimate goal is to do everything within the same bash window.









    share







    New contributor




    Mike is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I'm kind of just being lazy here but I'm sure I'm not the only person trying to do something like this.



      I'm using bash on Windows to SSH into Linux VMs in hyper-v on my local machine and I'm not giving the VMs static IPs. I want to run the following powershell command from bash:



      Get-VM | Select-Object -ExpandProperty NetworkAdapters | Select-Object VMName,IPAddresses



      This works in powershell if I run it as admin and shows me the IPs hyper-v assigned to each VM. I can call powershell.exe from bash but I get an error saying I don't have the required permission to complete the task.



      Anybody know how to run an elevated powershell command from bash?
      My ultimate goal is to do everything within the same bash window.









      share







      New contributor




      Mike is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm kind of just being lazy here but I'm sure I'm not the only person trying to do something like this.



      I'm using bash on Windows to SSH into Linux VMs in hyper-v on my local machine and I'm not giving the VMs static IPs. I want to run the following powershell command from bash:



      Get-VM | Select-Object -ExpandProperty NetworkAdapters | Select-Object VMName,IPAddresses



      This works in powershell if I run it as admin and shows me the IPs hyper-v assigned to each VM. I can call powershell.exe from bash but I get an error saying I don't have the required permission to complete the task.



      Anybody know how to run an elevated powershell command from bash?
      My ultimate goal is to do everything within the same bash window.







      powershell bash





      share







      New contributor




      Mike is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Mike is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Mike is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 mins ago









      MikeMike

      1




      1




      New contributor




      Mike is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Mike is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Mike is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Mike is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f956941%2frun-elevated-powershell-command-from-bash%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Mike is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Mike is a new contributor. Be nice, and check out our Code of Conduct.













          Mike is a new contributor. Be nice, and check out our Code of Conduct.












          Mike is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f956941%2frun-elevated-powershell-command-from-bash%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

          Список ссавців Італії Природоохоронні статуси | Список |...

          Українські прізвища Зміст Історичні відомості |...