Find Virtual Machine Information using PowerShell Script

March 14, 2023 By JeffTechs

I think it’s safe to say; I’m a big fan of PowerShell. However, when checking Azure resources, it can be a lot quicker to use the portal/GUI–unless you’ve got the commands already cached in your shell. Also, there isn’t a great way to lookup a virtual machine’s subscription if you’re working in a different one. So, I took it upon myself to write a script that reflected the ease of use with the GUI, but combined the advanced features of Azure PowerShell lookups.

A note about this script: To make the input and access as easy as possible, it will cycle through all tenant subscriptions and virtual machines to identify a match. If you have 300, 400, 500 or more machines, it could take awhile to run. If you have a single subscription in your tenant, you could modify the script to make it run faster.

Here’s the link to the GitHub repo and Happy Administering.