Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By : Donabel Santos
Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By: Donabel Santos

Overview of this book

Table of Contents (21 chapters)
SQL Server 2014 with PowerShell v5 Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding the need for PowerShell


PowerShell is both a scripting environment and scripting language meant to support administrators and developers alike in automating and integrating processes and environments.

You may already be familiar with other tools or languages that will help you accomplish your task, and you may be asking why you should even bother learning PowerShell. It is important to note that PowerShell is just another tool, but it can be a very powerful one if used in the appropriate situations.

There are different reasons for using PowerShell, which are as follows:

  • Running a script is faster than clicking on an application's user interface: If we minimize clicks, or eliminate them in some cases, the task can potentially be done much faster. Think about compressing, copying, archiving, and renaming multiple files. If we had to rely on the UI, this task may take much longer. However, if we can bake the logic into a script that performs all the steps, we can run this script when we need to do the same task. We would be faster and more efficient in accomplishing this task.

  • Learning and mastering one language instead of five or ten: Instead of using a duct-taped mishmash of scripting languages (batch file for some items, VBScript, Perl, and COM), we can now use one single language to handle most tasks. PowerShell is supported by different Microsoft applications through libraries of cmdlets that come with applications, such as Microsoft Exchange, SharePoint, and SQL Server. This makes integration and automation among these products easier and more seamless.

  • Leveraging the .NET library: The .NET library provides a rich collection of classes that pretty much covers most programmatic items you can think of such as forms, database connectivity, networking, and so on.

  • Taking advantage of the fact that PowerShell is already built into and supported in different applications: More and more Microsoft products are being shipped with a growing number of PowerShell cmdlets because PowerShell scripting is part of Microsoft's Common Engineering Criteria program (https://technet.microsoft.com/en-us/library/ff460855.aspx). Windows Server, Exchange, Active Directory, SharePoint, and SQL Server, to name a few, all have some PowerShell support.