Deploy Script To SQL Databases using Powershell

  • Hello all.
    I am new to powershell and have a question. Is there a way to deploy sql scripts to all the databases that are in a registered server in the central management list on sql?  I would like to avoid looping thru a list of databases and have the script run on all of them simultaneously like it would if i used the multi script tool. 

    Also, i have a ps script that i think should give me the servers in my Central Management group but it comes up with nothing even though i have servers registered. Any help would be greatly appreciated.

    I am using a remote powershell connection to my support server when running the below.

    #import SQL Server module
    Import-Module SQLPS -DisableNameChecking
    Set-Location "SQLSERVER:\SQLRegistration\Central Management Server Group"
    Get-ChildItem

    this returns nothing.

  • Hi
    Please try the modification made in your script in RED.

    #import SQL Server module
    Import-Module SQLPS -DisableNameChecking
    Set-Location "SQLSERVER:\SQLRegistration\Central Management Server Group\<<CentralManagementSQLServerMame>>"
    Get-ChildItem

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply