Forum Discussion

chrismatt83_115's avatar
chrismatt83_115
Icon for Nimbostratus rankNimbostratus
Mar 25, 2014

Powershell One line Commands

Coud someone help me with the following. I tried searching though the commands and couldn't figure it out. Can patrik or someone else Byw these powershell snapins are awesome. Me and my whole team have been working through the web gui which took forever to get things done and im hoping with powershell we can start automating.

 

What would be the command to force off line (not just disable) all members within a pool (lets assume pool name fab_pool)

 

What would be the command to enable all members within a pool (lets assume pool name fab_pool)

 

The command to force off line one member from a pool (assuming member - fabmember pool name fab_pool)

 

Command force offline a node so that it it will be offline for all pool its a member off.

 

Thanks

 

5 Replies

  • A lot of this work is already done or can be easily modified to do what you're asking, all built into scripts that you can call from the shell. Joe has a ton of articles/scripts listed here in the iControl wiki.

     

  • Not a novice. Need some help. I tried going through those and im not even sure how to run them.

     

    • JRahm's avatar
      JRahm
      Icon for Admin rankAdmin
      gotcha. Yeah, powershell needs a little help to get things moving. To start, you need to change the Set-ExecutionPolicy value to unrestricted unless you sign the scripts in-house. Next, to run one of the powershell scripts, you call it with a .\ScriptName.ps1, or fully qualify it with "C:\my scripts\ScriptName.ps1"
  • Hi Chris!

     

    Try this one:

     

    http://climbi.com/b/1qYEwa

     

    Could do with some additional parameter checks but I need to sleep now. :)

     

    /Patrik

     

  • Note that all pool names, partitions etc are case sensitive. Also, server is specified by the name, not the ip.

    Examples:

    Enable Myserver in the pool Test-Pool under partition Common
    Toogle-Pool-Member -Pool Test-Pool -Partition Common -Members @("Myserver:80") -State Enable
    
    Disable all members in the pool Test-Pool under partition Common
    Toogle-Pool-Member -Pool Test-Pool -Partition Common -All -State Disable
    
    Disable MyServer-01 and Myserver-02 in pool testpool under partition MyPartition
    Toogle-Pool-Member -Pool testpool -Partition MyPartition -Members @("MyServer-01:80", "Myserver-02:80") -State Enable
    

    /Patrik