Lab 8: PowerShell WebAdministration Module

Prerequisites

Setup

  • Install and Configure CSharpGuitarBugs on an IIS server as described in Lab 1

Lab

Review the features available in the PowerShell WebAdmnistration module

  1. Open PowerShell as an Administrator

image

Figure 1, PowerShell WebAdministration Module
  1. Execute: Get-ExecutionPolicy

image

Figure 2, PowerShell WebAdministration Module
  1. Execute: Set-ExecutionPolicy Unrestricted

image

Figure 3, PowerShell WebAdministration Module
  1. Execute: import-module WebAdministration

image

Figure 4, PowerShell WebAdministration Module
  1. Execute: cd IIS:

image

Figure 5, PowerShell WebAdministration Module
  1. Execute: cd AppPools -> dir

a. Execute: Stop-WebAppPool -name “CSharpGuitarBugs” -> dir, notice that the State of the application pool shows as stopped. You can also see the same in IIS.

image

Figure 6, PowerShell WebAdministration Module

image

Figure 7, PowerShell WebAdministration Module

b. Execute: Start-WebAppPool -name “CSharpGuitarBugs” -> dir, which starts the application pool again.

image

Figure 8, PowerShell WebAdministration Module
  1. Execute: cd CSharpGuitarBugs -> dir, then access the CSharpGuitarBugs website and click the View By Manufacturer link. While the request is running, execute: Get-WebRequest

image

Figure 9, PowerShell WebAdministration Module
  1. Change directory to the WorkerProcess directory and enter dir, what can you learn from the results presented?

image

Figure 10, PowerShell WebAdministration Module
  1. Navigate back up to the root directory and enter dir -> cd Sites -> dir and review the information provided, where can you find the same in the IIS management console? Can you find the same in the IIS configuration file? TIP: in the applicationHost.config file?

image

Figure 11, PowerShell WebAdministration Module
  1. Navigate back to the root directory and execute: Stop-Website –name “CSharpGuitarBugs”

image

Figure 13, PowerShell WebAdministration Module

image

Figure 14, PowerShell WebAdministration Module
  1. Restart the website by executing: Start-Website –name “CSharpGuitarBugs”

image

Figure 15, PowerShell WebAdministration Module
  1. Execute: Get-Command –pssnapin WebAdministration or for a specific cmdlet execute: get-help for a list of all available methods.

image

Figure 16, PowerShell WebAdministration Module