Download presentation
Presentation is loading. Please wait.
1
Martin Bell SQL Server MVP Email: Martin.Bell@BTInternet.comMartin.Bell@BTInternet.com Blog: http://sqlblogcasts.com/blogs/martinbell/http://sqlblogcasts.com/blogs/martinbell/
2
Windows PowerShell is a powerful scripting shell The Windows PowerShell language supports more complex logic than Transact-SQL scripts
3
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
4
The sqlps utility that is used to run Windows PowerShell sessions that include the SQL Server snap-ins
5
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.
6
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.
7
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
8
Manage SQL Server instances Manage Policies, Start Services... Manage Databases Backup, Create, Change Delete... Manage Jobs Use SMO, WMI...
9
Finding your way around SQLPS
10
Quest- PowerGUI and Scripts http://www.quest.com/powershell/ Idera – Free Powershell Scripts www.idera.com/Products/Free- Tools/PowerShell-scripts/ SQLPSX - http://sqlpsx.codeplex.com/ SQL Server Books Online - http://go.microsoft.com/fwlink/?LinkId=115 604 Powershell Owners Manual http://www.microsoft.com/technet/scriptce nter/topics/winpsh/manual/start.mspx
11
Martin Bell’s Blog - http://sqlblogcasts.com/blogs/martinbell/ Bill Ramos’ Blog - http://blogs.msdn.com/billramo/default.aspx Carpe Datum – Buck Woody’s Blog - http://blogs.msdn.com/buckwoody/ Allen White’s Blog - http://sqlblog.com/blogs/allen_white Michiel Wories WebLog – http://blogs.msdn.com/mwories/default.aspx And…
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.