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.