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 server scanning script


There can be times in large enterprises where you need to determine the functionality of systems. If you don't have large asset management software, you will need the ability to perform a discovery. This book was designed to provide a significant jumpstart for the creation of a Windows server scanning script. The script takes into consideration the limitations of Windows components and provides extremely detailed information about systems.

Some of the items that you will be scanning for include:

  • Disk configuration: You will be able to query the disk layout for a particular system and determine device type, drive letters, free space, and total disk size.

  • Scheduled task scanning: You will discover the scheduled tasks that are not running as built-in accounts, providing visibility into non-standard configurations.

  • Windows processes: You will identify the Windows processes on the system to determine what processes are running with alternate user credentials. This will help identify systems that have service accounts for process execution.

  • Windows services: You will review the Windows services on the system to discover what services are not running as built-in accounts. This will further identify service account usage in your enterprise.

  • Installed software: You will learn how to safely scan a system for software to identify software titles installed on a system.

  • User profiles: You will evaluate all of the user profiles created on a system to determine the last login usernames and times. This will help identify teams that own the management of the servers.

  • Windows features: You will determine the installed Windows features and roles on a system to help identify what role the server has in your enterprise.

  • Scanning files: You will scan individual files on a system for strings. This provides the ability to identify items such as user credentials and configured server names.

This script is designed to provide a robust platform to scan your enterprise. Variations of this script have been used in multiple Fortune 500 companies and executed on well over 10,000 systems. The chapters in this book have been designed to enable you to quickly learn the core components to integrate this PowerShell tool into your personal repository.