Martin Bell SQL Server MVP Blog:
Windows PowerShell is a powerful scripting shell The Windows PowerShell language supports more complex logic than Transact-SQL scripts
The SQL Server provider enables a simple navigation mechanism similar to file system paths A set of SQL Server cmdlets SQLPS is a closed mini-shell
The sqlps utility that is used to run Windows PowerShell sessions that include the SQL Server snap-ins
cmdlet Canonical alias cmd aliasUNIX shell aliasDescription Get-Locationglpwd Gets the current node. Set-Locationslcd, chdir Changes the current node. Get-ChildItemgcidirls Lists the objects stored at the current node. Get-Itemgi Returns the properties of the current item. Move-ItemmimovemvMoves an object. Rename-ItemrnirnrenRenames an object. Remove-Itemridel, rdrm, rmdirRemoves an object.
cmdletDescription Invoke-Sqlcmd Runs a script containing the languages and commands supported by the SQL Server sqlcmd utility i.e.T-SQL or XQuery syntax. Invoke- PolicyEvaluation Invoke-PolicyEvaluation applies/reconfigures policy-based management policies. Encode-SqlName Reformats a SQL Server identifier into a representation that will work in Windows PowerShell. Decode-SqlName Converts an encoded SQL Server identifier back to the original identifier. Convert- UrnToPath Converts SMO URN strings to a Windows PowerShell path.
For SQLPS install the SQL Server 2008 client components to run SQL Server features for Windows PowerShell The SQL Server provider for Windows PowerShell can connect to instances of SQL Server 2008, SQL Server 2005 (SP2 or later), or SQL Server 2000 (SP4). Some functionality is limited on SQL Server 2005 and SQL Server 2000
Manage SQL Server instances Manage Policies, Start Services... Manage Databases Backup, Create, Change Delete... Manage Jobs Use SMO, WMI...
Finding your way around SQLPS
Quest- PowerGUI and Scripts Idera – Free Powershell Scripts Tools/PowerShell-scripts/ SQLPSX - SQL Server Books Online Powershell Owners Manual nter/topics/winpsh/manual/start.mspx
Martin Bell’s Blog - Bill Ramos’ Blog - Carpe Datum – Buck Woody’s Blog - Allen White’s Blog - Michiel Wories WebLog – And…