Home Forums Programming Powershell Query local SSMS server group with Powershell? RE: Query local SSMS server group with Powershell?

  • You could use the stucture available in SQLPS. Set your location to SQLSERVER:\SQLRegistration\Database Engine Server Group\<your group name> then set a variable equal to get-childitem and do a foreach loop over each server in the group.

    A simple example:

    Set-Location SQLSERVER:\SQLRegistration\Database Engine Server Group\<your group name>

    $servers = get-childitem

    foreach ($server in $server) {<do something herer>}

    MG

    "There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
    Tony Hoare

    "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.