Command Shell Examples
Useful SQL Queries
Get Primary and Failover MS List for Agent - Jonathan Almquist on Operations Manager - Site Home - TechNet Blogs

Get Primary and Failover MS List for Agent

Get Primary and Failover MS List for Agent

Rate This
  • Comments 2

get-agent | where {$_.name -match "[computer name]"} | select @{name="Primary";expression={$_.getPrimaryManagementServer().name}}, @{name="FailoverList";expression={$_.getFailoverManagementServers() | foreach-object {$_.name}}} | fl

 

command shell main menu

What do you think about this post?
Leave a Comment
  • Post
What others have said about this post...
Comments
  • Great post,

    Very interesting to the PowerShell newbie!

    Question: Why is it that I get the following output:

    Primary      : @{Name=mtl-hq-m30.<domain>}

    FailoverList : {mtl-hq-m25.<domain>, mtl-hq-m24.<domain>}

    Notice the extra "@{Name=" at the beginning of the Primary output, whereas it should be "{"?

    Also, I would recommend using the full name for cmdlets (& parameters) and not their aliases/shortcuts when posting examples (or scripting), as they are typically self-documenting.

    Thanks,

    Larry

  • @Larry - I modified the script slightly to take "Name" out of the Primary results.  I probably got lazy on that one.  Thanks for pointing it out.

    -Jonathan

Page 1 of 1 (2 items)