Stairway to SQL PowerShell Level 9: Objects For Everyone

  • Comments posted to this topic are about the item Stairway to SQL PowerShell Level 9: Objects For Everyone



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

  • Well rounded post:-). The SQL Server Provider and the SQLPS.exe may be mentioned as it simplifies the coding.

    http://hodentekmsss.blogspot.com/2015/04/can-you-use-windows-power-shell-to-find.html

  • Whoa. This is way beyond me. I need to go back to the beginning of the series. Thanks.

  • Though I like the combination of PowerShell and SMO, I still believe many basic stuff, such as create db, table, user etc are better-handled via t-sql.

    I somehow consider PS (with the help of .net) as a command-line equivalent of SSIS platform, where we can have a better logic to manipulate t-sql modules and beyond.

    One area I extremely wish to see in this series is using PS to execute parallel-type of functions, this is very important when handling hundreds or even thousands of sql server instances.

  • Good comments. The series is meant to introduce you to PowerShell and SQL but not to imply that PS and SMO are the replacements for SSMS or TSQL. SMO emits TSQL so there really is no replacement for it. PowerShell in combination with SMO or TSQL is a powerful combination to manage a SQL server.

    As for the parallel execution, I will see what I can do to inject this into the remaining levels.



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

  • Is this code appropriate for 2023? An update would be great.

  • I am happy to update the article.  I will work with the publishers.

    Most of the code will still work as it is, but the way you get the assemblies with Add-Type is different today. But if you import-module dbatools or import-module sqlserver you should be able to execute all the New-Object stuff and do what is there in the code blocks without issue.



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

Viewing 7 posts - 1 through 6 (of 6 total)

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