Windows PowerShell Unleashed (Unleashed) (2ND)

Windows PowerShell Unleashed (Unleashed) (2ND)

  • Sams(2008/12発売)
  • ただいまウェブストアではご注文を受け付けておりません。 ⇒古書を探す
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 509 p.
  • 言語 ENG
  • 商品コード 9780672329883
  • DDC分類 005.282

Full Description


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 remotingDownload all examples and source code presented in this book from informit.com/title/9780672329883.

Contents

Introduction 1Part I Introduction to PowerShell1 Introduction to Shells 7What Is a Shell? 7Basic Shell Use 8Basic Shell Scripts 11A Shell History 15Enter PowerShell 16New Capabilities in PowerShell 2.0 CTP2 18Summary 192 Basic PowerShell Concepts 21Getting Started 21PowerShell 1.0 RTW 22PowerShell 2.0 CTP2 23Before Installing PowerShell 2.0 CTP2 23Downloading and Installing PowerShell 2.0 25Understanding the Command-Line Interface (CLI) 28Navigating the CLI 30Tab Key Auto-Completion in PowerShell 30Understanding Cmdlets 32Common Parameters 33Getting Help 34Get-Help 34Cmdlet Help Topics 36Get-Command 36Understanding Variables 39Built-In Variables 40Understanding Aliases 42Discovering Alias Cmdlets 43Creating Persistent Aliases 44Creating Your First Script 45Summary 473 Advanced PowerShell Concepts 49Working with the .NET Framework 51Using the New-Object Cmdlet 53Understanding Assemblies 54Understanding Reflection 56Understanding the Pipeline 59Powerful One-Liners 63The Extended Type System (ETS) 65Understanding the Add-Member Cmdlet 67Understanding the types.ps1xml File 68Working with Types 68Type Accelerators 71Summary 724 Other Key PowerShell Concepts 73Formatting Output 73The Formatting Cmdlets 74PowerShell's Formatting under the Hood 74Customizing Output Formats 75Providers 79Accessing Drives and Data 82Mounting a Drive 85Profiles 87The All Users Profile 87The All Users Host-Specific Profile 87The Current User's Profile 88The Current User's Host-Specific Profile 88Scopes 88The Global Scope 88The Local Scope 89The Script Scope 89The Private Scope 90Dot Sourcing 91Library Files 91Summary 975 Understanding PowerShell Security 99PowerShell Default Security 100Execution Policies 100Restricted 100AllSigned 101RemoteSigned 101Unrestricted 103Setting the Execution Policy 103Code Signing 105What Is Code Signing? 106Obtaining a Code-Signing Certificate 107The PVK Digital Certificate Files Importer 112Signing PowerShell Scripts 112Verifying Digital Signatures 113Signed Code Distribution 115Enterprise Code Distribution 117Public Code Distribution 117PowerShell Security Best Practices 118Digitally Sign PowerShell Scripts and Configuration Files 118Never Set Execution Policies to Unrestricted 118Try to Run Scripts with the Minimum Required Rights 118PowerShell 2.0 CTP2 and Windows Remote Management (WinRM) 119Configuring WinRM 119Working with Windows Remote Shell (WinRS) 120Configuring WinRM and WinRS Settings Through Group Policy 122Summary 125Part II Using PowerShell6 The PowerShell Language 129Expressions and Operators 129Expressions 130Operators 130Escape Sequences 143Error Handling 145Methods for Handling Errors in PowerShell 146Managing Elements with Arrays 151Creating Functions 157Understanding Filters 163Controlling Script Flow with Loops 164Using Logic and Making Decisions 167Building Scripts with Scriptblocks 170Summary 1727 PowerShell and Strings 173System.String 173[String] Type Accelerator 174Select-String Cmdlet 175Simple Operations 177System.String Members 178Contains Method 180EndsWith Method 180Insert Method 181Remove Method 181Replace Method 182Split Method 182StartsWith Method 182SubString Method 183ToLower Method 183ToString Method 183ToUpper Method 184Trim Method 184Length Property 185Wildcards Comparison Operators 190Regular Expressions 191Match/NotMatch Comparison Operator 191Replace Operators 192[RegEx] Type Accelerator 1932.0 CTP: Join and Split 194Join Operator 194Split Operator 195Format Operator 195Summary 1968 PowerShell and the File System 197Core Cmdlets 197Navigating the File System 198Get-Location Cmdlet 198Set-Location Cmdlet 198Push-Location Cmdlet 199Pop-Location Cmdlet 199Managing Drives 200Adding a Drive 200Removing a Drive 200Removing a Drive 201Managing Folders 201Adding a Folder 201Removing a Folder 202Moving a Folder 202Renaming a Folder 203Testing for a Folder 204Managing Files 205Creating a File 205Removing a File 205Moving a File 206Renaming a File 206Getting the Content of a File 206Setting the Content of a File 206Appending Content to a File 207Searching for Content in a File 207Testing for a File 208Working with XML Files 208Creating an XML File 209Appending an XML File 210Modifying an XML File 211Deleting from an XML File 212Loading an XML File 212Processing an XML File 213Using Import-CliXml and Export-CliXml 213Working with CSV Files 214Writing to a CSV File 216Scenario: Automating File System Management 216Summary 2259 PowerShell and Permissions 227WSH and Permissions 227SubInACL Functions 228PowerShell and Permissions 231PowerShell Functions 233Summary 23810 PowerShell and the Registry 239Registry Management in PowerShell 239Adding Other Hives 242Registry Transactions 243Getting Started 243New Cmdlets 244How It Works 245Example: Starting and Committing a Transaction 245Example: Starting and Undoing a Transaction 247Example: Performing a Transaction That Has Errors 248Simplifying Registry Management 249The LibraryRegistry.ps1 Script 249Using 2.0 CTP Features 262Scenario Details 262Running the Commands 263Cleaning Up 264Summary 26511 PowerShell and WMI 267Comparing WMI Usage Between WSH and PowerShell 269Using WMI in WSH 269Using WMI in PowerShell 271Working with WMI 274The PowerShell WMI Explorer 278Understanding Providers 278Understanding WQL 278PowerShell 2.0 Changes 280AuthenticationLevel and ImpersonationLevel 280Set-WMIInstance Cmdlet 282Invoke-WMIMethod Cmdlet 283Remove-WMIObject Cmdlet 284Scripting Scenario: MonitorMSVS.ps1 285Summary 29112 PowerShell Scripting Best Practices 293PowerShell Configuration and Usage Recommendations 293Digitally Sign PowerShell Scripts and Configuration Files 294Never Set Execution Policies to Unrestricted 294Try to Run Scripts with the Minimum Required Rights 294Centrally Manage PowerShell Remoting Security Settings in Your Enterprise 295Script Development 295Treat Scripting Projects as Actual Projects 295Use a Development Life Cycle Model 296Design and Prototype Your Scripts by Using Pseudocode 297Gather Script Requirements Effectively 297Don't Develop Scripts in a Production Environment 297Test, Test, Test 298Keep Your Scripts Professional 298Script Design 299Put Configuration Information at the Beginning of Scripts 299Use Comments 300Avoid Hard-Coding Configuration Information 300When Necessary, Use Variables in One Place 301Provide Instructions 301Perform Validity Checking on Required Parameters 302Make Scripts and Functions Reusable 303Use Descriptive Names Rather Than Aliases 303Provide Status Information for Script Users 304Use the WhatIf and Confirm Parameters 305Standards for Scripting 306This Book's Scripting Standards 307PowerShell Community Scripting Standards 308Summary 311Part III Managing Microsoft Technologies with PowerShell13 PowerShell as a Management Interface 315Getting Started 315Definitions 316The PowerShell SDK 316Installation Instructions 317Creating a Custom Cmdlet 320Naming Conventions 320Setting Up a Project 321Writing the Code 322Creating a Custom Snap-In 323Creating Custom Parameters 327Advanced Parameter Functionality 329Arrays 329Position 330Mandatory 331HelpMessage 331Alias 332Input Validation 332ValidateLength 332ValidateRange 333ValidatePattern 333ValidateSet 334ValidateCount 334Supporting Get-Help 335Header 335Name and Synopsis 335Syntax 336Detailed Description 337Parameters 337Input Type 338Return Type 338Notes 338Related Links 339Output 340Runspaces 341Scenario: Geocoding in MMC 3.0 344Get-Coordinates Cmdlet 344Get-Coordinates User Control 347Get-Coordinates MMC 349Summary 35214 PowerShell and Active Directory 353Understanding the Interfaces 353Managing Active Directory Using WSH 355Managing Active Directory Using PowerShell 356Managing Objects 361Binding 361Working with Objects 363Examples 365Searching for Objects 367SearchRoot 367Filter 367SearchScope 371PageSize 371SizeLimit 371PropertiesToLoad 372Putting It All Together 372Scripting Scenario: ChangeLocalAdminPassword.ps1 373Summary 38615 PowerShell and Exchange Server 2007 387Accessing the Exchange Management Shell (EMS) 388Using the Exchange Management Shell 389Working with Servers 390Working with Storage Groups 391Working with Databases 392Working with Recipients 394Scripting Scenario: GetDatabaseSizeReport.ps1 397Scripting Scenario: GetEvent1221Info.ps1 406Scripting Scenario: ProvisionExchangeUsers.ps1 416Summary 42316 PowerShell and System Center Operations Manager 2007 425Operations Manager PowerShell Integration 425The Command Shell 426The Object Tree 427Getting Help 431Operations Manager 2007 PowerShell Scripts 432Agent Cmdlets 432get-Agent 432install-agent 434uninstall-agent 435Task Cmdlets 436get-Task 437start-Task 438get-TaskResult 439Management Server Cmdlets 441get-ManagementServer 441set-ManagementServer 442get-DefaultSetting 443set-DefaultSetting 444Default Setting Paths 445Maintenance Mode Cmdlets 447new-MaintenanceWindow 448get-MaintenanceWindow 449set-MaintenanceWindow 451Comprehensive Operations Manager Cmdlet List 452Get/Set Cmdlets 452Add/Remove Cmdlets 454Enable/Disable Cmdlets 455Install/Uninstall Cmdlets 455Various Cmdlets 455Summary 45617 PowerShell 2.0 Features 457Remoting 458Understanding Remoting 459Executing Commands on a Remote Machine 460Background Jobs 466Graphical PowerShell 468Script Cmdlets 469Out-GridView Cmdlet 471Script Internationalization 472DATA Sections 473Modules 475Script Debugging 475Summary 477A The PSShell.ps1 Script 479Component One: Shell Replacement 480Step One: Creating the PSShell Secure Kiosk GPO 481Step Two: Configuring the Windows Shell Replacement Settings 481Component Two: PSShell.exe 482Component Three: PSShell.ps1 484Putting It All Together 489Index 491

最近チェックした商品