POWERSHELL SHENANIGANS LATERAL MOVEMENT WITH POWERSHELL KIERAN JACOBSEN READIFY.
James Boother Email: [email protected] Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH...
-
date post
19-Dec-2015 -
Category
Documents
-
view
217 -
download
0
Transcript of James Boother Email: [email protected] Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH...
![Page 1: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/1.jpg)
James Boother
Email: [email protected]
Twitter: @jimmyboo
Blog: http://www.boother.co.uk
AUTOMATING ADMIN TASKS WITH POWERSHELL
![Page 2: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/2.jpg)
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
![Page 3: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/3.jpg)
IN THE BEGINNING…
![Page 4: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/4.jpg)
AFTER YEARS OF RESEARCH POSH WAS BORN
![Page 5: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/5.jpg)
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
![Page 6: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/6.jpg)
WHAT’S NEW IN VERSION 2?• PowerShell ISE – pre-installed on every Windows 7 & Server 2008 R2 machine
• Remoting
• Background Jobs
• Transactions
• Modules
• Eventing
![Page 7: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/7.jpg)
WHAT IT WON’T DO• It won’t make the tea…
![Page 8: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/8.jpg)
DEMO - VISUAL SCRIPTING ENVIRONMENT
![Page 9: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/9.jpg)
DEMO – WMI SCRIPT• Full access to WMI from within Powershell:
![Page 10: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/10.jpg)
DELETING OLD BACKUP FILES
![Page 11: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/11.jpg)
DEMO - FINDING FAILED SQL JOBS
![Page 12: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/12.jpg)
SCHEDULING SCRIPTS• SQL Server Agent or windows Task Scheduler
![Page 13: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/13.jpg)
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:
![Page 14: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/14.jpg)
DEMO – HELP SERVER DOWN!
![Page 15: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/15.jpg)
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
![Page 16: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/16.jpg)
BOOKS
![Page 17: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/17.jpg)
QUESTIONS• If you have any questions now’s your chance…
![Page 18: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/18.jpg)
THANK YOU• Thank you for attending Automating admin tasks with PowerShell
• if you have any further questions please see my contact details here:
• Email: [email protected]
• Twitter: @jimmyboo
• Blog: http://www.boother.co.uk
• Enjoy the rest of the day, happy scripting!
![Page 19: James Boother Email: james@boother.co.uk Twitter: @jimmyboo Blog: AUTOMATING ADMIN TASKS WITH POWERSHELL.](https://reader035.fdocuments.in/reader035/viewer/2022062320/56649d395503460f94a13e18/html5/thumbnails/19.jpg)
Coming up…P/X001How to Get Full Access to a Database Backup in 3 Minutes or LessIderaP/L001How to Monitor your SQL ServersRed GateP/L002SQL Server Expert Lunchtime Quiz : Major Myths About Microsoft SQL Server Quest P/L005Expert Query Analysis with SQL SentrySQLSentryP/T007Attunity Change Data Capture for SSIS Attunity
#SQLBITS