PowerShell for SQL Server Essentials
eBook - ePub

PowerShell for SQL Server Essentials

Donabel Santos

Share book
  1. 186 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

PowerShell for SQL Server Essentials

Donabel Santos

Book details
Book preview
Table of contents
Citations

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is PowerShell for SQL Server Essentials an online PDF/ePUB?
Yes, you can access PowerShell for SQL Server Essentials by Donabel Santos in PDF and/or ePUB format, as well as other popular books in Computer Science & Entreprise Applications. We have over one million books available in our catalogue for you to explore.

Information

PowerShell for SQL Server Essentials


Table of Contents

PowerShell for SQL Server Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Instant updates on new Packt books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with PowerShell
A brief history of PowerShell
The PowerShell environment
The PowerShell console
The PowerShell ISE
Running PowerShell as an administrator
The execution policy
PowerShell versions
PowerShell cmdlets
Cmdlet naming convention
Cmdlet parameters
Cmdlet aliases
PowerShell providers
Snap-ins and modules
PowerShell Pipeline
Scripting basics
Running PowerShell scripts
Getting help
Getting help from other cmdlets
Summary
2. Using PowerShell with SQL Server
SQL Server via PowerShell
Mini-shell (or the sqlps utility)
The SQLPS module
SQL Server snap-ins
SQL Server assemblies
SQL Server-specific cmdlets
SQL Server Management Objects
Creating SMO objects
Summary
3. Profiling and Configuring SQL Server
Current server resources
Getting processor (CPU) information
Checking server memory
Checking disk space
Checking network settings
Hotfixes and service packs
Current SQL Server instances
Services and service accounts
SQL Server error logs
Current instance configuration
Changing configurations
Start or stop services
Changing a service account
Changing instance settings
Summary
4. Basic SQL Server Administration
Listing databases and tables
Listing database files and filegroups
Adding files and filegroups
Listing the processes
Checking enabled features
Scripting database objects
Attaching and detaching databases
Detaching databases
Backing up and restoring databases
Backing up
Restoring
Reorganizing or rebuilding indexes
Managing logins, users, and permissions
Permissions
Adding a login
Adding database users
Policies
Managing jobs
Summary
5. Querying SQL Server with PowerShell
To PowerShell or not to PowerShell
Sending queries to SQL Server
SQL Server Management Objects
The Invoke-Sqlcmd cmdlet
ADO.NET
The Invoke-Expression cmdlet
Sending simple queries to SQL Server – different variations
Fixing orphaned users
Getting fragmentation data
Backing up and restoring databases
Exporting data using bcp
Summary
6. Monitoring and Automating SQL Server
Getting to know helpful cmdlets
The Send-MailMessage cmdlet
The ConvertTo-Html cmdlet
The Export-Csv cmdlet
The Write-EventLog cmdlet
Additional cmdlets
Scheduling PowerShell scripts
Checking logs
Monitoring failed jobs
Alerting on disk space usage
Logging blocked processes
Getting performance metrics
Summary
A. Implementing Reusability with Functions and Modules
Functions
Simple functions
Advanced functions
Best practices
Modules
Script modules
Summary
Index

PowerShell for SQL Server Essentials

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: February 2015
Production reference: 1200215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-149-2
www.packtpub.com
2323__perlego__chapter_divider...

Table of contents