Jump to content
  • 0

Get the status of virtual desktop

peizhi yu


I get the list of virtual desktop use following command

Get-BrokerMachine | select HostedMachineName


Then, I want to use traversal to get the status of virtual desktop

foreach($item in $HostName){
(Get-BrokerMachine -HostedMachineName $item).RegistrationState

But, It's don't have any out.

What do I do?

Link to comment

5 answers to this question

Recommended Posts

  • 0
8 minutes ago, Kasper Johansen1709159522 said:



You are telling PowerShell to only show the output from the HosteMachineName property, it basically ignores any other properties.


You might want to try this instead:
Get-BrokerMachine | select HostedMachineName,RegistrationState

It outputs the VDA hostname and registration state.

I see.


but I want to use a traversal, becase I want to write a monitor script to monitoring the status of the virtual desktop.


I can inquire the status of virutal desktop use the virtual desktop name.



Link to comment
  • 0
3 minutes ago, Kasper Johansen1709159522 said:

Well then, try this instead :)

$Hostname = (Get-BrokerMachine).HostedMachineName
foreach($item in $HostName){
(Get-BrokerMachine -HostedMachineName $item).RegistrationState

It's Working. Thanks your help!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...