Chapter 11. Helpful PowerShell Snippets

In this chapter, we will cover the following topics:

  • Documenting the PowerShell script for Get-Help
  • Getting history
  • Getting a timestamp
  • Getting more error messages
  • Listing processes
  • Getting aliases
  • Exporting to CSV and XML
  • Using Invoke-Expression
  • Testing regular expressions
  • Managing folders
  • Manipulating files
  • Compressing files
  • Searching for files
  • Reading an event log
  • Sending an e-mail
  • Embedding C# Code
  • Creating an HTML report
  • Parsing XML
  • Extracting data from a web service
  • Using PowerShell remoting

Introduction

In this chapter, we tackle a variety of recipes that are not SQL Server-specific; but you may find them useful as you use PowerShell with SQL Server. Often, you will need to compress (or zip) files, create timestamped files, ...

Get SQL Server 2014 with PowerShell v5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.