次の方法で共有


Get Primary and Failover MS List for Agent

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

Comments

  • Anonymous
    January 01, 2003
    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

  • Anonymous
    January 01, 2003
    @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