Windows PowerShell Unleashed

PowerShell gives Windows administrators immense power to automate and customize virtually any administrative task–saving time, increasing productivity, and giving you unprecedented flexibility. PowerShell 2.0 adds important new features that offer even greater control over Windows environments. Windows PowerShell Unleashed will not only give you deep mastery over PowerShell but also a greater understanding of the features being introduced in PowerShell 2.0–and show you how to use it to solve your challenges in your production environment.

The authors begin by systematically illuminating PowerShell’s core concepts and techniques, helping you leverage whatever Windows scripting experience you may already have. Next, using complete, easy-to-adapt examples, they show how to use PowerShell to manage file systems, permissions, the Registry, WMI objects, Active Directory, Exchange Server, and many other elements of the Windows environment.

More than half of this edition’s material and examples have been completely rewritten for PowerShell 2.0, and the authors have added seven entirely new chapters–covering security, PowerShell application development, Systems Center Operations Manager 2007, and much more. Whatever Windows systems you manage, Windows PowerShell Unleashed contains the scripts and techniques you need to manage them far more effectively.

  • Install, configure, and customize PowerShell 2.0 and master its command line interface
  • Discover proven best practices for PowerShell scripting
  • Make the most of PowerShell cmdlets–especially the new cmdlets included in PowerShell 2.0
  • Leverage PowerShell’s deep .NET Framework integration
  • Secure your scripts using code signing, execution policies, and PowerShell’s built-in security
  • Use custom script functions to manage permissions more efficiently
  • Control the registry locally and remotely and use PowerShell’s powerful new registry transactions
  • Use PowerShell as a management interface
  • Automate Exchange Server 2007 administrative tasks
  • Automate the management of Microsoft’s new System Center Operations Manager 2007
  • Preview the forthcoming Graphical PowerShell scripting environment
  • Understand how to manage Active Directory using PowerShell
  • Master using PowerShell with WMI
  • Learn PowerShell 2.0 remoting

Download all examples and source code presented in this book from informit.com/title/9780672329883.

1100059891
Windows PowerShell Unleashed

PowerShell gives Windows administrators immense power to automate and customize virtually any administrative task–saving time, increasing productivity, and giving you unprecedented flexibility. PowerShell 2.0 adds important new features that offer even greater control over Windows environments. Windows PowerShell Unleashed will not only give you deep mastery over PowerShell but also a greater understanding of the features being introduced in PowerShell 2.0–and show you how to use it to solve your challenges in your production environment.

The authors begin by systematically illuminating PowerShell’s core concepts and techniques, helping you leverage whatever Windows scripting experience you may already have. Next, using complete, easy-to-adapt examples, they show how to use PowerShell to manage file systems, permissions, the Registry, WMI objects, Active Directory, Exchange Server, and many other elements of the Windows environment.

More than half of this edition’s material and examples have been completely rewritten for PowerShell 2.0, and the authors have added seven entirely new chapters–covering security, PowerShell application development, Systems Center Operations Manager 2007, and much more. Whatever Windows systems you manage, Windows PowerShell Unleashed contains the scripts and techniques you need to manage them far more effectively.

  • Install, configure, and customize PowerShell 2.0 and master its command line interface
  • Discover proven best practices for PowerShell scripting
  • Make the most of PowerShell cmdlets–especially the new cmdlets included in PowerShell 2.0
  • Leverage PowerShell’s deep .NET Framework integration
  • Secure your scripts using code signing, execution policies, and PowerShell’s built-in security
  • Use custom script functions to manage permissions more efficiently
  • Control the registry locally and remotely and use PowerShell’s powerful new registry transactions
  • Use PowerShell as a management interface
  • Automate Exchange Server 2007 administrative tasks
  • Automate the management of Microsoft’s new System Center Operations Manager 2007
  • Preview the forthcoming Graphical PowerShell scripting environment
  • Understand how to manage Active Directory using PowerShell
  • Master using PowerShell with WMI
  • Learn PowerShell 2.0 remoting

Download all examples and source code presented in this book from informit.com/title/9780672329883.

49.99 Out Of Stock
Windows PowerShell Unleashed

Windows PowerShell Unleashed

Windows PowerShell Unleashed

Windows PowerShell Unleashed

Paperback(Second)

$49.99 
  • SHIP THIS ITEM
    Temporarily Out of Stock Online
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

PowerShell gives Windows administrators immense power to automate and customize virtually any administrative task–saving time, increasing productivity, and giving you unprecedented flexibility. PowerShell 2.0 adds important new features that offer even greater control over Windows environments. Windows PowerShell Unleashed will not only give you deep mastery over PowerShell but also a greater understanding of the features being introduced in PowerShell 2.0–and show you how to use it to solve your challenges in your production environment.

The authors begin by systematically illuminating PowerShell’s core concepts and techniques, helping you leverage whatever Windows scripting experience you may already have. Next, using complete, easy-to-adapt examples, they show how to use PowerShell to manage file systems, permissions, the Registry, WMI objects, Active Directory, Exchange Server, and many other elements of the Windows environment.

More than half of this edition’s material and examples have been completely rewritten for PowerShell 2.0, and the authors have added seven entirely new chapters–covering security, PowerShell application development, Systems Center Operations Manager 2007, and much more. Whatever Windows systems you manage, Windows PowerShell Unleashed contains the scripts and techniques you need to manage them far more effectively.

  • Install, configure, and customize PowerShell 2.0 and master its command line interface
  • Discover proven best practices for PowerShell scripting
  • Make the most of PowerShell cmdlets–especially the new cmdlets included in PowerShell 2.0
  • Leverage PowerShell’s deep .NET Framework integration
  • Secure your scripts using code signing, execution policies, and PowerShell’s built-in security
  • Use custom script functions to manage permissions more efficiently
  • Control the registry locally and remotely and use PowerShell’s powerful new registry transactions
  • Use PowerShell as a management interface
  • Automate Exchange Server 2007 administrative tasks
  • Automate the management of Microsoft’s new System Center Operations Manager 2007
  • Preview the forthcoming Graphical PowerShell scripting environment
  • Understand how to manage Active Directory using PowerShell
  • Master using PowerShell with WMI
  • Learn PowerShell 2.0 remoting

Download all examples and source code presented in this book from informit.com/title/9780672329883.


Product Details

ISBN-13: 9780672329883
Publisher: Sams
Publication date: 12/19/2008
Series: Unleashed Series
Edition description: Second
Pages: 510
Product dimensions: 7.00(w) x 9.10(h) x 1.10(d)

About the Author

With more than nine years of experience in the information technology sector, Tyson Kopczynski has become a specialist in Active Directory, Group Policy, Windows scripting, Windows Rights Management Services, PKI, and information technology security practices. Tyson has been a contributing author for such books as Microsoft Internet Security and Acceleration (ISA) Server 2004 Unleashed and Microsoft Windows Server 2003 Unleashed (R2 Edition). In addition, he has written detailed technical papers and guides covering various in-the-field technologies he works with extensively. As a consultant at Convergent Computing (CCO), Tyson has been able to work with the next generation of Microsoft technologies since their inception and played a key role in expanding scripting and development practices at CCO. Tyson also holds the SANS Security Essentials Certification (GSEC), Microsoft Certified Systems Engineer (MCSE) Security certification, CompTIA Security+ certification, and SANS Certified Incident Handler (GCIH) certification.

Pete Handley has more than 15 years of experience in IT, including extensive knowledge of Active Directory, Microsoft Exchange, Novell GroupWise messaging, and Novell Directory Services. He has been a contributing author for Microsoft Exchange 2003 Unleashed, and Windows PowerShell Unleashed. Pete specializes in Visual Basic and PowerShell scripting and is a subject matter expert on the integration and migration of Novell technologies to Microsoft technologies. Pete holds the Microsoft Certified Systems Engineer 2003 (MCSE) certification, the Microsoft Certified Information Technology Professional (MCITP) certification, the Novell Certified Directory Engineer (CDE) certification, and the Certified Information Systems Security Professional (CISSP) certification.

Marco Shaw is an IT system analyst for a Canadian telecommunications company. He has been working in the IT industry for more than ten years, and he recently received a Microsoft Most Valuable Professional (MVP) award for his involvement in the Windows PowerShell community. He is the assistant community director of the new PowerShell Community Web site at http://www.powershellcommunity.org. His primary blog site is http://marcoshaw.blogspot.com. Marco holds a RedHat Certified Engineer (RHCE) certification, Microsoft Certified Professional (MCP) certification, and a bachelor of science degree from the Université de Moncton in New Brunswick, Canada.

Read an Excerpt

IntroductionIntroduction

Well, we are back for yet another PowerShell Unleashed book. However, unlike just a simple revision of the existing book, which most likely would have resulted in only just a few updated chapters, I decided to instead treat this release in the series as almost a completely new book. Granted, the Community Technology Release (CTP) of PowerShell 2.0 did help drive the need to update all aspects of this edition. Nonetheless, there was also a lot of feedback (some positive and some negative) about how the first book could be improved.

So, based on this feedback and the looming PowerShell 2.0 feature list, I set about making a major revision to the book. To start off right, I decided to address how the PowerShell language was covered in the series. After all, the first book in the series was script heavy, but lacking when it came to explaining some of the basics about the PowerShell language. Additionally, we wanted to go into greater detail about how PowerShell could be used to manage Windows resources while further addressing some of the finer technical details of PowerShell’s architecture. Needless to say, all of these changes required a reorganization to not only the layout of the book, but also its size.

The bottom line, in this new edition, there are six completely new chapters with the rest of the existing chapters either being extensively rewritten or updated. With all this extra content, the book needed additional authors to jump on board and help pound out the book’s technical prose. Thus, joining me on this book as coauthors were Marco Shaw (PowerShell MVP) and Peter Handley (contributing author from the first book). Together, Marco and Peter made great additions to this book and infused fantastic ideas together with even better content—all while writing their chapters.

Finally, the primary goal of this book was to start down the path of explaining the features found in the future 2.0 release of PowerShell. After all, with the 2.0 CTP release late last year, the PowerShell product team ignited our imaginations with the possibilities for what might come down the road (remoting). So, we simply had to do our best to explain the new features. However, given that the 2.0 version is still just a CTP and not a beta, we also walked down a slippery slope, considering that some of these features may not exist in the PowerShell 2.0 RTM. Naturally, like a good reporter might do, we did our best. In the end, we tried to include 2.0 content where applicable while also dedicating an entire chapter to only 2.0 features deemed too important to ignore or voted most likely to survive the beta.

We hope our efforts result in a more comprehensive PowerShell book that can act as both a reference for the current PowerShell 1.0 release while also providing insight into where PowerShell might go with the 2.0 release.

Who Is This Book’s Intended Audience?

This Unleashed book is intended for an intermediate level of systems administrators who have invested time and energy learning Windows scripting and want to translate those skills into PowerShell skills while learning how it can meet their real-world needs. This book has been written so that anyone with a scripting background can understand what PowerShell is and how to use it, but by no means is it meant to be a complete PowerShell reference. Instead, think of it as a resource for learning how PowerShell can be applied in your own environment. Therefore, the structure of this book reflects that focus by including numerous command examples and working scripts.

How This Book Is Organized

The book is divided into the following three parts:


  • Part I, “Introduction to PowerShell”—In this section, you are introduced to PowerShell and some of its internal workings. Topics covered include items such as why PowerShell came into existence, general concepts about PowerShell and how it is constructed, and an in-depth review of PowerShell security.
  • Part II, “Using PowerShell”—In this section, you learn more about the PowerShell scripting language, how to use PowerShell to manage Windows resources, and important best practices to follow when using PowerShell. Specific topics covered range from working with the Windows file system, the Registry, permissions, strings, and Windows Management Instrumentation (WMI) to understanding PowerShell language concepts such as loops, functions, arrays, and so on.
  • Part III, “Managing Microsoft Technologies with PowerShell”—In this section, you learn how PowerShell can be used to manage Microsoft technologies. Topics covered include using PowerShell to manage Active Directory, Exchange Server 2007, and Systems Center Operations Manager 2007. Additionally, you learn how to programmatically use PowerShell to manage systems and gain insight and understanding into important PowerShell 2.0 features.
    Conventions Used in This Book

    Commands, scripts, and anything related to code are presented in a special monospace computer typeface. Bold indicates key terms being defined, and italic is used to indicate variables or for emphasis. Great care has been taken to be consistent in letter case, naming, and structure, with the goal of making command and script examples more readable. In addition, you might find instances in which commands or scripts haven’t been fully optimized. This lack of optimization is for your benefit, as it makes those code samples more intelligible and follows the practice of writing code for others to read.

    Other standards used throughout this book are as follows:

    Black Code Boxes

    These code boxes contain commands that run in a PowerShell or Bash shell session.

    Gray Code Boxes

    These code boxes contain source code from scripts, configuration files, or other items that aren’t run directly in a shell session.

    Please note that although PowerShell can display text in multiple colors, all script output from the examples is printed here in black and white. If you run one of the example scripts on your lab system, the text will be displayed in color.

    CAUTION - Cautions alert you to actions that should be avoided.

    NOTE - Notes give you additional background information about a topic being discussed.

    © Copyright Pearson Education. All rights reserved.


  • Table of Contents

    Introduction 1

    Part I Introduction to PowerShell

    1 Introduction to Shells 7

    What Is a Shell? 7

    Basic Shell Use 8

    Basic Shell Scripts 11

    A Shell History 15

    Enter PowerShell 16

    New Capabilities in PowerShell 2.0 CTP2 18

    Summary 19

    2 Basic PowerShell Concepts 21

    Getting Started 21

    PowerShell 1.0 RTW 22

    PowerShell 2.0 CTP2 23

    Before Installing PowerShell 2.0 CTP2 23

    Downloading and Installing PowerShell 2.0 25

    Understanding the Command-Line Interface (CLI) 28

    Navigating the CLI 30

    Tab Key Auto-Completion in PowerShell 30

    Understanding Cmdlets 32

    Common Parameters 33

    Getting Help 34

    Get-Help 34

    Cmdlet Help Topics 36

    Get-Command 36

    Understanding Variables 39

    Built-In Variables 40

    Understanding Aliases 42

    Discovering Alias Cmdlets 43

    Creating Persistent Aliases 44

    Creating Your First Script 45

    Summary 47

    3 Advanced PowerShell Concepts 49

    Working with the .NET Framework 51

    Using the New-Object Cmdlet 53

    Understanding Assemblies 54

    Understanding Reflection 56

    Understanding the Pipeline 59

    Powerful One-Liners 63

    The Extended Type System (ETS) 65

    Understanding the Add-Member Cmdlet 67

    Understanding the types.ps1xml File 68

    Working with Types 68

    Type Accelerators 71

    Summary 72

    4 Other Key PowerShell Concepts 73

    Formatting Output 73

    The Formatting Cmdlets 74

    PowerShell’s Formatting under the Hood 74

    Customizing Output Formats 75

    Providers 79

    Accessing Drives and Data 82

    Mounting a Drive 85

    Profiles 87

    The All Users Profile 87

    The All Users Host-Specific Profile 87

    The Current User’s Profile 88

    The Current User’s Host-Specific Profile 88

    Scopes 88

    The Global Scope 88

    The Local Scope 89

    The Script Scope 89

    The Private Scope 90

    Dot Sourcing 91

    Library Files 91

    Summary 97

    5 Understanding PowerShell Security 99

    PowerShell Default Security 100

    Execution Policies 100

    Restricted 100

    AllSigned 101

    RemoteSigned 101

    Unrestricted 103

    Setting the Execution Policy 103

    Code Signing 105

    What Is Code Signing? 106

    Obtaining a Code-Signing Certificate 107

    The PVK Digital Certificate Files Importer 112

    Signing PowerShell Scripts 112

    Verifying Digital Signatures 113

    Signed Code Distribution 115

    Enterprise Code Distribution 117

    Public Code Distribution 117

    PowerShell Security Best Practices 118

    Digitally Sign PowerShell Scripts and Configuration Files 118

    Never Set Execution Policies to Unrestricted 118

    Try to Run Scripts with the Minimum Required Rights 118

    PowerShell 2.0 CTP2 and Windows Remote Management (WinRM) 119

    Configuring WinRM 119

    Working with Windows Remote Shell (WinRS) 120

    Configuring WinRM and WinRS Settings Through Group Policy 122

    Summary 125

    Part II Using PowerShell

    6 The PowerShell Language 129

    Expressions and Operators 129

    Expressions 130

    Operators 130

    Escape Sequences 143

    Error Handling 145

    Methods for Handling Errors in PowerShell 146

    Managing Elements with Arrays 151

    Creating Functions 157

    Understanding Filters 163

    Controlling Script Flow with Loops 164

    Using Logic and Making Decisions 167

    Building Scripts with Scriptblocks 170

    Summary 172

    7 PowerShell and Strings 173

    System.String 173

    [String] Type Accelerator 174

    Select-String Cmdlet 175

    Simple Operations 177

    System.String Members 178

    Contains Method 180

    EndsWith Method 180

    Insert Method 181

    Remove Method 181

    Replace Method 182

    Split Method 182

    StartsWith Method 182

    SubString Method 183

    ToLower Method 183

    ToString Method 183

    ToUpper Method 184

    Trim Method 184

    Length Property 185

    Wildcards

    Comparison Operators 190

    Regular Expressions 191

    Match/NotMatch Comparison Operator 191

    Replace Operators 192

    [RegEx] Type Accelerator 193

    2.0 CTP: Join and Split 194

    Join Operator 194

    Split Operator 195

    Format Operator 195

    Summary 196

    8 PowerShell and the File System 197

    Core Cmdlets 197

    Navigating the File System 198

    Get-Location Cmdlet 198

    Set-Location Cmdlet 198

    Push-Location Cmdlet 199

    Pop-Location Cmdlet 199

    Managing Drives 200

    Adding a Drive 200

    Removing a Drive 200

    Removing a Drive 201

    Managing Folders 201

    Adding a Folder 201

    Removing a Folder 202

    Moving a Folder 202

    Renaming a Folder 203

    Testing for a Folder 204

    Managing Files 205

    Creating a File 205

    Removing a File 205

    Moving a File 206

    Renaming a File 206

    Getting the Content of a File 206

    Setting the Content of a File 206

    Appending Content to a File 207

    Searching for Content in a File 207

    Testing for a File 208

    Working with XML Files 208

    Creating an XML File 209

    Appending an XML File 210

    Modifying an XML File 211

    Deleting from an XML File 212

    Loading an XML File 212

    Processing an XML File 213

    Using Import-CliXml and Export-CliXml 213

    Working with CSV Files 214

    Writing to a CSV File 216

    Scenario: Automating File System Management 216

    Summary 225

    9 PowerShell and Permissions 227

    WSH and Permissions 227

    SubInACL Functions 228

    PowerShell and Permissions 231

    PowerShell Functions 233

    Summary 238

    10 PowerShell and the Registry 239

    Registry Management in PowerShell 239

    Adding Other Hives 242

    Registry Transactions 243

    Getting Started 243

    New Cmdlets 244

    How It Works 245

    Example: Starting and Committing a Transaction 245

    Example: Starting and Undoing a Transaction 247

    Example: Performing a Transaction That Has Errors 248

    Simplifying Registry Management 249

    The LibraryRegistry.ps1 Script 249

    Using 2.0 CTP Features 262

    Scenario Details 262

    Running the Commands 263

    Cleaning Up 264

    Summary 265

    11 PowerShell and WMI 267

    Comparing WMI Usage Between WSH and PowerShell 269

    Using WMI in WSH 269

    Using WMI in PowerShell 271

    Working with WMI 274

    The PowerShell WMI Explorer 278

    Understanding Providers 278

    Understanding WQL 278

    PowerShell 2.0 Changes 280

    AuthenticationLevel and ImpersonationLevel 280

    Set-WMIInstance Cmdlet 282

    Invoke-WMIMethod Cmdlet 283

    Remove-WMIObject Cmdlet 284

    Scripting Scenario: MonitorMSVS.ps1 285

    Summary 291

    12 PowerShell Scripting Best Practices 293

    PowerShell Configuration and Usage Recommendations 293

    Digitally Sign PowerShell Scripts and Configuration Files 294

    Never Set Execution Policies to Unrestricted 294

    Try to Run Scripts with the Minimum Required Rights 294

    Centrally Manage PowerShell Remoting Security Settings in Your Enterprise 295

    Script Development 295

    Treat Scripting Projects as Actual Projects 295

    Use a Development Life Cycle Model 296

    Design and Prototype Your Scripts by Using Pseudocode 297

    Gather Script Requirements Effectively 297

    Don’t Develop Scripts in a Production Environment 297

    Test, Test, Test 298

    Keep Your Scripts Professional 298

    Script Design 299

    Put Configuration Information at the Beginning of Scripts 299

    Use Comments 300

    Avoid Hard-Coding Configuration Information 300

    When Necessary, Use Variables in One Place 301

    Provide Instructions 301

    Perform Validity Checking on Required Parameters 302

    Make Scripts and Functions Reusable 303

    Use Descriptive Names Rather Than Aliases 303

    Provide Status Information for Script Users 304

    Use the WhatIf and Confirm Parameters 305

    Standards for Scripting 306

    This Book’s Scripting Standards 307

    PowerShell Community Scripting Standards 308

    Summary 311

    Part III Managing Microsoft Technologies with PowerShell

    13 PowerShell as a Management Interface 315

    Getting Started 315

    Definitions 316

    The PowerShell SDK 316

    Installation Instructions 317

    Creating a Custom Cmdlet 320

    Naming Conventions 320

    Setting Up a Project 321

    Writing the Code 322

    Creating a Custom Snap-In 323

    Creating Custom Parameters 327

    Advanced Parameter Functionality 329

    Arrays 329

    Position 330

    Mandatory 331

    HelpMessage 331

    Alias 332

    Input Validation 332

    ValidateLength 332

    ValidateRange 333

    ValidatePattern 333

    ValidateSet 334

    ValidateCount 334

    Supporting Get-Help 335

    Header 335

    Name and Synopsis 335

    Syntax 336

    Detailed Description 337

    Parameters 337

    Input Type 338

    Return Type 338

    Notes 338

    Related Links 339

    Output 340

    Runspaces 341

    Scenario: Geocoding in MMC 3.0 344

    Get-Coordinates Cmdlet 344

    Get-Coordinates User Control 347

    Get-Coordinates MMC 349

    Summary 352

    14 PowerShell and Active Directory 353

    Understanding the Interfaces 353

    Managing Active Directory Using WSH 355

    Managing Active Directory Using PowerShell 356

    Managing Objects 361

    Binding 361

    Working with Objects 363

    Examples 365

    Searching for Objects 367

    SearchRoot 367

    Filter 367

    SearchScope 371

    PageSize 371

    SizeLimit 371

    PropertiesToLoad 372

    Putting It All Together 372

    Scripting Scenario: ChangeLocalAdminPassword.ps1 373

    Summary 386

    15 PowerShell and Exchange Server 2007 387

    Accessing the Exchange Management Shell (EMS) 388

    Using the Exchange Management Shell 389

    Working with Servers 390

    Working with Storage Groups 391

    Working with Databases 392

    Working with Recipients 394

    Scripting Scenario: GetDatabaseSizeReport.ps1 397

    Scripting Scenario: GetEvent1221Info.ps1 406

    Scripting Scenario: ProvisionExchangeUsers.ps1 416

    Summary 423

    16 PowerShell and System Center Operations Manager 2007 425

    Operations Manager PowerShell Integration 425

    The Command Shell 426

    The Object Tree 427

    Getting Help 431

    Operations Manager 2007 PowerShell Scripts 432

    Agent Cmdlets 432

    get-Agent 432

    install-agent 434

    uninstall-agent 435

    Task Cmdlets 436

    get-Task 437

    start-Task 438

    get-TaskResult 439

    Management Server Cmdlets 441

    get-ManagementServer 441

    set-ManagementServer 442

    get-DefaultSetting 443

    set-DefaultSetting 444

    Default Setting Paths 445

    Maintenance Mode Cmdlets 447

    new-MaintenanceWindow 448

    get-MaintenanceWindow 449

    set-MaintenanceWindow 451

    Comprehensive Operations Manager Cmdlet List 452

    Get/Set Cmdlets 452

    Add/Remove Cmdlets 454

    Enable/Disable Cmdlets 455

    Install/Uninstall Cmdlets 455

    Various Cmdlets 455

    Summary 456

    17 PowerShell 2.0 Features 457

    Remoting 458

    Understanding Remoting 459

    Executing Commands on a Remote Machine 460

    Background Jobs 466

    Graphical PowerShell 468

    Script Cmdlets 469

    Out-GridView Cmdlet 471

    Script Internationalization 472

    DATA Sections 473

    Modules 475

    Script Debugging 475

    Summary 477

    A The PSShell.ps1 Script 479

    Component One: Shell Replacement 480

    Step One: Creating the PSShell Secure Kiosk GPO 481

    Step Two: Configuring the Windows Shell Replacement Settings 481

    Component Two: PSShell.exe 482

    Component Three: PSShell.ps1 484

    Putting It All Together 489

    Index 491

    Preface

    Introduction

    Introduction

    Well, we are back for yet another PowerShell Unleashed book. However, unlike just a simple revision of the existing book, which most likely would have resulted in only just a few updated chapters, I decided to instead treat this release in the series as almost a completely new book. Granted, the Community Technology Release (CTP) of PowerShell 2.0 did help drive the need to update all aspects of this edition. Nonetheless, there was also a lot of feedback (some positive and some negative) about how the first book could be improved.

    So, based on this feedback and the looming PowerShell 2.0 feature list, I set about making a major revision to the book. To start off right, I decided to address how the PowerShell language was covered in the series. After all, the first book in the series was script heavy, but lacking when it came to explaining some of the basics about the PowerShell language. Additionally, we wanted to go into greater detail about how PowerShell could be used to manage Windows resources while further addressing some of the finer technical details of PowerShell’s architecture. Needless to say, all of these changes required a reorganization to not only the layout of the book, but also its size.

    The bottom line, in this new edition, there are six completely new chapters with the rest of the existing chapters either being extensively rewritten or updated. With all this extra content, the book needed additional authors to jump on board and help pound out the book’s technical prose. Thus, joining me on this book as coauthors were Marco Shaw (PowerShell MVP) and Peter Handley (contributing author from the first book). Together, Marco and Peter made great additions to this book and infused fantastic ideas together with even better content—all while writing their chapters.

    Finally, the primary goal of this book was to start down the path of explaining the features found in the future 2.0 release of PowerShell. After all, with the 2.0 CTP release late last year, the PowerShell product team ignited our imaginations with the possibilities for what might come down the road (remoting). So, we simply had to do our best to explain the new features. However, given that the 2.0 version is still just a CTP and not a beta, we also walked down a slippery slope, considering that some of these features may not exist in the PowerShell 2.0 RTM. Naturally, like a good reporter might do, we did our best. In the end, we tried to include 2.0 content where applicable while also dedicating an entire chapter to only 2.0 features deemed too important to ignore or voted most likely to survive the beta.

    We hope our efforts result in a more comprehensive PowerShell book that can act as both a reference for the current PowerShell 1.0 release while also providing insight into where PowerShell might go with the 2.0 release.

    Who Is This Book’s Intended Audience?

    This Unleashed book is intended for an intermediate level of systems administrators who have invested time and energy learning Windows scripting and want to translate those skills into PowerShell skills while learning how it can meet their real-world needs. This book has been written so that anyone with a scripting background can understand what PowerShell is and how to use it, but by no means is it meant to be a complete PowerShell reference. Instead, think of it as a resource for learning how PowerShell can be applied in your own environment. Therefore, the structure of this book reflects that focus by including numerous command examples and working scripts.

    How This Book Is Organized

    The book is divided into the following three parts:

    • Part I, “Introduction to PowerShell”—In this section, you are introduced to PowerShell and some of its internal workings. Topics covered include items such as why PowerShell came into existence, general concepts about PowerShell and how it is constructed, and an in-depth review of PowerShell security.
    • Part II, “Using PowerShell”—In this section, you learn more about the PowerShell scripting language, how to use PowerShell to manage Windows resources, and important best practices to follow when using PowerShell. Specific topics covered range from working with the Windows file system, the Registry, permissions, strings, and Windows Management Instrumentation (WMI) to understanding PowerShell language concepts such as loops, functions, arrays, and so on.
    • Part III, “Managing Microsoft Technologies with PowerShell”—In this section, you learn how PowerShell can be used to manage Microsoft technologies. Topics covered include using PowerShell to manage Active Directory, Exchange Server 2007, and Systems Center Operations Manager 2007. Additionally, you learn how to programmatically use PowerShell to manage systems and gain insight and understanding into important PowerShell 2.0 features.

    Conventions Used in This Book

    Commands, scripts, and anything related to code are presented in a special monospace computer typeface. Bold indicates key terms being defined, and italic is used to indicate variables or for emphasis. Great care has been taken to be consistent in letter case, naming, and structure, with the goal of making command and script examples more readable. In addition, you might find instances in which commands or scripts haven’t been fully optimized. This lack of optimization is for your benefit, as it makes those code samples more intelligible and follows the practice of writing code for others to read.

    Other standards used throughout this book are as follows:

    Black Code Boxes

    These code boxes contain commands that run in a PowerShell or Bash shell session.

    Gray Code Boxes

    These code boxes contain source code from scripts, configuration files, or other items that aren’t run directly in a shell session.

    Please note that although PowerShell can display text in multiple colors, all script output from the examples is printed here in black and white. If you run one of the example scripts on your lab system, the text will be displayed in color.


    CAUTION - Cautions alert you to actions that should be avoided.



    NOTE - Notes give you additional background information about a topic being discussed.


    © Copyright Pearson Education. All rights reserved.

    From the B&N Reads Blog

    Customer Reviews