1 / 19

Automating admin tasks with Powershell

Dive into the world of PowerShell automation with this insightful session. Learn about PowerShell cmdlets, scheduling scripts, and automating SQL Server admin tasks effortlessly. Get ready to enhance your scripting skills!

wagstaff
Download Presentation

Automating admin tasks with Powershell

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Automating admin tasks with Powershell James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: http://www.boother.co.uk

  2. Agenda • A brief history lesson • What’s new in 2.0? • Quick look at Cmdlets • What it won’t do • Example admin tasks automated with PowerShell • SQL Server specific admin tasks automated with PowerShell • Scheduling Scripts • Resources

  3. In the beginning…

  4. After years of research POSH was born

  5. cmdlets • Main building block of PowerShell Scripts • Mini Commands that perform one action • Common naming convention: Verb then Noun • e.g.: Get-Help, Get-Object, Remove-Item –Destructive CmdLets have –WhatIf parameter • Actually .NET Classes that can easily be created if new functionality is required • The output of one Cmdlet can be piped into further cmdlets using the | operator • Equality test with expressions such as –eq –lt –le

  6. What’s new in version 2? • PowerShell ISE – pre-installed on every Windows 7 & Server 2008 R2 machine • Remoting • Background Jobs • Transactions • Modules • Eventing

  7. What it won’t do • It won’t make the tea…

  8. Demo - Visual Scripting environment

  9. Demo – WMI Script • Full access to WMI from within Powershell:

  10. Deleting old backup files

  11. DEMO - Finding failed SQL jobs

  12. Scheduling Scripts • SQL Server Agent or windows Task Scheduler

  13. SQL Server Provider • Open PowerShell from within SQL Server Management Studio • Open SQLPS • Cmdlets and a Provider are provided: • Also instantiate the SQL Server SMO Objects:

  14. Demo – help server down!

  15. Summary • Powerful object based scripting engine • Backwards compatible so you can start from what you already know • Full access to File System; Registry; WMI; COM; .NET Objects and SQL Server • Simple to schedule using Windows Scheduled Tasks or SQL Jobs • Extensible through .NET

  16. Books

  17. Questions • If you have any questions now’s your chance…

  18. Thank you • Thank you for attending Automating admin tasks with PowerShell • if you have any further questions please see my contact details here: • Email: james@boother.co.uk • Twitter: @jimmyboo • Blog: http://www.boother.co.uk • Enjoy the rest of the day, happy scripting!

  19. P/X001 How to Get Full Access to a Database Backup in 3 Minutes or Less Idera P/L001 How to Monitor your SQL Servers Red Gate P/L002 SQL Server Expert Lunchtime Quiz : Major Myths About Microsoft SQL Server Quest P/L005 Expert Query Analysis with SQL Sentry SQLSentry P/T007 Attunity Change Data Capture for SSIS Attunity Coming up… #SQLBITS

More Related