Windows PowerShell 2.0 Bible - Thomas Lee - E-Book

Windows PowerShell 2.0 Bible E-Book

Thomas Lee

2,1
25,99 €

oder
-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

Here's the complete guide to Windows PowerShell 2.0 for administrators and developers Windows PowerShell is Microsoft's next-generation scripting and automation language. This comprehensive volume provides the background that IT administrators and developers need in order to start using PowerShell automation in exciting new ways. It explains what PowerShell is, how to use the language, and specific ways to apply PowerShell in various technologies. Windows PowerShell is Microsoft's standard automation tool and something that every Windows administrator will eventually have to understand; this book provides the background necessary to apply PowerShell automation. * Covers how to use the language and specific ways to apply PowerShell in a variety of scenarios * Addresses new features in the latest version of PowerShell and the additional functionality delivered by new products that provide direct or indirect ways to use PowerShell for scripting and automation purposes * Explores the language fundamentals and how to use PowerShell for desktop, server, server application, and virtualization/cloud situations This thorough guide goes well beyond theory to offer real-world information and new scripting techniques, enabling administrators and developers to make the most of PowerShell 2.0.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 883

Bewertungen
2,1 (18 Bewertungen)
0
1
4
8
5
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Contents

Introduction

Part I: Introduction

Chapter 1: Introduction to Windows PowerShell

Managing Windows — The Challenges of the Past

What Is Windows PowerShell?

Key Windows PowerShell Concepts

Discovery and the Community

Windows PowerShell Language Constructs

Formatting Output

Scripting

Extending Windows PowerShell with Snap-ins and Modules

Installing Windows PowerShell

Customizing Windows PowerShell with Profiles

Summary

Chapter 2: What’s New in Windows PowerShell V2

The Road to V2

Using Remoting

Working with Jobs

Using Advanced Functions

Working with Modules

Making Use of Eventing

Using the Integrated Scripting Environment

Supporting Transactions

Debugging and Error Handling

New Cmdlets

Summary

Part II: Windows Desktop

Chapter 3: Managing Windows 7

Troubleshooting Windows 7 with Windows PowerShell

Managing Windows Search

Checking HotFix Status

Managing Files and Folders

Summary

Chapter 4: Managing Microsoft Office 2010

Introducing the Office COM Objects

Automating Microsoft Word

Working with Microsoft Excel Spreadsheets

Navigating Microsoft Outlook

Additional Office COM Examples

Summary

Chapter 5: Managing Security

NTFS Permissions

Share Permissions

Registry Settings

Managing the Windows Firewall

Enabling Remote Desktop

Summary

Chapter 6: Managing and Installing Software

Listing Software

Installing Software

Removing Software

Summary

Part III: Server Management

Chapter 7: Managing Windows Server 2008 R2

What’s New in Server 2008 R2

Managing Server Features and Roles

Running Best Practice Analyzer Scans

Enabling Remoting

Managing Windows Backup

Managing Server Migration

Managing AppLocker

Summary

Chapter 8: Performing Basic Server Management

Discovering Server Configuration

Managing Scheduled Tasks

Checking Hotfix Status

Gathering Data from Event Logs

Using System Time

Summary

Chapter 9: Performing Advanced Server Management

Managing Command-Line Services

Managing Processes

Reading the Registry

Setting Registry Values

Validating Network Configuration on Remote Servers

Gathering Data from Performance Counters

Modifying Regional Settings on Multiple Computers

Managing Local Accounts

Configuring Remote DCOM

Summary

Chapter 10: Managing Active Directory

Installing and Using the Cmdlets

Using the Active Directory Provider

Querying Active Directory

User and Group Administration

Managing Organizational Units

Password Policies

Managing the Rest of Active Directory

Managing Active Directory with the ActiveRoles Management Shell

Summary

Chapter 11: Managing Group Policy

Installing and Using the Cmdlets

Getting Policy Information

Creating and Configuring GPOs

Backing Up and Restoring GPOs

Group Policy Security

Summary

Part IV: Server Applications

Chapter 12: Managing Microsoft Exchange Server

Installing the Cmdlets on a Workstation

What’s New in Microsoft Exchange Server 2010

Managing Microsoft Exchange Server Permissions

Administering Objects

Managing Databases

Discovering Space Used by Disabled Mailboxes

Managing Quotas

Managing Microsoft Exchange Server Remotely

Email Address Policies

Interoperating with Earlier Versions of Microsoft Exchange

Using Filters

Managing Recipient Scope

Managing Role Based Access Control

Introducing Microsoft Exchange Web Services

Summary

Chapter 13: Managing SQL Server 2008 R2

PowerShell Basics for SQL Server

Managing SQL Server Services

Querying SQL Server

Loading Data

Getting SQL Server Information

Gathering Performance Counters

Scripting Objects

Scheduling Windows PowerShell SQL Server Agent Job Steps

Getting Space Usage Information

Managing Registrations in SQL Server Management Studio

Summary

Chapter 14: Managing Microsoft SharePoint 2010 Server

Installing and Using the Cmdlets

Remoting with SharePoint

Automating Site Administration

Using SharePoint Lists

Creating a Web Application

Deploying Developer Code

Administering Workflows

Backing Up and Restoring

Search and Timer Jobs

Summary

Chapter 15: Managing Internet Information Services 7

Installing the Necessary Components

Browsing IIS:\

Scripting Deployments and Changes

Managing IIS

Digesting Log Files

Summary

Chapter 16: Managing System Center Operations Manager 2007 R2

Exploring the Available Cmdlets

Working with Alerts

Automating Maintenance Mode

Deploying and Configuring OpsMgr Agents and Network Devices

Exploring Discovered Inventory Data

Windows PowerShell and the Command Notification Channel

Overrides

Notifications

Monitoring Scripts in Windows PowerShell

Sample OpsMgr Scripts and Other Community Resources

Summary

Chapter 17: Managing Microsoft Deployment Toolkit 2010

Installing and Using the Cmdlets

Creating and Populating the Deployment Share

Managing the Deployment Share

Summary

Chapter 18: Managing Citrix XenApp 6

Installing and Using the Cmdlets

What’s New in XenApp 6

Working with Administrators

Providing Applications

Managing Sessions

Maintaining Servers

Applying Load-Balancing Policies

Worker Groups

Summary

Chapter 19: Managing Citrix XenDesktop 5

Introducing Citrix XenDesktop 5

Administrators

Catalogs

Provisioning

Desktop Groups

Hosts

Summary

Part V: Virtualization and Cloud Computing

Chapter 20: Managing Hyper-V 2008 R2

Hyper-V Management Interfaces

Managing Hosts

Managing Virtual Machines

Summary

Chapter 21: Managing System Center Virtual Machine Manager 2008 R2

Working with System Center Virtual Machine Manager 2008 R2

Working with Host Servers

Managing Clusters

Working with Virtual Machines

Libraries

Summary

Chapter 22: Managing Windows Azure

Installing and Using the Windows Azure Service Manager Cmdlets

Managing Hosted Services

Managing Certificates

Windows Azure Diagnostics

Summary

Chapter 23: Managing VMware vSphere PowerCLI

Installing and Using the Cmdlets

Managing ESX and ESXi

Managing Virtual Machines

Managing vCenter

Everything Else

Summary

Part VI: Beyond the Console

Chapter 24: Creating User Interfaces

Working with Text Mode UI

Building a Simple UI in Windows PowerShell Using Windows Forms

Using Windows Forms Controls

Using Windows PowerShell and PrimalForms

Using Windows Presentation Foundation

Summary

Chapter 25: Using the Windows PowerShell ISE

Key Features of the ISE

Using the ISE

Debugging with the ISE

Extending the ISE

Third-Party Alternatives to the ISE

Summary

Index

Windows PowerShell® 2.0 Bible

Published by

John Wiley & Sons, Inc.

10475 Crosspoint Boulevard

Indianapolis, IN 46256

www.wiley.com

Copyright © 2011 by John Wiley & Sons, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN: 978-1-118-02198-9

ISBN: 978-1-118-18326-7 (ebk)

ISBN: 978-1-118-18328-1 (ebk)

ISBN: 978-1-118-18327-4 (ebk)

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or website may provide or recommendations it may make. Further, readers should be aware that Internet websites listed in this work may have changed or disappeared between when this work was written and when it is read.

For general information on our other products and services, please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.

Library of Congress Control Number: 2011936812

Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Windows PowerShell is a registered trademark of Microsoft Corporation. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.

My work on this project is dedicated to Susan, my wife, for her patience, affection, and outstanding proofreading skills. I could not have done it without her. To my godmother, Alberta Stehle, and my aunt, Mrs. James Wright, for their inspiration.

— Thomas Lee

My work on this book is dedicated to my best friend, the love of my life, my bride, Sherry. Without your faith and constant support, I’d still be staring at a blank Word document. Thanks for always believing in me.

— Karl Mitschke

My work on this book is dedicated to my wife, Carla. It is with her support and constant encouragement that I have been able to be where I am today.

— Mark E. Schill

My work on this book is dedicated to my ladies. To my wife, Heather, who is and will always be the love of my life and my best friend, I’m sorry if you felt like a single mother at times while I was working on this. To my daughter Elora, who made sure that I took breaks from writing, and to my unborn daughter who we have yet to name, I hope this book serves as an inspiration that you can do anything you want in this world with enough hard work and commitment.

— Tome Tanasovski

About the Authors

Thomas Lee is an IT industry veteran. Thomas graduated from Carnegie Mellon University in 1973, and has had a number of interesting assignments over the decades. Today, he consults, writes, and provides training mainly on Microsoft technologies, including Lync and Windows PowerShell. He has also been a speaker at major IT conferences over the past two decades.

A Microsoft Certified Trainer for 17 years and an MVP for 16 of the past 17 years, Thomas was the first person in the world to blog about Windows PowerShell in 2003. He has also been involved with the Windows PowerShell community since its inception and is a director of PowerShellCommunity.org.

Thomas was part of the team that wrote both official Microsoft Windows PowerShell classes and has taught clients around the world to use the product. He writes two blogs, Under The Stairs (at http://tfl09.blogspot.com) and PowerShell Scripts Blog (at http://pshscripts.blogspot.com), is active on Twitter (@doctordns), and hosts online forums. In his spare time, he lives in an old cottage in the English countryside with his wife Susan, daughter Rebecca, a fine wine cellar, and large collection of Grateful Dead live recordings.

Karl Mitschke is a Systems Engineer for the State of Montana. His primary focus is Microsoft Exchange Server administration, with a strong emphasis on Windows PowerShell. Karl was awarded the Microsoft Community Contributor award for his contributions in Microsoft online community forums.

With more than 25 years of IT experience and extensive experience creating utility programs in C# and Visual Basic, Karl has been working with Windows PowerShell since the public beta was available. He has worked with Microsoft Exchange since Version 5.0 and was a Banyan Vines email administrator previous to that. Karl currently works with Microsoft Exchange Server 2010 SP1, System Center Operations Manager 2007 R2, and SQL Server 2008.

Karl is a frequent contributor on multiple scripting forums and blogs. You can follow his comments on http://unlockpowershell.wordpress.com/.

Mark E. Schill, a graduate of the Georgia Institute of Technology, is an IT veteran with 13 years of experience specializing in Windows server and Citrix technologies. He started scripting with a Y2K project that required the creation of thousands of new NT domain accounts and has been automating ever since. He made the switch to Windows PowerShell in July 2007 with his first Citrix MFCOM script for publishing desktops, which is still in production to this day. Mark spends his workdays as an all-in-one scripter, C# developer, SQL Server database administrator, and Windows system administrator.

He is currently the president of the Atlanta PowerShell User Group and the Atlanta Citrix User Group, as well as the vice president of the Virtual PowerShell User Group.

When possible, Mark hangs out with the Virtual PowerShell User Group on the #PowerShell IRC channel on irc.freenode.net. You can track Mark at his blog at www.cmschill.net/StringTheory, contact him via email at [email protected], or follow him on twitter @meson3902.

Tome Tanasovski is a Windows engineer for a market-leading, global financial services firm in New York City. He has worked in the IT industry as both an IT professional and a developer for more than 15 years. He is the founder and leader of the New York City PowerShell User Group, a cofounder of the NYC Techstravaganza, a blogger, a speaker, and a regular contributor to the Windows PowerShell forum at Microsoft. He is a recipient of the MVP award for Windows PowerShell.

About the Technical Editors

Marco Shaw has worked in the IT industry for more than 12 years. He currently is an IT consultant in Canada with CGI (www.cgi.com), a global IT consulting firm. Marco works daily with Microsoft products, VMware, and other products that heavily rely on Windows PowerShell for automation of their tasks.

Marco has been awarded the Microsoft Most Valuable Professional award in the Windows PowerShell category for the past four years, and he continues to be active in the online Windows PowerShell community. He has spoken at TechMentor in the U.S. and has given several sessions at Microsoft’s TechDays annual conference in Canada (www.techdays.ca) on various IT topics. Marco has already coauthored a book and appeared in Microsoft’s TechNet Magazine a few years ago. He blogs at http://marcoshaw.blogspot.com and tweets as @MarcoShaw.

Shay Levy is a four-year Windows PowerShell MVP and a System Administrator for a government institute in Israel. He has worked with Microsoft platforms for more than 20 years, focusing on Microsoft Exchange and Active Directory.

As a longtime Windows PowerShell community supporter, Shay has become a moderator of multiple forums and is a codirector of the PowerShellCommunity.org website. He is the creator of the popular Windows PowerShell Community browser toolbar, a one-stop shop for various Windows PowerShell resources, including downloads, webcasts, videos, podcasts, and more.

Shay often covers Windows PowerShell topics on his blog at http://powershay.com. You can also follow him on Twitter at http://twitter.com/ShayLevy.

We appreciate the assistance of the following individuals for lending their expertise to the technical editing of specific chapters: Niklas Goude (Microsoft MVP) for the SharePoint chapter, Chad Miller (Microsoft MVP) for the SQL chapter, and Christian Gehring (Citrix) for the two Citrix chapters.

Credits

Acquisitions Editor

Paul Reese

Project Editor

Linda Harrison, Harrison Ridge Services

Technical Editor

Marco Shaw

Production Editor

Rebecca Anderson

Copy Editor

Kim Cofer

Editorial Manager

Mary Beth Wakefield

Freelancer Editorial Manager

Rosemarie Graham

Associate Director of Marketing

David Mayhew

Business Manager

Amy Knies

Production Manager

Tim Tate

Vice President and Executive Group Publisher

Richard Swadley

Vice President and Executive Publisher

Neil Edde

Associate Publisher

Jim Minatel

Project Coordinator, Cover

Katie Crocker

Proofreaders

Edmund Berrigan, Word One New York

Paul Sagan, Word One New York

Indexer

J & J Indexing

Cover Designer

LeAndra Young

Cover Image

Joyce Haughey

Acknowledgments

Collectively, we would like to thank Linda Harrison and Paul Reese at Wiley for being so patient with our drivel; oftentimes, we’re sure it felt more like babysitting than publishing. We would also like to thank Marco Shaw for putting the four of us together. Finally, thanks to Pete Zerger and Aaron Nelson for their amazing contributions to this work.

— Thomas Lee, Karl Mitschke, Mark E. Schill, and Tome Tanasovski

I’d like to say thanks to Jeffrey Snover, one of the most inspiring people I have ever met. His vision, combined with his presentation and technical skills, continue to inspire me on a near-daily basis. I’d also like to say a huge thank you to the entire Windows PowerShell development team — an utterly amazing group of incredibly talented people. You have all made Windows PowerShell a reality! And no book would be complete without our fantastic team at Wiley. Thanks to Paul Reese, and a double thanks to superstar editor Linda Harrison.

— Thomas Lee

I’d like to thank all the pioneers in Windows PowerShell. I’d be nowhere without following in the footsteps of Brandon Shell, Shay Levy, Marc van Orsouw, Glen Scales, and of course, who could forget Jeffrey Snover and Lee Holmes? You’ve all been an inspiration to me, and I am sure I have forgotten more people than I’ve mentioned. For this, I’m sorry.

Marco Shaw gets a special thanks, as it was he who first pushed me into creating a blog, and then into working on this book. Thanks, Marco!

Of course, without my coauthors Mark E. Schill, Tome Tanasovski, and Thomas Lee, this book would be many hundreds of pages slimmer, and still unfinished. Thanks, guys!

Thanks are due to our editor, Linda; without your help, we’d have a book that no one could read. You’ve turned my near random thoughts into a cohesive series of paragraphs. Thanks, Linda! I know I put you through a lot.

— Karl Mitschke

I want to thank Marco Shaw who first introduced me to the opportunity of writing this book. I also want to thank Ed Wilson for introducing me to the much larger scripting community. Without Jeffrey Snover, the father of Windows PowerShell, and the Windows PowerShell team, there, of course, wouldn’t have been anything to write about. Without Linda Harrison, our editor, none of this would have made any sense.

— Mark E. Schill

Thank you to Marco Shaw and Ed Wilson for noticing me and my writing.

— Tome Tanasovski

Introduction

Welcome to Windows PowerShell 2.0 Bible. We hope that through reading this book and working through the sample code we provide, you will learn a great deal about using Windows PowerShell. This standard automation tool is sure to be one of the most useful tools in your administration toolbox. Join us as, together, we explore this powerful tool and how you can use it.

Overview of the Book and Technology

When the authors of this book got together to discuss the content of the book, we came to a consensus that this book had to follow a new direction. We wanted to create a book that was different from all of the existing Windows PowerShell books. And with “Bible” in the name, we knew we had to really step it up.

All of the existing Windows PowerShell books fell into one of two categories:

Core fundamentals books that explained the Windows PowerShell language itself, but rarely demonstrated real-world application examples.Application-oriented books that explained how to use Windows PowerShell to manage a single specific application.

We wanted this book to be unique among all of the other Windows PowerShell books. We cover the core language fundamentals for users who are new to Windows PowerShell and/or Version 2, but we also take a selection of some of the most prevalent applications in the IT ecosystem and dedicate an entire chapter to them. This book serves as a reference guide for any system administrator managing Windows computers.

How This Book Is Organized

This book is organized into six parts. The first part of the book is the Introduction. This section covers the basics of the Windows PowerShell language as well as the new features added in the second version. If you are new to Windows PowerShell and/or Version 2, you should start at the beginning.

Part II covers the desktop environment. In this section, the focus of the chapters is the management of the Windows desktop and related technologies. Part III switches focus to the server side of things to provide a thorough coverage of Windows Server 2008 R2 and its various components, as well as coverage of server management.

Part IV looks at the applications that provide valuable additional capabilities to the server environment. Virtualization and the cloud are hot topics in the server space today, so an entire section is devoted to this topic in Part V.

Part VI takes Windows PowerShell beyond the console and shows some of the ingenious ways to use Windows PowerShell. It describes how to take advantage of the capabilities of a brand-new integrated scripting environment.

Part I: Introduction

Part I consists of Chapters 1 and 2 and covers Windows PowerShell basics. In Chapter 1, you are introduced to the key components of the Windows PowerShell language. Here, you learn the true power of the language. Next, in Chapter 2, you learn about the new enhancements to Windows PowerShell and how such a powerful tool can be made even better.

Part II: Windows Desktop

Part II consists of Chapters 3 through 6 and includes information for the management of desktop environments.

Chapter 3 focuses on the Windows 7 desktop operating system and how it can be effectively managed by Windows PowerShell. Chapter 4 covers Microsoft’s office productivity suite, Office 2010. Chapter 5 discusses the always important topic of security. Finally, Chapter 6 demonstrates Windows PowerShell’s various options for managing software on Windows operating systems.

Part III: Server Management

Part III consists of Chapters 7 through 11 and covers the management of Windows Server 2008 R2 and core infrastructure.

Beginning with Chapter 7, you learn about the core Windows Server 2008 R2 operating system. Chapters 8 and 9 cover server management starting with basic management concepts and proceeding to more advanced management. Chapter 10 demonstrates the advanced capability of managing Active Directory with Windows PowerShell. In Chapter 11, Active Directory management is extended with the management of Group Policy.

Part IV: Server Applications

Part IV consists of Chapters 12 through 19 and includes coverage of several applications that augment the server environment.

In Chapter 12, both Microsoft Exchange Server 2007 and Microsoft Exchange Server 2010 are covered. Chapter 13 covers SQL Server 2008 R2, and Chapter 14 covers the management of Microsoft SharePoint 2010 Server.

Chapter 15 expands to cover Internet Information Services (IIS). Chapter 16 enters the Microsoft System Center space with System Center Operations Manager (SCOM) 2007 R2. Chapter 17 discusses the Microsoft Deployment Toolkit 2010 and helps you manage your deployment scenarios.

Chapters 18 and 19 cover the two most popular technologies created by Citrix Systems, Inc. Chapter 18 covers the Citrix server application, Citrix XenApp 6, and Chapter 19 covers the still-hot Citrix XenDesktop 5.

Part V: Virtualization and Cloud Computing

Virtualization and cloud computing is a technology area that has seen tremendous growth and visibility in recent months. Chapters 20 through 23 cover key products in this area.

Chapter 20 deals with the Microsoft hypervisor Hyper-V, which is built into Windows Server 2008 R2 and only has to be enabled for you to begin using. System Center Virtual Machine Manager is Microsoft’s enterprise solution for managing Hyper-V and is covered in Chapter 21.

Chapter 22 discusses Windows Azure, Microsoft’s cloud-based solution for hosting applications. Chapter 23 presents on overview of how Windows PowerShell works as a scripting language for use with VMware’s vSphere PowerCLI.

Part VI: Beyond the Console

Part VI introduces two key concepts that augment the scripts and the creation of scripts in Windows PowerShell. Chapter 24 demonstrates the task of creating user interfaces and Chapter 25 covers the Windows PowerShell ISE.

Who Should Read This Book

If you are someone who is interested in applying Windows PowerShell to real-world environments, Windows PowerShell 2.0 Bible is definitely a book you should read.

This book assumes that you have basic networking skills and a basic understanding of Windows. Chapter 1 covers the basics of Windows PowerShell so if you are just starting out, by all means, start at the beginning. Chapter 2 covers the new features introduced in Windows PowerShell Version 2 if you need a refresher on what’s new.

Each of the remaining chapters covers an independent topic. Read through them to gain a thorough knowledge of the capabilities of Windows PowerShell in managing the different components and applications of the Windows environment. Or you can use each chapter as a reference for learning how to script against a specific topic.

Tools You Will Need

At the bare minimum, you will need Windows PowerShell 2.0 installed on your system.

For the desktop section, you will need Windows 7, which includes Windows PowerShell 2.0 built in. You can download a 90-day evaluation copy of Windows 7 Enterprise Edition from the Technet Evaluation Center at http://technet.microsoft.com/en-us/evalcenter/cc442495. To install the Windows 7 operating system from the download, you will need a system with the following general configuration:

1 GHz or faster 32-bit (x86) or 64-bit (x64) processor1 GB of RAM (32-bit)/2 GB RAM (64-bit)16 GB available disk space (32-bit)/20 GB (64-bit)DirectX 9 graphics processor with WDDM 1.0 or higher driverDVD-compatible driveInternet access (fees may apply)

For the server section, you will need Windows Server 2008 R2, which includes Windows PowerShell 2.0 built in. You can download a 180-day evaluation copy of Windows Server 2008 R2 from the Technet Evaluation Center at http://technet.microsoft.com/en-us/evalcenter/ee175713.aspx. To install Windows 2008 R2 from the download, you will need a system with the following general configuration:

1.4 GHz or faster 64-bit (x64) processor512 MB of RAM32 GB available disk spaceSuper VGA (800 × 600) or higher-resolution monitorDVD-compatible driveInternet access (fees may apply)

Conventions Used in This Book

Throughout the book, special typography indicates code and commands. Commands and code are shown in a monospaced font:

This is how code looks.

In the event that an example includes both input and output, the monospaced font is still used, but input is presented in bold type to distinguish the two. Here’s an example:

$ ftp ftp.handsonhistory.comName (home:jake):jakePassword: ******

In a number of examples, you’ll see a variable in italics. The previous command might be displayed as the following:

$ ftphostname

In this case, you should replace “hostname” with the name of a particular host on your network.

Finally, there are a number of examples in this book in which a block of code is followed by the result of that code. The code appears as it would in the examples above. The result of the code is what you would see returned on your screen and is displayed with a screen covering the code:

State : Connected Connection State : Connected PowerState : PoweredOn

The following features are used to call your attention to points that are particularly important:

Note

A note box provides extra information to which you need to pay special attention.

Tip

A tip box shows a special way of performing a particular task.

Caution

A caution box alerts you to take special care when executing a procedure, or damage to your computer hardware or software could result.

Cross-Reference

A cross-reference box refers you to further information, outside the existing chapter, about a subject.

What’s on the Website

The authoring team has taken great pains to provide a wide range of code samples throughout the book. We know how frustrating it can be to have to rekey lengthy code listings. So, we’ve provided them for you on the book’s website at www.wiley.com/go/windowspowershell2bible. You’ll find the code listings from the book as well as additional code examples and a variety of reference information.

Summary

We hope you will get your hands dirty and learn to manage many key software systems through Windows PowerShell. If you do, we know that you will come to appreciate the powerful tool at your disposal. Along the way, be sure to get involved in the Windows PowerShell community.

To help you further your PowerShell learning, we have included several key websites that will complement this book:

Microsoft Script Center: http://technet.microsoft.com/en-us/scriptcenterPowerShell Groups: http://powershellgroup.org/The PowerShellCommunity.org: http://powershellcommunity.org/

You’ll find them to be excellent resources. We look forward to seeing you on the forums and in the user groups.

Good luck!

Part I

Introduction

IN THIS PART

Chapter 1 Introduction to Windows PowerShellChapter 2 What’s New in Windows PowerShell V2

CHAPTER 1

Introduction to Windows PowerShell

IN THIS CHAPTER

Managing Windows — the challenges of the pastIntroducing Windows PowerShellUnderstanding key Windows PowerShell conceptsDiscovering by leveraging the communityFormatting with Windows PowerShellAutomating administrative functions with scriptingExtending Windows PowerShell with snap-ins and modulesInstalling Windows PowerShellCustomizing Windows PowerShell with Profiles

Windows PowerShell is Microsoft’s strategic administrative task automation platform. It began life over 10 years ago and has now become mainstream. Before looking at all of the wonderful things that Windows PowerShell can do, this chapter starts by looking at how we got here, and then examining what Windows PowerShell is. This includes a brief overview of the language and syntax of Windows PowerShell.

Cross-Reference

The contents of this chapter mainly refer to Windows PowerShell Version 1. Version 2 added some great new features, and those are described more in Chapter 2, “What’s New in Windows PowerShell V2.” The features described in this chapter are all contained within Version 2, so everything you learn in this chapter is fully usable in Version 2.

Managing Windows — The Challenges of the Past

The path to Windows PowerShell has been a long but steady one that really started with the launch of the IBM PC in 1981. Since then management of systems has grown from something of a rarity to where we are today. This book starts by looking at where we have come from and the challenges that have arisen.

Management in the Early Days

Microsoft entered the PC operating system (OS) field in 1981, with the launch of the IBM PC. The original PC was a non-networked floppy disk–based machine. Those who had more than one machine managed by carrying around floppy disks, copying them as needed. There was no hard disk to hold either programs or data. Subsequent versions of the DOS operating system added hard disk support, and eventually, there was local area networking capability.

The growth in corporate networks was greatly enhanced by the introduction of Windows. But management was more an afterthought than designed as a feature. This, of course, led to tools like Symantec’s Ghost to help to manage DOS and Windows systems. While the need to manage the systems was increasing, a number of architectural constraints of the older 16-bit architecture made this more difficult. And of course, at that time, Microsoft was not quite as focused on management as is the case today.

Management with Windows NT

The release of Windows NT 3.1 in the summer of 1993 marked a huge advance both in terms of the product and also the start of focusing on enterprise management. Not only was there a networking stack built in, but there was also a server version that enabled domains. In those days, most management tasks were conducted with GUI applications (for example, File Manager or User Manager). There was a rudimentary shell with a few commands, but coverage was far from complete.

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!