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

Chapter 9. File Scanning

When you are evaluating systems in your environment, there may be a time where you need to scan files for specific content. The Window server scanning script enables you to search directories for files with specific strings. Common strings may include error messages, clear text passwords, or even specific server information such as hostnames and IP addresses. The ability to scan systems for specific content is an immensely powerful tool that can reveal a plethora of information about your systems.

It is common, when scanning a system, to have a lot of results that are not what you are looking for, also known as false positives. This chapter will explore how to reduce the number of false positives by narrowing the search to specific file types. It will also explain how to exclude files from your search to help you get the data you need.

In this chapter, you will:

  • Understand how to obtain subdirectories and their contents

  • Limit the file discovery process to specific file...