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
- Some understanding of PowerShell
- Read about the Web Administration module
- There are some new PowerShell IIS cmdlets for IIS 10, see them here. What’s new in IIS 10?
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
2. Execute: Get-ExecutionPolicy
3. Execute: Set-ExecutionPolicy Unrestricted
4. Execute: import-module WebAdministration
5. Execute: cd IIS:
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.
b. Execute: Start-WebAppPool -name "CSharpGuitarBugs" -> dir, which starts the application pool again.
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
8. Change directory to the WorkerProcess directory and enter dir, what can you learn from the results presented?
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?
10. Navigate back to the root directory and execute: Stop-Website –name “CSharpGuitarBugs”
11. Restart the website by executing: Start-Website –name “CSharpGuitarBugs”
12. Execute: Get-Command –pssnapin WebAdministration or for a specific cmdlet execute: get-help <CmdLetName> for a list of all available methods.