Mastering Windows PowerShell Scripting
eBook - ePub

Mastering Windows PowerShell Scripting

Brenton J.W. Blawat

Share book
  1. 282 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering Windows PowerShell Scripting

Brenton J.W. Blawat

Book details
Book preview
Table of contents
Citations

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering Windows PowerShell Scripting an online PDF/ePUB?
Yes, you can access Mastering Windows PowerShell Scripting by Brenton J.W. Blawat in PDF and/or ePUB format, as well as other popular books in Informatik & Programmiersprachen. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781782173557

Mastering Windows PowerShell Scripting


Table of Contents

Mastering Windows PowerShell Scripting
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Instant updates on new Packt books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Variables, Arrays, and Hashes
Variables
Objects stored in variables
Arrays
Single-dimension arrays
Jagged arrays
Updating array values
Hashes
Deciding the best container for your scripts
Summary
2. Data Parsing and Manipulation
String manipulation
Replacing and splitting strings
Counting and trimming strings
The Trim method
The Substring method
The string true and false methods
Number manipulation and parsing
Formatting numbers
Formatting bytes
Date and time manipulation
Forcing data types
Piping variables
Summary
3. Comparison Operators
Comparison operator basics
Equal and not equal comparison
Greater than and less than comparison
Contains, like, and match operators
And / OR comparison operators
Best practices for comparison operators
Summary
4. Functions, Switches, and Loops Structures
Functions
Looping structures
Switches
Combining the use of functions, switches, and loops
Best practices for functions, switches, and loops
Best practices for functions
Best practices for looping structures and switches
Summary
5. Regular Expressions
Getting started with regular expressions
Regular expression grouping constructs and ranges
Regular expression quantifiers
Regular expression anchors
Regular expressions examples
Summary
6. Error and Exception Handling and Testing Code
Error and exception handling – parameters
Error and exception handling – Try/Catch
Error and exception handling –Try/Catch with parameters
Error and exception handling – legacy exception handling
Methodologies for testing code
Testing the –WhatIf argument
Testing the frequency
Hit testing containers
Don't test in production
Summary
7. Session-based Remote Management
Utilizing CIM sessions
Creating a session
Creating a session with session options
Using sessions for remote management
Removing sessions
Summary
8. Managing Files, Folders, and Registry Items
Registry provider
Creating files, folders, and registry items with PowerShell
Adding named values to registry keys
Verifying files, folders, and registry items
Copying and moving files and folders
Renaming files, folders, registry keys, and named values
Deleting files, folders, registry keys, and named values
Summary
9. File, Folder, and Registry Attributes, ACLs, and Properties
Retrieving attributes and properties
Viewing file and folder extended attributes
Setting the mode and extended file and folder attributes
Managing file, folder, and registry permissions
Copying access control lists
Adding and removing ACL rules
Summary
10. Windows Management Instrumentation
WMI structure
Using WMI objects
Searching for WMI classes
Creating, modifying, and removing WMI property instances
Creating property instances
Modifying property instances
Removing property instances
Invoking WMI class methods
Summary
11. XML Manipulation
XML file structure
Reading XML files
Adding XML content
Modifying XML content
Removing XML content
Summary
12. Managing Microsoft Systems with PowerShell
Managing local users and groups
Managing local users
Managing local groups
Querying for local users and groups
Managing Windows services
Managing Windows processes
Installing Windows features and roles
Summary
13. Automation of the Environment
Invoking programs for automation
Using desired state configuration
Authoring phase
Staging and remediation phase
Detecting and restoring drifting configurations
Summary
14. Script Creation Best Practices and Conclusion
Best practices for script management
# commenting headers
Commenting code
Best practices for script creation
Script structure
Other important best practices for script creation
Controlling source files
Best practices for software automation
Summary
Mastering Windows PowerShell Scripting – conclusion
Staying connected with the author
Index

Mastering Windows PowerShell Scripting

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2015
Production reference: 1210415
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78217-355-7
www.packtpub.com

Credits

Author
Brenton J.W. Blawat
Reviewers
Tim Amico
Christophe CRÉMON
Tomas Restrepo
Acquisition Editor
Meeta Rajani
Content Development Editor
Rohit Singh
Technical Editor
Tanvi Bhatt
Copy Editors
Hiral Bhat
Sonia Mathur
Vikrant Phadke
Alpha Singh
Project Coordinator
Mary Alex
Proofreaders
Simra...

Table of contents