You are previewing Windows Server 2012 Automation with PowerShell Cookbook.
O'Reilly logo
Windows Server 2012 Automation with PowerShell Cookbook

Book Description

Over 110 recipes to automate Windows Server administrative tasks by using PowerShell

  • Extend the capabilities of your Windows environment

  • Improve the process reliability by using well defined PowerShell scripts

  • Full of examples, scripts, and real-world best practices

In Detail

Automating server tasks allows administrators to repeatedly perform the same, or similar, tasks over and over again. With PowerShell scripts, you can automate server tasks and reduce manual input, allowing you to focus on more important tasks.

Windows Server 2012 Automation with PowerShell Cookbook will show several ways for a Windows administrator to automate and streamline his/her job. Learn how to automate server tasks to ease your day-to-day operations, generate performance and configuration reports, and troubleshoot and resolve critical problems.

Windows Server 2012 Automation with PowerShell Cookbook will introduce you to the advantages of using Windows Server 2012 and PowerShell. Each recipe is a building block that can easily be combined to provide larger and more useful scripts to automate your systems. The recipes are packed with examples and real world experience to make the job of managing and administrating Windows servers easier.

The book begins with automation of common Windows Networking components such as AD, DHCP, DNS, and PKI, managing Hyper-V, and backing up the server environment. By the end of the book you will be able to use PowerShell scripts to automate tasks such as performance monitoring, reporting, analyzing the environment to match best practices, and troubleshooting.

Table of Contents

  1. Windows Server 2012 Automation with PowerShell Cookbook
    1. Table of Contents
    2. Windows Server 2012 Automation with PowerShell Cookbook
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
        3. Instant Updates on New Packt Books
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Errata
        2. Piracy
        3. Questions
    8. 1. Understanding PowerShell Scripting
      1. Introduction
      2. Managing security on PowerShell scripts
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Creating and using functions
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Creating and using modules
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Creating and using PowerShell profiles
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      6. Passing variables to functions
        1. How to do it...
        2. How it works...
        3. There's more...
      7. Validating parameters in functions
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Piping data to functions
        1. How to do it...
        2. How it works...
        3. There's more...
      9. Recording sessions with transcripts
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Signing PowerShell scripts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      11. Sending e-mail
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      12. Sorting and filtering
        1. How to do it...
        2. How it works...
      13. Using formatting to export numbers
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      14. Using formatting to export data views
        1. How to do it...
        2. How it works...
      15. Using jobs
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      16. Dealing with errors in PowerShell
        1. How to do it...
        2. How it works...
        3. There's more...
      17. Tuning PowerShell scripts for performance
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      18. Creating and using Cmdlets
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more
        5. See also
    9. 2. Managing Windows Network Services with PowerShell
      1. Introduction
      2. Configuring static networking
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Installing domain controllers
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Configuring zones in DNS
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      5. Configuring DHCP scopes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Configuring DHCP server failover
        1. Getting ready
        2. How to do it...
        3. How it works...
      7. Converting DHCP addresses to static
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Building out a PKI environment
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
      9. Creating AD users
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Searching for and reporting on AD users
        1. How to do it...
        2. How it works...
      11. Finding expired computers in AD
        1. How to do it...
        2. How it works...
        3. See also
      12. Creating and e-mailing a superuser report
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
    10. 3. Managing IIS with PowerShell
      1. Introduction
      2. Installing and configuring IIS
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Configuring IIS for SSL
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Configuring a Central Certificate Store
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Configuring IIS bindings
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Configuring IIS logging
        1. How to do it...
        2. How it works...
      7. Managing log files
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Configuring NLB across multiple servers
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Monitoring load balancing across NLB nodes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      10. Placing NLB nodes into maintenance
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      11. Configuring a development/staging/production site scheme
        1. Getting ready
        2. How to do it...
        3. How it works...
      12. Promoting content in websites
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      13. Reporting on website access and errors
        1. How to do it...
        2. How it works...
        3. There's more...
    11. 4. Managing Hyper-V with PowerShell
      1. Introduction
      2. Installing and configuring Hyper-V
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Configuring NUMA
        1. Getting Ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Securing Hyper-V
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      5. Hyper-V networking
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Creating virtual machines
        1. Getting ready
        2. How to do it...
        3. How it works...
      7. Managing VM state
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Configuring VM networking
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Configuring VM hardware
        1. Getting ready
        2. How to do it...
        3. How it works...
      10. Quickly deploying VMs using a template
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Managing and reporting on VM snapshots
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      12. Monitoring Hyper-V utilization and performance
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      13. Synchronizing networks between Hyper-V hosts
        1. Getting ready
        2. How to do it...
        3. How it works...
      14. Hyper-V replication
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      15. Migrating VMs between hosts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      16. Migrating VM storage between hosts
        1. Getting ready
        2. How to do it...
        3. How it works...
      17. Using failover clustering to make VMs highly available
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    12. 5. Managing Storage with PowerShell
      1. Introduction
      2. Managing NTFS file permissions
        1. Getting ready
        2. How to do it...
          1. Editing the permissions on an Excel spreadsheet
          2. Cloning permissions for a new folder
          3. Taking ownership and reassigning permissions
          4. Enabling and disabling inheritance
        3. How it works...
      3. Managing NTFS alternate streams
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Configuring NTFS deduplication
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Monitoring NTFS deduplication
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Configuring storage pools
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      7. Reporting on storage pools
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Managing file quotas
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
    13. 6. Managing Network Shares with PowerShell
      1. Introduction
      2. Creating and securing CIFS shares
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Accessing CIFS shares from PowerShell
        1. Getting ready
        2. How to do it...
        3. How it works...
      4. Creating iSCSI target and virtual disk
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Using a iSCSI disk
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Configuring and using iSNS
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Creating an NFS export
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      8. Mounting NFS exports
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
      9. Making CIFS shares highly available
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      10. Configuring DFS and DFSR replication
        1. Getting ready
        2. How to do it...
        3. How it works...
      11. Configuring BranchCache
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    14. 7. Managing Windows Updates with PowerShell
      1. Introduction
      2. Installing Windows Server Update Services
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Configuring WSUS update synchronization
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more...
      4. Configuring the Windows update client
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Creating computer groups
        1. Getting ready
        2. How to do it...
        3. How it works...
      6. Configuring WSUS auto-approvals
        1. Getting ready
        2. How to do it...
        3. How it works...
      7. Reporting missing updates
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Installing updates
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Uninstalling updates
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      10. Configuring WSUS to inventory clients
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Creating an update report
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      12. Exporting WSUS data to Excel
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
    15. 8. Managing Printers with PowerShell
      1. Introduction
      2. Setting up and sharing printers
        1. Getting ready
        2. How to do it...
        3. How it works...
      3. Changing printer drivers
        1. Getting ready
        2. How to do it...
        3. How it works...
      4. Reporting on printer security
        1. Getting ready
        2. How to do it...
        3. How it works...
      5. Adding and removing printer security
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Mapping clients to printers
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      7. Enabling Branch Office Direct Printing
        1. Getting ready
        2. How to do it...
        3. How it works...
      8. Reporting on printer usage
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
    16. 9. Troubleshooting Servers with PowerShell
      1. Introduction
      2. Testing if a server is responding
        1. Getting started
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Using troubleshooting packs
        1. Getting ready
        2. How to do it
        3. How it works...
        4. There's more...
      4. Using Best Practices Analyzers
        1. Getting started
        2. How to do it...
        3. How it works...
        4. There's more...
      5. Searching event logs for specific events
        1. Getting started
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Forwarding event logs to a central log server
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
    17. 10. Managing Performance with PowerShell
      1. Introduction
      2. Reading performance counters
        1. Getting ready
        2. How to do it...
        3. How it works...
      3. Configuring Data Collector Sets
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Reporting on performance data
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      5. Generating graphs
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Creating a server performance report
        1. Getting ready
        2. How to do it...
        3. How it works...
    18. 11. Inventorying Servers with PowerShell
      1. Introduction
      2. Inventorying hardware with PowerShell
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Inventorying the installed software
        1. How to do it...
        2. How it works...
      4. Inventory system configuration
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      5. Reporting on system security
        1. Getting ready
        2. How to do it...
        3. How it works...
      6. Creating a change report
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      7. Exporting a configuration report to Word
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    19. 12. Server Backup
      1. Introduction
      2. Configuring backup policies
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Initiating backups manually
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Restoring files
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      5. Restoring Windows system state
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Restoring application data
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      7. Creating a daily backup report
        1. Getting ready
        2. How to do it...
        3. How it works...
    20. Index