Book Image

Enterprise PowerShell Scripting Bootcamp

By : Brenton J.W. Blawat
Book Image

Enterprise PowerShell Scripting Bootcamp

By: Brenton J.W. Blawat

Overview of this book

Enterprise PowerShell Scripting Bootcamp explains how to create your own repeatable PowerShell scripting framework. This framework contains script logging methodologies, answer file interactions, and string encryption and decryption strategies. This book focuses on evaluating individual components to identify the system’s function, role, and unique characteristics. To do this, you will leverage built-in CMDlets and Windows Management Instrumentation (WMI) to explore Windows services, Windows processes, Windows features, scheduled tasks, and disk statistics. You will also create custom functions to perform a deep search for specific strings in files and evaluate installed software through executable properties. We will then discuss different scripting techniques to improve the efficiency of scripts. By leveraging several small changes to your code, you can increase the execution performance by over 130%. By the end of this book, you will be able to tie all of the concepts together in a PowerShell-based Windows server scanning script. This discovery script will be able to scan a Windows server to identify a multitude of components.
Table of Contents (21 chapters)
Enterprise PowerShell Scripting Bootcamp
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
3
Working with Answer Files
Index

Windows services


When you are working with Microsoft-based systems, there may be times where you need to interact with Windows services. PowerShell offers a variety of cmdlets that enable you to work with these services. To start, you can review the services on a system by leveraging the Get-service cmdlet. By calling the Get-service cmdlet, you can retrieve the full list of Windows services on a system. If you want to obtain a filtered view into a specific service, you can leverage the –name parameter referencing a specific name of a service. After executing this command, you will see the Status, Name, and DisplayName of the service. You may also issue the –RequiredServices parameter to display the services that are required to be running for that particular service to be functional. You can query dependent Windows services by executing the –DependentServices parameter.

To use the Get-service cmdlet to query the Windows Audio Service, you could do the following:

Get-service –DisplayName...