Windows PowerShell™ 2.0: Administrator’s Pocket Consultant

Book description

Portable and precise, this pocket-sized guide delivers ready answers for automating everyday system-administration tasks with Windows PowerShell. Zero in on core commands and techniques using quick-reference tables, instructions, and lists. You’ll get the focused information you need to save time and get the job done—whether at your desk or in the field.

Get fast facts to:

  • Run core cmdlets—singly or in sequence—to streamline daily tasks

  • Execute remote commands and background jobs

  • Inventory computers; tweak configurations; manage domains

  • Configure server roles, role services, and features

  • Manage and troubleshoot TCP/IP networking

  • Administer file systems, directories, and print services

  • Implement security settings, event logs, and auditing

  • Read and write registry values

  • Automate system monitoring and performance tuning

  • Extend Windows PowerShell with snap-ins and module extensions

  • Table of contents

    1. Introduction
      1. Who Is This Book For?
      2. How Is This Book Organized?
      3. Conventions Used in This Book
      4. Find Additional Content Online
      5. Support
    2. 1. Introducing Windows PowerShell
      1. Getting Started with Windows PowerShell
      2. Running Windows PowerShell
        1. Using the Windows PowerShell Console
        2. Using the Windows PowerShell ISE
        3. Configuring Windows PowerShell Console Properties
        4. Working with the Command History
      3. Working with Cmdlets and Scripts
        1. Using Cmdlets
        2. Using Cmdlet Parameters
        3. Using External Commands
        4. Using Scripts
          1. Understanding Execution Policy
          2. Understanding Script Signing
          3. Creating and Using Self-Signed Certificates
    3. 2. Getting the Most from Windows PowerShell
      1. Initializing the Environment
        1. Passing Startup Parameters
        2. Invoking Windows PowerShell
        3. Using –Command to Run Commands
        4. Using –File to Run Scripts
        5. Using Nested Consoles
      2. Understanding Command Input, Parsing, and Output
        1. Basic Line Editing
        2. How Parsing Works
        3. Parsing Assigned Values
        4. Parsing Exceptions
        5. Output from Parsing
      3. Writing and Formatting Output
        1. Using Formatting Cmdlets
        2. Writing to Output Streams
          1. Explicitly Writing Output
          2. Using Other Output Streams
        3. Rendering and Finalizing the Output
        4. More on Redirecting Input, Output, and Error
    4. 3. Managing Your Windows PowerShell Environment
      1. Using Profiles
        1. Creating Profiles
        2. Understanding Execution Order
        3. Working with the Command Path
          1. Managing the Command Path
          2. Managing File Extensions and File Associations
      2. Navigating Windows PowerShell Extensions
        1. Working with Windows PowerShell Extensions
        2. Using Snap-ins
        3. Using Providers
        4. Navigating and Using Provider Drives
        5. Using Modules
        6. PowerShell Extensions for Exchange Server and SQL Server
    5. 4. Using Sessions, Jobs, and Remoting
      1. Enabling Remote Commands
      2. Executing Remote Commands
        1. Understanding Remote Execution
        2. Commands for Remoting
        3. Invoking Remote Commands
      3. Establishing Remote Sessions
        1. Invoking Sessions
        2. Understanding Remote Execution and Object Serialization
      4. Establishing Remote Background Jobs
        1. Using Background Jobs
        2. Starting Jobs in Interactive Sessions
        3. Running Jobs Noninteractively
      5. Working Remotely Without WinRM
    6. 5. Navigating Core Windows PowerShell Structures
      1. Working with Expressions and Operators
        1. Arithmetic, Grouping, and Assignment Operators
        2. Comparison Operators
        3. Other Operators
      2. Working with Variables and Values
        1. Variable Essentials
        2. Assigning and Converting Data Types
        3. Managing Variable Scopes
        4. Automatic, Preference, and Environment Variables
      3. Working with Strings
        1. Single-Quoted and Double-Quoted Strings
        2. Escape Codes and Wildcards
        3. Multiline Strings
        4. String Operators
      4. Working with Arrays and Collections
        1. Creating and Using One-Dimensional Arrays
        2. Using the Cast Array Structure
        3. Assigning and Removing Values
        4. Using Strict Types in Arrays
        5. Using Multidimensional Arrays
    7. 6. Mastering Aliases, Functions, and Objects
      1. Creating and Using Aliases
        1. Using the Built-In Aliases
        2. Creating Aliases
        3. Importing and Exporting Aliases
      2. Creating and Using Functions
        1. Creating Functions
        2. Using Extended Functions
        3. Using Filter Functions
        4. Digging Deeper into Functions
        5. Examining Function Definitions
        6. Using the Built-In Functions
      3. Working with Objects
        1. Object Essentials
        2. Object Methods and Properties
        3. Object Types
        4. Digging Deeper into Objects
      4. Working with COM and .NET Framework Objects
        1. Creating and Using COM Objects
        2. Working with .NET Framework Classes and Objects
      5. Working with WMI Objects and Queries
    8. 7. Managing Computers with Commands and Scripts
      1. Getting More from Your Scripts and Profiles
      2. Creating Transcripts
      3. Creating Transactions
        1. Understanding Transactions
        2. Using Transactions
      4. Common Elements in Scripts
        1. Using Comments and Initializing Statements
        2. Using Conditional Statements
          1. Using If, If...Else, and If...ElseIf...Else
          2. Using Switch
        3. Using Control Loops
    9. 8. Managing Roles, Role Services, and Features
      1. Server Manager Essentials
        1. Server Manager Commands
        2. Available Roles and Role Services
        3. Available Features
      2. Checking Installed Roles, Role Services, and Features
      3. Installing Roles, Role Services, and Features
        1. Adding Roles, Role Services, and Features
        2. Handling Configuration Errors and Other Issues
      4. Uninstalling Roles, Role Services, and Features
        1. Removing Roles, Role Services, and Features
        2. Handling Removal Errors and Other Issues
    10. 9. Inventorying and Evaluating Windows Systems
      1. Getting Basic System Information
        1. Determining the Current User, Domain, and Computer Name
        2. Determining and Setting the Date and Time
        3. Specifying Authentication Credentials
      2. Examining the System Configuration and the Working Environment
        1. Determining Windows Updates and Service Packs
        2. Obtaining Detailed System Information
        3. Determining Available Users and Groups
      3. Evaluating System Hardware
        1. Checking Firmware Versions and Status
        2. Checking Physical Memory and Processors
        3. Checking Hard Disks and Partitions
        4. Checking and Managing Device Drivers
        5. Digging In Even More
    11. 10. Managing File Systems, Security, and Auditing
      1. Managing PowerShell Drives, Directories, and Files
        1. Adding and Removing PowerShell Drives
        2. Creating and Managing Directories and Files
          1. Copying Directories and Files
          2. Moving Directories and Files
          3. Renaming Directories and Files
          4. Deleting Directories and Files
      2. Working with File Contents
        1. Commands for Managing File Contents
        2. Reading and Writing File Content
      3. Accessing Security Descriptors
        1. Commands for Working with Security Descriptors
        2. Getting and Setting Security Descriptors
        3. Working with Access Rules
      4. Configuring File and Directory Permissions
        1. Setting Basic Permissions
        2. Setting Special Permissions
        3. Taking Ownership
      5. Configuring File and Directory Auditing
    12. 11. Managing Shares, Printers, and TCP/IP Networking
      1. Managing Network Shares
        1. Getting Information About Shares
        2. Changing Share Settings
        3. Creating Shares
        4. Deleting Shares
      2. Managing Printers
        1. Getting Information About Printers
        2. Checking Printer Drivers
        3. Managing Printer Connections
      3. Managing TCP/IP Networking
        1. Getting Information About Network Adapters
        2. Configuring Static IP Addressing
        3. Configuring Dynamic IP Addressing
      4. Configuring Windows Firewall
        1. Viewing and Managing Windows Firewall Settings
        2. Adding and Removing Firewall Ports
    13. 12. Managing and Securing the Registry
      1. Understanding Registry Keys and Values
      2. Navigating the Registry
      3. Managing Registry Keys and Values
        1. Creating Registry Keys and Values
        2. Copying Registry Keys and Values
        3. Moving Registry Keys and Values
        4. Renaming Registry Keys and Values
        5. Deleting Registry Keys and Values
      4. Comparing Registry Keys
      5. Viewing and Managing Registry Security Settings
        1. Getting and Setting Registry Security Descriptors
        2. Working with Registry Access Rules
        3. Configuring Registry Permissions
        4. Taking Ownership of Registry Keys
      6. Auditing the Registry
    14. 13. Monitoring and Optimizing Windows Systems
      1. Managing Windows Events and Logs
        1. Working with Event Logs
        2. Viewing and Filtering Event Logs
        3. Setting Log Options
        4. Archiving and Clearing Event Logs
        5. Writing Custom Events to the Event Logs
        6. Creating and Using Saved Queries
      2. Managing System Services
        1. Viewing Configured Services
        2. Starting, Stopping, and Pausing Services
        3. Configuring Service Startup
        4. Managing Service Logon and Recovery Modes
          1. Configuring Service Logon
          2. Configuring Service Recovery
        5. Digging Deeper into Service Management
      3. Managing Computers
        1. Commands for Managing Computers
        2. Renaming Computer Accounts
        3. Joining Computers to a Domain
        4. Adding Computers to a Workgroup
        5. Removing Computers from Domains and Workgroups
        6. Managing the Restart and Shutdown of Computers
      4. Creating and Using System Restore Checkpoints
        1. Commands for Configuring System Restore
        2. Enabling and Disabling System Restore
        3. Creating and Using Checkpoints
        4. Recovering from Restore Points
    15. 14. Fine-Tuning System Performance
      1. Managing Applications, Processes, and Performance
        1. Understanding System and User Processes
        2. Examining Running Processes
        3. Filtering Process Output
        4. Viewing the Relationship Between Running Processes and Services
        5. Viewing Lists of DLLs Being Used by Processes
        6. Stopping Processes
        7. Digging Deeper into Processes
      2. Performance Monitoring
        1. Understanding Performance Monitoring Commands
        2. Tracking Performance Data
      3. Detecting and Resolving Performance Issues Through Monitoring
        1. Monitoring System Resource Usage and Processes
        2. Monitoring Memory Paging and Paging to Disk
        3. Monitoring Memory Usage and the Working Memory Set for Individual Processes
    16. About the Author
    17. Index
    18. About the Author
    19. Copyright

    Product information

    • Title: Windows PowerShell™ 2.0: Administrator’s Pocket Consultant
    • Author(s): William R. Stanek
    • Release date: May 2009
    • Publisher(s): Microsoft Press
    • ISBN: 9780735625952