PowerShell 3.0 Advanced Administration Handbook

PowerShell 3.0 Advanced Administration Handbook
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Discover and understand the concept of Windows PowerShell 3.0
  • Learn the advanced topics and techniques for a professional PowerShell scripting
  • Explore the secret of building custom PowerShell snap-ins and modules
  • Take advantage of PowerShell integration capabilities with other technologies for better administration skills
  • Step-by-step guide rich with real-world script examples, screenshots, and best practices


Book Details

Language : English
Paperback : 370 pages [ 235mm x 191mm ]
Release Date : April 2013
ISBN : 1849686424
ISBN 13 : 9781849686426
Author(s) : Sherif Talaat, Haijun Fu
Topics and Technologies : All Books, Networking and Servers, Enterprise, Microsoft

Table of Contents

Chapter 1: Getting Started with PowerShell
Chapter 2: Developing Snap-ins for PowerShell
Chapter 3: Using PowerShell Remoting
Chapter 4: Extending Windows PowerShell
Chapter 5: Managing Core Infrastructure with PowerShell
Chapter 6: Managing Active Directory with PowerShell
Chapter 7: Managing the Server with PowerShell
Chapter 8: Managing Unified Communication Environments with PowerShell
Chapter 9: Managing Collaboration and Data Platforms with PowerShell
Chapter 10: Managing Microsoft Desktop Virtualization with PowerShell
Chapter 11: Managing Microsoft Cloud Platform with PowerShell
Chapter 12: Integrating Windows PowerShell and System Center Orchestrator
  • Chapter 1: Getting Started with PowerShell
    • Working with pipelines
      • Viewing the object structure
      • Using format cmdlets to change the output view
      • Using cmdlets to redirect data
    • Variables and objects
      • Using variables to store objects
      • Getting CIM objects
        • Listing CIM classes
        • Displaying details of the CIM classes
      • Creating .NET and COM objects
    • Looping and flow control
      • Comparison and logical operators
      • Conditional statements
      • Using switches to manage large conditional statements
      • Repeat operations with loops
        • The for statement
        • The foreach statement
        • Nested loops
    • Lists, arrays, and hash tables
    • Operating script block
      • Defining script blocks
      • Passing parameters and returning values
    • Functions
    • Scripts
      • Creating scripts
        • Invoking scripts
        • Passing parameters
        • Return values
      • Developing and maintaining script libraries
    • Discovering what's new in Windows PowerShell 3.0
    • Windows PowerShell Web Access (PSWA)
      • How PSWA works
      • Installing and configuring Windows PowerShell Web Access
        • Step 1 – installing the Windows PowerShell Web Access Windows feature
        • Step 2 – configuring Windows PowerShell Web Access Gateway
        • Step 3 – configuring the PowerShell Web Access authorization rules
    • Auto-loading of modules
    • Online and updatable Help
    • Scheduled jobs
    • The Show-Command cmdlet
    • Integrated Scripting Environment (ISE)
      • IntelliSense
      • Script snippets
        • How to use snippets
        • How to create/add new snippets
      • Add-on tools
      • Autosave and restart manager
    • PowerShell remoting
      • Disconnected session
      • Remoting on a public network
      • The custom session configuration file
    • Windows PowerShell Workflow (PSW)
      • Creating a workflow using PowerShell
      • Controlling PowerShell Workflow execution
    • Summary
    • Chapter 2: Developing Snap-ins for PowerShell
      • Creating a PowerShell snap-in
      • Writing a PowerShell snap-in
        • Creating a new class library project
        • Creating a PowerShell installer class
        • Creating a class file to include several PowerShell cmdlets
          • Declaring cmdlet parameters
          • Declaring parameter sets
          • Validating the parameter inputs
          • Overriding methods
      • Registering and removing a PowerShell snap-in
        • Registering and removing snap-in in PowerShell 1.0
        • Registering and removing a snap-in in PowerShell 3.0
      • Listing and executing cmdlets in a PowerShell snap-in
      • Debugging a PowerShell snap-in
      • Summary
      • Chapter 3: Using PowerShell Remoting
        • An overview of PowerShell remoting
        • Enabling/disabling remoting
          • Operating PowerShell in a no-domain environment
            • Setting the network location to Private
            • Enable PSRemoting
            • Configuring WSMan trusted hosts
          • Configuring PowerShell remoting on a domain using Group Policy
            • Allowing remote server management through WinRM
            • Allowing Windows Remote Management through Windows Firewall
            • Turning on Service Windows Remote Management (WS-Management)
            • Doing a Group Policy Update
          • Disabling remoting
        • Executing the remoting commands
          • Running ScriptBlock on a remote computer
          • Creating a persistent session with Invoke-Command
          • Running remote commands as a job
          • Specifying credentials required for remoting
        • Entering an interactive remoting session
          • Exiting an interactive session
          • Using a persistent session with interactive remoting
          • Starting interactive remoting with an existing session
          • Disconnecting and reconnecting sessions
        • Saving a remote session to a disk
          • Exporting a remote session to a module on a disk
          • Importing a module saved on a disk
          • Limitations of Export-PSSession
        • Using session configurations
          • Creating a new session configuration
          • Listing available session configurations
          • Custom permissions and PS session configurations
          • Invoking a custom session configuration
          • Disabling a session configuration
          • Deleting a session configuration
        • Summary
        • Chapter 4: Extending Windows PowerShell
          • Introduction to Windows PowerShell modules
          • PowerShell module types
            • Script modules
            • Binary modules
            • Manifest modules
            • Dynamic modules
          • The PSModulePath environment variable
            • Viewing the PSModulePath variable
            • Adding locations to the PSModulePath variable
          • Importing PowerShell modules
          • Removing PowerShell modules
          • Reloading PowerShell modules
          • Writing a PowerShell module
            • Creating script modules
            • Binary modules
            • Manifest modules
            • Dynamic modules
          • Storing modules on a disk
          • Working with multiple versions of modules
          • Checking PowerShell module dependencies
          • Signing PowerShell modules
            • Execution policies
            • Changing the execution policy
            • Script signing background
            • Setting up a self-signed certificate
            • Signing a module
          • Summary
          • Chapter 5: Managing Core Infrastructure with PowerShell
            • Preparing the operating system for first time use
              • Task 1 – changing the computer name
              • Task 2 – changing the time zone settings
              • Task 3 – setting the Network Interface Card (NIC) configuration
              • Task 4 – managing Windows Server roles and features
                • Example 1
                • Example 2
            • Deploying the Active Directory Domain Services (ADDS) role
              • Scenario 1 – installing a new Active Directory Forest
              • Scenario 2 – installing a new domain in an existing forest
              • Scenario 3 – installing a new domain controller in an existing domain
            • Managing and configuring the Domain Name System (DNS) role
              • Task 1 – configuring DNS server resource records
              • Task 2 – creating primary forward and reverse lookup zones
              • Task 3 – adding a DNS server forwarder
              • Task 4 – exporting DNS server zones
            • Deploying and configuring the Dynamic Host Configuration Protocol (DHCP) role
              • Task 1 – installing the DHCP server role
              • Task 2 – setting up the DHCP server scope
              • Task 3 – configuring DHCP scope options
              • Task 4 – configuring DHCP scope exclusion
              • Task 5 – configuring DHCP scope reservations
              • Task 6 – authorizing the DHCP server in Active Directory
            • Managing Windows Firewall
              • Task 1 – enabling or disabling Windows Firewall profiles
              • Task 2 – creating Windows Firewall rules
                • Example 1
                • Example 2
            • Using the Best Practice Analyzer (BPA)
              • Task 1 – displaying the list of best practice models
              • Task 2 – invoking a best practice model
              • Task 3 – showing the best practice model result
            • Summary
            • Chapter 6: Managing Active Directory with PowerShell
              • Active Directory-related concepts
                • Introduction to Active Directory
                • Namespace
                • Object
                • Container
                • Trees
                • Domain
              • Installing an Active Directory Domain Service (ADDS)
              • New AD server roles in Windows 2012
                • Active Directory Certificate Services
                • Active Directory Domain Services
                • Active Directory Lightweight Directory Services
                • Active Directory Rights Management Services
              • Managing Active Directory with PowerShell
                • Account management
                  • User management
                  • Computer management
                • Group management
                  • Viewing group permissions
                  • Creating a group
                  • Adding and removing members of a group
                • Organizational unit management
                  • Creating a new organizational unit
                  • Listing organizational units
                  • Renaming an organizational unit
                  • Modifying an organizational unit
                  • Moving an organizational unit
                  • Deleting an organizational unit
                • Domain controller management
                  • Finding a domain controller
                  • Finding a domain controller's site
                  • Finding the global catalog servers in a forest
              • Summary
              • Chapter 7: Managing the Server with PowerShell
                • Working with Server Manager cmdlets
                  • Adding roles or features by using PowerShell
                  • Advantages of PowerShell cmdlets for Server Manager
                • Managing networking using PowerShell
                • Managing Group Policy with PowerShell
                  • Importing a GroupPolicy module
                  • Creating GPOs with PowerShell
                • Managing IIS with PowerShell
                  • Creating a new website
                  • Modifying IIS binding
                  • Creating an FTP site
                  • Creating a virtual directory
                  • Creating a WebAppPool
                  • Backing up and restoring WebConfiguration
                • Managing a DNS server using PowerShell
                • Managing Hyper-V with PowerShell
                  • Installing Hyper-V on Windows Server 2012
                  • Creating a virtual machine
                  • Starting and stopping a virtual machine
                  • Modifying a virtual machine
                  • Operating a virtual machine snapshot
                • Managing AppLocker with PowerShell
                  • Importing the AppLocker PowerShell module
                  • Retrieving application information
                  • Retrieving an AppLocker policy
                  • Setting an AppLocker policy
                  • Generating rules for a given user or group
                  • Testing the AppLocker policy against a fileset
                • Summary
                • Chapter 8: Managing Unified Communication Environments with PowerShell
                  • What Exchange Management Shell is
                  • How to make Windows PowerShell understand Exchange Server cmdlets
                    • Option 1 – do it like EMS
                    • Option 2 – loading Exchange Server snap-ins
                  • Managing Exchange using PowerShell Remoting
                  • Getting started with Exchange scripting
                    • Scenario 1 – creating multiple mailboxes from CSV file
                    • Scenario 2 – creating a shared mailbox
                    • Scenario 3 – creating a resource (room/equipment) mailbox
                    • Scenario 4 – creating a distribution group
                    • Scenario 5 – defining a MailTip for a distribution group
                    • Scenario 6 – creating a dynamic distribution group
                    • Scenario 7 – creating multiple mailbox databases from a CSV file
                    • Scenario 8 – exporting mailboxes to PST files
                    • Scenario 9 – importing a mailbox from PST files
                    • Scenario 10 – hiding mailbox users from Global Address List (GAL)
                    • Scenario 11 – getting mailbox users who never accessed their mailboxes
                    • Scenario 12 – generating an organization mailbox statistics report
                    • Scenario 13 – generating a mailbox size report
                  • What Lync Server Management Shell is
                  • How to make PowerShell understand Lync Server cmdlets
                    • Loading a Lync Server module
                  • Managing Lync using PowerShell Remoting
                  • Getting started with Lync scripting
                    • Scenario 1 – enabling Lync to user accounts
                    • Scenario 2 – configuring IM file transfer filtering configuration
                    • Scenario 3 – configuring IM URL filtering
                    • Scenario 4 – bulk assignments of client PIN
                    • Scenario 5 – getting number of users using OCS/Lync
                    • Scenario 6 – setting the conference disclaimer
                  • Microsoft Office 365
                  • Office 365 and Windows PowerShell
                    • Managing Office 365 using PowerShell
                    • Managing Microsoft Exchange Online using PowerShell
                  • Summary
                  • Chapter 9: Managing Collaboration and Data Platforms with PowerShell
                    • What is SharePoint Management Shell
                    • How to make Windows PowerShell understand the SharePoint server cmdlets
                    • Getting started with SharePoint scripting
                      • Scenario 1 – creating a new site collection
                      • Scenario 2 – creating a new website
                      • Scenario 3 – creating a new quota template
                      • Scenario 4 – backing up your SharePoint environment
                    • Managing SharePoint Online using PowerShell
                      • How to load SharePoint Online Management Shell
                      • How to connect to SharePoint Online
                      • Scenario 1 – exporting a list of SharePoint Online sites to CSV
                      • Scenario 2 – restoring a deleted SharePoint Online site
                      • Scenario 3 – checking the SharePoint Online site's health status
                      • Scenario 4 – setting the SharePoint Online User as Site Collection Administrator
                    • Windows PowerShell Command Builder for SharePoint and Office 365
                    • What is SQL Server PowerShell
                      • How to load SQL Server PowerShell
                        • Method 1 – importing the SQL Server PowerShell module
                        • Method 2 – launching SQL Server PowerShell from SSMS
                    • Getting started with SQL Server scripting
                      • Scenario 1 – executing the T-SQL statement
                      • Scenario 2 – backing up the SQL Server database
                      • Scenario 3 – restoring the SQL Server database
                      • Scenario 4 – getting server instances and databases properties
                      • Scenario 5 – generating the SQL script for databases, tables, and stored procedures
                    • Summary
                    • Chapter 10: Managing Microsoft Desktop Virtualization with PowerShell
                      • What Desktop Virtualization is
                      • Understanding Desktop Virtualization components
                      • What Remote Desktop Services is
                      • Managing RDS using PowerShell
                      • Getting started with RDS scripting
                        • Scenario 1 – creating new RDS deployments
                          • Task 1.1 – creating a new virtual-machine-based deployment
                          • Task 1.2 – creating a new session-based deployment
                        • Scenario 2 – adding a Remote Desktop Server to an existing deployment
                        • Scenario 3 – adding and configuring an RD Gateway
                        • Scenario 4 – adding and configuring RD Licensing Server
                        • Scenario 5 – creating new RDS collections
                          • Task 5.1 – creating new session-based collections
                          • Task 5.2 – creating new VM-based collections
                        • Scenario 6 – setting session-based collection configuration
                        • Scenario 7 – setting VM-based collection configuration
                        • Scenario 8 – updating VM-based collections
                        • Scenario 9 – assigning Profile Disks to collections
                        • Scenario 10 – publishing Remote Desktop RemoteApp to collections
                        • Scenario 11 – configuring Remote Desktop Connection Broker for high availability
                      • Summary
                      • Chapter 11: Managing Microsoft Cloud Platform with PowerShell
                        • What Windows Azure is
                        • What Windows Azure PowerShell is
                        • Installing Windows Azure PowerShell
                        • Making Windows PowerShell understand Windows Azure cmdlets
                        • Connecting to your Windows Azure environment
                        • Getting started with Windows Azure scripting
                          • Scenario 1 – creating a new Azure Affinity Group
                          • Scenario 2 – creating a new Azure storage account
                          • Scenario 3 – assigning a storage account to an Azure subscription
                          • Scenario 4 – creating a new Azure Cloud Service
                          • Scenario 5 – creating a new SQL Azure Database Server
                          • Scenario 6 – creating a new SQL Azure database
                          • Scenario 7 – creating a new SQL Azure Database Server firewall rule
                          • Scenario 8 – provisioning the new Azure VM in Windows (quick mode)
                          • Scenario 9 – provisioning the new Azure VM in Linux (quick mode)
                          • Scenario 10 – provisioning the new Windows Azure VM (advanced mode)
                          • Scenario 11 – Adding a new endpoint to Windows Azure VM (NoLB)
                          • Scenario 12 – configuring the Windows Azure Virtual Machines load balancing (LB)
                          • Scenario 13 – creating and assigning a data disk to Windows Azure Virtual Machine
                          • Scenario 14 – moving the Local VHD to Windows Azure
                          • Scenario 15 – provisioning a new Windows Azure VM from a Disk
                          • Scenario 16 – creating Windows Azure Image from a VM
                          • Scenario 17 – exporting and importing Windows Azure VM
                          • Scenario 18 – starting, stopping, and restarting the Windows Azure VM
                          • Scenario 19 – uploading the certificate to Windows Azure
                          • Scenario 20 – generating the Azure Virtual Machine RDP file
                        • Summary

                          Sherif Talaat

                          Sherif Talaat  is a young Computer Science addict. He holds many technology certificates. Sherif is working in the ICT industry since 2005; he used to work on Microsoft's core infrastructure platforms and solutions, with more focus on IT process automation and scripting techniques.

                          Sherif is one of the early adopters of Windows PowerShell in the Middle East and Africa. He speaks about Windows PowerShell at technical events and user groups' gatherings. He is the founder of  Egypt PowerShell User Group ( http://egpsug.org) and the author of the first and only Arabic PowerShell blog (http:arabianpowershell.wordpress.com). He has been awarded the Microsoft  Mo Valuable Professional ( MVP) for PowerShell five times in a row since 2009.

                          You may also catch him at  sheriftalaat.com and follow him on Twitter @SherifTalaat .

                          He is also the author of PowerShell 3.0: Advanced Administration Handbook, Packt Publishing.

                          Haijun Fu

                          Haijun Fu is a computer programmer and an author living in China. He was educated at the Lanzhou University. He has been a Windows PowerShell Microsoft Most Valuable Professional (MVP) since 2011. With a strong focus on PowerShell, cloud computing, the next generation of Internet security, Internet technology development, software testing, and database design, he has been writing many articles in order to share his experience with others on his blog. He has over 7 years of experience in software development and system architecture design. He is skilled especially at systems analysis, architecture design, and software project management. In his spare time, he likes reading and writing. He is the author of two technical books called Windows PowerShell 2.0 Application Programming Best, Practices Publishing House of Electronics Industry in Mainland China and 350 PowerShell Utilize Example: Windows Automation Technology Manual in Taiwan. He can be found on the Web at fuhaijun.com and on Twitter as @fuhj02. You can also reach him by e-mail at PowerShell@live.cn.

                          Code Downloads

                          Download the code and support files for this book.

                          Submit Errata

                          Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                          - 1 submitted: last submission 29 May 2014

                          Errata type: Graphics | Page number: 34

                          The correct screenshot is as follows:

                          Sample chapters

                          You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                          Frequently bought together

                          PowerShell 3.0 Advanced Administration Handbook +    Microsoft Dynamics CRM 2011 Applications (MB2-868) Certification Guide =
                          50% Off
                          the second eBook
                          Price for both: €36.65

                          Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                          What you will learn from this book

                          • Learn Windows PowerShell 3.0 new features and enhancements
                          • Learn PowerShell syntax and grammar such as pipeline, looping, and working with objects
                          • Extend PowerShell capabilities with .NET framework, XML, WMI, and COM+
                          • Configure and deploy Windows Server Core features, services, and components
                          • Manage and configure the Microsoft virtualization platform, Hyper-V
                          • Manage and configure Unified Communication environments such as Exchange Server and Lync Server
                          • Manage and configure Collaboration and Data platforms such as SharePoint Server and SQL Server
                          • Manage and configure Cloud technologies such as Office’365, Windows Azure, and SQL Azure
                          • Explore PowerShell in real-world scenarios, problems, and solutions
                          • PowerShell tips and tricks and best practices

                          In Detail

                          Technology’s growing rhythm is running faster than before, and business needs are getting more complex every day. So, it is time to learn something new to help conquer the challenge. With PowerShell in your toolbox, you can easily perform many tasks with less time, effort, and cost. PowerShell is a helpful scripting technology that enables the automation of system management tasks and the creation of system management tools.

                          "PowerShell 3.0 Advanced Administration Handbook" comes with a set of real-world scenarios and detailed scripts that will help you get started with PowerShell, learn what PowerShell is, how to write the syntax, and build your scripts, and how to use and integrate PowerShell with different technologies, products, and tools.

                          This handbook starts with the essential topics of PowerShell, then introduces the new features in PowerShell 3.0. The book then goes through building PowerShell scripts, function, and developing extensions like snap-ins and modules, and continues with detailed examples showing the usage of PowerShell with different technologies and products to give you an idea of PowerShell usage in the real world.


                          This book is a collection of selected real-world scenarios, detailed solutions, and screenshots.

                          Who this book is for

                          If you are a system administrator who wants to automate repeated daily tasks and perform complex administration requirements in a timely manner with less effort, then this is the book for you.
                          In order to get the maximum benefit of this book you need to have some basic scripting knowledge and good administration experience.

                          Code Download and Errata
                          Packt Anytime, Anywhere
                          Register Books
                          Print Upgrades
                          eBook Downloads
                          Video Support
                          Contact Us
                          Awards Voting Nominations Previous Winners
                          Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                          Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software