O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SQL Server 2014 with PowerShell v5 Cookbook

Book Description

Over 150 real-world recipes to simplify database management, automate repetitive tasks, and enhance your productivity

About This Book

  • This book helps you build a strong foundation to get you comfortable using PowerShell with SQL Server, empowering you to create more complex scripts for your day-to-day job
  • The book provides numerous guidelines, tips, and explanations on how and when to use PowerShell cmdlets, WMI, SMO, .NET classes, or other components
  • It offers easy-to-follow, practical recipes to help you get the most out of SQL Server and PowerShell

Who This Book Is For

If you are a SQL Server database professional (DBA, developer, or BI developer) who wants to use PowerShell to automate, integrate, and simplify database tasks, this books is for you. Prior knowledge of scripting would be helpful, but it is not necessary.

What You Will Learn

  • Explore database objects and execute queries on multiple servers
  • Manage and monitor the running of SQL Server services and accounts
  • Back up and restore databases
  • Create an inventory of database properties and server configuration settings
  • Maintain permissions and security for users
  • Work with CLR assemblies, XML, and BLOB objects in SQL
  • Manage and deploy SSIS packages and SSRS reports

In Detail

PowerShell can be leveraged when automating and streamlining SQL Server tasks. PowerShell comes with a rich set of cmdlets, and integrates tightly with the .NET framework. Its scripting capabilities are robust and flexible, allowing you to simplify automation and integration across different Microsoft applications and components.

The book starts with an introduction to the new features in SQL Server 2014 and PowerShell v5 and the installation of SQL Server. You will learn about basic SQL Server administration tasks and then get to know about some security-related topics such as the authentication mode and assigning permissions. Moving on, you will explore different methods to back up and restore your databases and perform advanced administration tasks such as working with Policies, Filetables, and SQL audits. The next part of the book covers more advanced HADR tasks such as log shipping and data mirroring, and then shows you how to develop your server to work with BLOB, XML, and JSON.

Following on from that, you will learn about SQL Server's BI stack, which includes SSRS reports, the SSIS package, and the SSAS cmdlet and database. Snippets not specific to SQL Server will help you perform tasks quickly on SQL servers. Towards the end of the book, you will find some useful information, which includes a PowerShell tutorial for novice users, some commonly-used PowerShell and SQL Server syntax, and a few online resources. Finally, you will create your own SQL Server Sandbox VMs. All these concepts will help you to efficiently manage your administration tasks.

Style and approach

SQL Server 2014 with PowerShell v5 Cookbook is an example-focused book that provides step-by-step instructions on how to accomplish specific SQL Server tasks using PowerShell. Each recipe is followed by an analysis of the steps or design decisions taken and additional information about the task at hand. Working scripts are provided for all examples so that you can dive in right away.

You can read this book sequentially by chapter or you can pick and choose which topics you need right away.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. SQL Server 2014 with PowerShell v5 Cookbook
    1. Table of Contents
    2. SQL Server 2014 with PowerShell v5 Cookbook
    3. Credits
    4. About the Author
    5. Acknowledgments
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
        3. Instant updates on new Packt books
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    9. 1. Getting Started with SQL Server and PowerShell
      1. Introduction
        1. Working with SQL Server and PowerShell
          1. Running as an administrator
          2. Execution Policy
          3. Running scripts
          4. Running different PowerShell versions
          5. Line continuation
          6. PowerShell modules
      2. Working with the sample code
        1. How to do it...
        2. See also
      3. Installing SQL Server using PowerShell
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Installing SQL Server Management Objects
        1. Getting ready
        2. How to do it...
        3. There's more...
      5. Loading SMO assemblies
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Exploring the SQL Server PowerShell hierarchy
        1. Getting ready
        2. How to do it...
        3. How it works...
      7. Discovering SQL-related cmdlets and modules
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Creating a SQL Server Instance Object
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      9. Exploring SMO Server Objects
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    10. 2. SQL Server and PowerShell Basic Tasks
      1. Introduction
      2. Listing SQL Server instances
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Discovering SQL Server services
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Starting/stopping SQL Server services
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Listing SQL Server configuration settings
        1. How to do it...
        2. How it works...
        3. There's more...
      6. Changing SQL Server Instance configurations
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Searching for database objects
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      8. Scripting SQL Server Stored Procedures
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Creating a database
        1. Getting ready
        2. How to do it...
        3. How it works...
      10. Altering database properties
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      11. Dropping a database
        1. Getting ready
        2. How to do it...
        3. How it works...
      12. Changing database owner
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      13. Creating a table
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      14. Creating a view
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      15. Creating a stored procedure
        1. Getting ready
        2. How to do it...
        3. How it works...
      16. Creating a trigger
        1. Getting ready
        2. How to do it...
        3. How it works...
      17. Creating an index
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      18. Executing a query/SQL script
        1. Getting ready
        2. How to do it...
        3. How it works...
      19. Performing bulk export using Invoke-SqlCmd
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      20. Performing bulk export using the bcp command-line utility
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      21. Performing bulk import using BULK INSERT
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      22. Performing bulk import using the bcp command-line utility
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      23. Connecting to an Azure SQL database
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. There's more...
      24. Creating a table in an Azure SQL database
        1. Getting ready
        2. How to do it...
        3. How it works...
    11. 3. Basic Administration
      1. Introduction
      2. Creating a SQL Server instance inventory
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Creating a SQL Server database inventory
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Listing installed hotfixes and Service Packs
        1. How to do it...
        2. How it works...
        3. There's more...
      5. Listing running/blocking processes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Killing a blocking process
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Checking disk space usage
        1. How to do it...
        2. How it works...
        3. There's more...
      8. Setting up WMI server event alerts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Detaching a database
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Attaching a database
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Copying a database
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      12. Executing SQL query to multiple servers
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      13. Creating a filegroup
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      14. Adding a secondary data file to a filegroup
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      15. Increase data file size
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      16. Moving an index to a different filegroup
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      17. Checking index fragmentation
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      18. Reorganizing/rebuilding an index
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      19. Running DBCC commands
        1. How to do it...
        2. How it works...
      20. Setting up Database Mail
        1. Getting ready
        2. How to do it...
        3. How it works...
      21. Listing SQL Server Jobs
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      22. Adding a SQL Server operator
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      23. Creating a SQL Server Job
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      24. Adding a SQL Server event alert
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      25. Running an SQL Server Job
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      26. Scheduling a SQL Server Job
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    12. 4. Security
      1. Introduction
      2. Listing SQL Server service accounts
        1. How to do it...
        2. How it works...
        3. See also
      3. Changing SQL Server service account
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Listing authentication mode
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Changing authentication mode
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. More on legacy LoginMode values
        5. See also
      6. Listing SQL Server log errors
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      7. Listing failed login attempts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      8. Enabling Common Criteria compliance
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      9. Listing logins, users, and database mappings
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Listing login/user roles and permissions
        1. How to do it...
        2. How it works...
        3. See also
      11. Creating a user-defined server role
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      12. Creating a login
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      13. Assigning permissions and roles to a login
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      14. Creating a database user
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      15. Assigning permissions to a database user
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      16. Creating a database role
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      17. Fixing orphaned users
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      18. Creating a credential
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      19. Creating a proxy
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    13. 5. Backup and Restore
      1. Introduction
      2. Changing database recovery model
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Checking last backup date
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Creating a backup device
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Listing backup header and FileList information
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Creating a full backup
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. More about backup and PercentCompleteEventHandler
        5. See also
      7. Creating a backup on Mirrored Media Sets
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      8. Creating a differential backup
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Creating a transaction log backup
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Creating a filegroup backup
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Restoring a database to a point-in-time
        1. Getting ready
        2. How to do it...
        3. How it works...
          1. Gathering your backup files
          2. Restoring the latest good full backup with NORECOVERY
          3. Restoring the last good differential backup taken after the full backup you just restored with NORECOVERY
          4. Restoring the transaction logs taken after your differential backup
        4. There's more...
        5. See also
      12. Performing an online piecemeal restore
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      13. Backing up database to Azure Blob storage
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      14. Restoring database from Azure Blob storage
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    14. 6. Advanced Administration
      1. Introduction
      2. Connecting to LocalDB
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Creating a new LocalDB instance
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Listing database snapshots
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Creating a database snapshot
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Dropping a database snapshot
        1. How to do it...
        2. How it works...
        3. See also
      7. Enabling FileStream
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Setting up a FileStream filegroup
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Adding a FileTable
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Adding full-text catalog
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Adding full-text index
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      12. Creating a memory-optimized table
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      13. Creating a database master key
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      14. Creating a certificate
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      15. Creating symmetric and asymmetric keys
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      16. Setting up Transparent Data Encryption
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    15. 7. Audit and Policies
      1. Introduction
      2. Enabling/disabling change tracking
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Configuring SQL Server Audit
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Listing facets and their properties
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Listing policies
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Exporting a policy
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Importing a policy
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      8. Creating a condition
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Creating a policy
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Evaluating a policy
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Running and saving a profiler trace event
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      12. Extracting the contents of a trace file
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    16. 8. High Availability with AlwaysOn
      1. Introduction
      2. Installing the Failover Cluster feature on Windows
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Enabling TCP and named pipes in SQL Server
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Enabling AlwaysOn in SQL Server
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      5. Creating and enabling the HADR endpoint
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Granting the CONNECT permission to the HADR endpoint
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Creating an AlwaysOn Availability Group
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Joining the secondary replicas to Availability Group
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Adding an availability database to an Availability Group
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      10. Creating an Availability Group listener
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      11. Testing the Availability Group failover
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      12. Monitoring the health of an Availability Group
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
    17. 9. SQL Server Development
      1. Introduction
      2. Importing data from a text file
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Exporting records to a text file
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Adding files to a FileTable
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Inserting XML into SQL Server
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Extracting XML from SQL Server
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      7. Creating an RSS feed from SQL Server content
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      8. Applying XSL to an RSS feed
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Creating a JSON file from SQL Server
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      10. Storing binary data in SQL Server
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Extracting binary data from SQL Server
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      12. Creating a new assembly
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      13. Listing user-defined assemblies
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      14. Extracting user-defined assemblies
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    18. 10. Business Intelligence
      1. Introduction
      2. Listing items in your SSRS Report Server
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Listing SSRS report properties
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Using ReportViewer to view your SSRS report
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Downloading an SSRS report in Excel and as a PDF
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Creating an SSRS folder
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Creating an SSRS data source
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      8. Changing an SSRS report's data source reference
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Uploading an SSRS report to Report Manager
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Downloading all SSRS report RDL files
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Adding a user with a role to SSRS report
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      12. Creating folders in an SSIS package store and MSDB
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      13. Deploying an SSIS package to the package store
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      14. Executing an SSIS package stored in a package store or filesystem
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      15. Downloading an SSIS package to a file
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      16. Creating an SSISDB catalog
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      17. Creating an SSISDB folder
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      18. Deploying an ISPAC file to SSISDB
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      19. Executing an SSIS package stored in SSISDB
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      20. Listing SSAS cmdlets
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      21. Listing SSAS instance properties
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      22. Backing up an SSAS database
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      23. Restoring an SSAS database
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      24. Processing an SSAS cube
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    19. 11. Helpful PowerShell Snippets
      1. Introduction
      2. Documenting PowerShell script for Get-Help
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Getting history
        1. How to do it...
        2. How it works...
      4. Getting a timestamp
        1. How to do it...
        2. How it works...
        3. There's more...
      5. Getting more error messages
        1. How to do it...
        2. How it works...
      6. Listing processes
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Getting aliases
        1. How to do it...
        2. How it works...
        3. There's more...
      8. Exporting to CSV and XML
        1. How to do it...
        2. How it works...
        3. There's more...
      9. Using Invoke-Expression
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      10. Testing regular expressions
        1. How to do it...
        2. How it works...
        3. There's more...
      11. Managing folders
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      12. Manipulating files
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      13. Compressing files
        1. How to do it...
        2. How it works...
      14. Searching for files
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      15. Reading an event log
        1. How to do it...
        2. How it works...
        3. There's more...
      16. Sending an e-mail
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      17. Embedding C# code
        1. How to do it...
        2. How it works...
        3. There's more...
      18. Creating an HTML report
        1. How to do it...
        2. How it works...
        3. There's more...
      19. Parsing XML
        1. Getting ready
        2. How to do it...
        3. How it works...
      20. Extracting data from a web service
        1. How to do it...
        2. How it works...
        3. There's more...
      21. Using PowerShell remoting
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
    20. A. PowerShell Primer
      1. Introduction
      2. Understanding the need for PowerShell
      3. Setting up the environment
      4. Running PowerShell scripts
        1. Through shell or through the ISE
        2. The execution policy
      5. Learning PowerShell basics
        1. Cmdlets
        2. Learning PowerShell
          1. Get-Command
          2. Get-Help
          3. Get-Member
        3. Starter notes
          1. PowerShell is object-oriented and works with .NET
          2. Cmdlets may have aliases or you can create one
          3. You can chain commands
          4. Filter left, format right
          5. Package and reuse
        4. Common cmdlets
      6. Scripting syntax
        1. Statement terminators
        2. Escape and line continuation
        3. Variables
          1. Here-string
          2. String interpolation
        4. Operators
        5. Displaying messages
        6. Comments
        7. Special variables
        8. Special characters
        9. Conditions
        10. Regular expressions
        11. Arrays
        12. Hash tables
        13. Loops
        14. Error handling
      7. Converting scripts into functions
      8. Listing notable PowerShell features
      9. Exploring more PowerShell
    21. B. Creating a SQL Server VM
      1. Introduction
      2. Terminologies
      3. Downloading software
      4. VM details and accounts
      5. Creating an empty virtual machine
      6. Installing Windows Server 2012 R2 as guest OS
      7. Installing VMware tools
      8. Making a snapshot as a baseline
      9. Configuring a domain controller (optional)
      10. Creating domain accounts
      11. Installing SQL Server 2014 on a VM
      12. Configuring Reporting Services in native mode
      13. Installing sample databases
      14. Installing PowerShell V5
      15. Using SQL Server on a Windows Azure VM
    22. Index