SQL Diagnostic Manager PowerShell integration allows you to make mass changes to your SQL Diagnostic Manager configuration across multiple SQL Server instances in a few lines of text, saving you time.
About PowerShell
Microsoft® Windows® PowerShell is a task-based command-line shell and scripting language designed especially for system administration. Built on the .NET Framework, Microsoft® Windows® PowerShell helps IT professionals and power users control and automate the administration of the Windows operating system and applications that run on Windows.
Windows PowerShell furnishes an operating environment for commands that include cmdlets, functions, filters, scripts, aliases, and executables (applications). The main command type used in this environment is the cmdlet, with certain cmdlets made available only through Windows PowerShell providers that allow access to stored data.
Windows PowerShell operates within a hosting application (the default is powershell.exe
) that exposes a command line to the user, and uses a host interface to communicate with the commands invoked by the command line. You can use a console application, Windows application, or a Web application as the hosting application. In most cases, the hosting application uses its Main function to interact with the Windows PowerShell runtime through the internal host interface; however, a hosting application can optionally support its own custom host by implementing the PSHost class along with one or more related user interface classes. Together, these classes allow direct communication between the application and Windows PowerShell commands.
For more information about Windows PowerShell, see SQL Server Books Online.
Install the SQL Diagnostic Manager provider for PowerShell
The SQLDM Provider is installed automatically with SQL Diagnostic Manager. To use SQL Diagnostic Manager snapin, you have to enable the provider and register the SQLDM drive.
PowerShell 3.0 or higher is required to use the PowerShell snap-in.
To enable the provider, type the following within PowerShell:
add-pssnapin sqldmsnapin
To verify your snapin is registered:
get-psprovider
To register the SQLdm drive, type the following within PowerShell:
New-SQLdmDrive dm [Server] [Repository]
For example:
New-SQLdmDrive dm PUL-FF-W2K8X64S\SQL2012_BI SQLdmRepository
Creates a new SQL Diagnostic Manager drive called 'dm' that is connected to the SQLdmRepository
database on the PUL-FF-W2K8X64S\SQL2012_BI
SQL Server using Windows Authentication.
PowerShell help
To receive general help, type the following within PowerShell:
get-help
To display a list of cmdlets for the SQL Diagnostic Manager snapin:
get-help sqldm
Applications available to use with PowerShell
There are several applications that allow you to use PowerShell and enhance its functionality.
PowerShell Plus is a powerful interactive scripting environment designed to help administrators and developers learn and master Windows PowerShell. Unlike most of the basic script editors on the market today, PowerShell Plus features a powerful interactive console, an advanced script editor and a comprehensive learning center. PowerShell Plus is built on the backbone of PowerShellIDE, the first PowerShell application to offer a very rich graphical user interface.
Interactive PowerShell Console
The PowerShellPlus Console allows you to work interactively with PowerShell from a feature rich Windows UI. This integration makes working with PowerShell faster and easier to use than ever before.
Advanced Script Editor
The advanced debugger and script editor lets you build and test complex PowerShell scripts, try one line PowerShell commands from an embedded console window, and sign your script with a security certificate, all from a single workspace.
Comprehensive Learning Center
The Comprehensive Learning Center helps you experience PowerShell by example. Short tutorials guide you through basic concepts at your own pace. The Comprehensive Learning Center also includes dynamically created help topics from currently installed PowerShell CmdLets.