SQL Server 2008 PowerShell
Normal
0
false
false
false
EN-US
X-NONE
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Calibri","sans-serif";}
SQL Server 2008 PowerShell
By : Kasim Wirama, MCDBA, MCITP
PowerShell is next generation
scripting language after MS-DOS. Microsoft supports software products with
PowerShell. PowerShell is built on .NET 2.0 frameworks. It supports all DOS
commands and could run any scripts written in other language. Here are terminology
in PowerShell.
1. CmdLet
Is command name.
Naming convention for CmdLet is verb-noun. For example : get-command
2. Script
PowerShell
extension is ps1. To run PowerShell script, simply specify power shell
scripting file.
3. Pipeline
Is introduced by
| sign, which separates series of commands (cmdlet). Output of current cmdlet
would be input for next cmdlets.
4. Provider
Is type of data
store where user is presented with format similar to file system. For SQL
Server provider, hierarchy SQL Server is in file system format, as you usually
navigate in MS-DOS prompt.
5. Snap-in
Is poweshell
extension, which usually comes in DLL written in .NET programming language.
Usually snap-in consists additional cmdlet or provider.
6. Aliases
is shorter name of cmdlet command.
Powershell
implementasion in SQL Server 2008 is called SQL Server Powershell. Command line
for SQL Server 2008 PowerShell is sqlps. You can type sqlps in DOS-prompt or
right click on any database object in object explorer of SSMS SQL Server 2008.
After you
successfully entered into sqlps provider environment, type dir command then SQL
PowerShell returns 4 items, they are : SQL Server Database Engine, SQL Server
Policy Management, SQL Server Registrations, and SQL Server Data Collection.
All your SQL Server instances are located inside SQL Server Database Engine.
You can navigate into SQL Server Database Engine item, by issuing cd command
(Cd SQL) then press enter. Then you will be presented to your machine. Your SQL
instance are inside your machine name directory, so issue cd <your machine
name> command. Now you are in beginning of your SQL Server instance. It
displays file system hierarchy format, so it’s as convenient as navigating in
DOS file system. Try yourself and tell me your experience in using SQL
PowerShell.