Get List of Azure VM's that have web services running on them, using powershell script.

Sameer Bhat 126 Reputation points Microsoft Employee
2021-10-27T10:53:21.543+00:00

Hi Team,

I need to get list of all azure vm's that have web services running on them using the PowerShell script.

Thanks,
Sameer

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,035 questions
Azure VMware Solution
Azure VMware Solution
An Azure service that runs native VMware workloads on Azure.
392 questions
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 39,926 Reputation points
    2021-10-28T11:51:11.32+00:00

    Hi @Sameer Bhat ,

    Get-VM command will output a list of virtual machines and their current state to the Windows PowerShell console.

    You can get the command from this Microsoft blog.

    Get a List of Virtual Machines by Using PowerShell
    https://devblogs.microsoft.com/scripting/get-a-list-of-virtual-machines-by-using-powershell/
    --------
    --If the reply is helpful, please Upvote and Accept it as an answer--

    1 person found this answer helpful.

  2. Praveen Prabhakaran 546 Reputation points Microsoft Employee
    2021-12-03T03:37:31.773+00:00

    @Sameer Bhat

    To get any service that is running inside the VM we can use Get-Service from OS. there is no Azure PS commands to query a guest OS service. you can use the Run command option to query the same without logging in to the VMs but you cannot do this for bulk VMs are its a manual process. Recommendation is to add tags to the VMs as soon as you create VM initially so that it will be easy to query with azure ps commands or you have to use any 3rd part software which will monitor service in your environment and query it.

    Please 'Accept as answer' if the provided information is helpful, so that it can help others in the community looking for help on similar topics.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.