Lab 8: PowerShell WebAdministration Module

This article has been moved to its new home here: https://benperk.github.io/msdn/2016/2016-IISLAB-lab-8-powershell-webadministration-module.html

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

2.  Execute: Get-ExecutionPolicy

image

3.  Execute: Set-ExecutionPolicy Unrestricted

image

4.  Execute: import-module WebAdministration

image

5.  Execute: cd IIS:

image

6.  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 image

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

image

7.  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

8.  Change directory to the WorkerProcess directory and enter dir, what can you learn from the results presented?

image

9.  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

10. Navigate back to the root directory and execute: Stop-Website –name “CSharpGuitarBugs”

image image

11. Restart the website by executing: Start-Website –name “CSharpGuitarBugs”

image

12. Execute: Get-Command –pssnapin WebAdministration or for a specific cmdlet execute: get-help <CmdLetName> for a list of all available methods.

image