If you ever need to flatten out groups which may include nested local and AD groups there’s a really easy way to do this in the System.DirectoryServices.AccountManagement.GroupPrincipal GetMembers method. Here’s some PowerShell code which works against both local and AD groups. The code can easily be adapted into a function and in fact I’m using…
Continue Reading »
I was recently asked a question on restoring a database using PowerShell with the following requirements Take a database backup file i.e. DatabaseName.bak Derive the database name from the backup file name Disconnect any user connected to the database Relocate (move) the physical files to SQL Serve r instance the default data and log directories…
Continue Reading »
We’ve released a minor update to SQLPSX which includes includes several bug fixes/enhancements as well as one new module. Here’s an excerpt from the release notes: Added MySQLLib Module Mike Shepard created a MySQL module for querying MySQL databases. This is similar in concept to the adolib and OracleClient modules. Modified adolib Module Changed SQLBulkCopy…
Continue Reading »
This post is my contribution to T-SQL Tuesday, hosted this month by Pat Wright (blog | twitter). In my previous post Importing and Exporting SSIS Packages Using PowerShell I showed you how to import/export SSIS stored in MSDB to and from the file system. In this post we’ll look at exporting all SSIS packages from…
Continue Reading »
SQL Server PowerShell Extensions (SQLPSX) includes a set of function for working with SSIS which among other things allow you to import and export SSIS packages between the file system and msdb. The functionality is best illustrated by looking a few examples. Creating an SSIS folder Note: The SSIS module supports SQL 2005 through 2008…
Continue Reading »
I presented a one hour session at SQL Saturday #62 in Tampa on SQL Server PowerShell Extensions (SQLPSX): “In this sesssion we will look at how the CodeProject SQLPSX can be used for real world PowerShell automation. Specific topics covered include using ADO.NET, retrieving SQL Server information, SSIS administration, Policy-Based Management and SQLIse a WPF-based…
Continue Reading »
The best new management feature added to SQL Server 2008 is Policy Based Management or PBM. PBM allows DBAs to automate many of the traditional daily (or more frequent) checklists*. Although PBM is useable out-of-box there are several key features missing: Unable to capture results of policy evaluations against downward-level versions (2000 and 2005). The…
Continue Reading »
We’ve released a minor update to SQLPSX which includes several bug fixes as well as two new modules. Here’s an excerpt from the release notes: Added PerfCounters Module The PerfCounters module contributed by Laerte Junior (blog|twitter), is used for working with Windows Performance Counters, collecting and importing into a SQL Server table. Checkout Laerte’s Simple-Talk…
Continue Reading »
As part of the 2.3 build of SQLPSX I built an MSI based installer to package all 10 SQLPSX modules. The installer was created with Windows XML Installer (Wix). To build an MSI using Wix you manually edit XML files and run several command-line tool to generate the necessary files. Note if you’re a Visual…
Continue Reading »
Just in time for PASS Summit 2010, the CodePlex project SQL Server PowerShell Extensions (SQLPSX) has been updated . Here’s a rundown of what’s new in release 2.3… Added MSI-based installer The installer was built using the Windows Installer XML (WiX) and this was an exercise in learning WiX. I hope to blog about building…
Continue Reading »