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
- Open PowerShell as an Administrator
Figure 1, PowerShell WebAdministration Module
- Execute: Get-ExecutionPolicy
Figure 2, PowerShell WebAdministration Module
- Execute: Set-ExecutionPolicy Unrestricted
Figure 3, PowerShell WebAdministration Module
- Execute: import-module WebAdministration
Figure 4, PowerShell WebAdministration Module
- Execute: cd IIS:
Figure 5, PowerShell WebAdministration Module
- 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.
Figure 6, PowerShell WebAdministration Module
Figure 7, PowerShell WebAdministration Module
b. Execute: Start-WebAppPool -name “CSharpGuitarBugs” -> dir, which starts the application pool again.
Figure 8, PowerShell WebAdministration Module
- Execute: cd CSharpGuitarBugs -> dir, then access the CSharpGuitarBugs website and click the View By Manufacturer link. While the request is running, execute: Get-WebRequest
Figure 9, PowerShell WebAdministration Module
- Change directory to the WorkerProcess directory and enter dir, what can you learn from the results presented?
Figure 10, PowerShell WebAdministration Module
- 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?
Figure 11, PowerShell WebAdministration Module
- Navigate back to the root directory and execute: Stop-Website –name “CSharpGuitarBugs”
Figure 13, PowerShell WebAdministration Module
Figure 14, PowerShell WebAdministration Module
- Restart the website by executing: Start-Website –name “CSharpGuitarBugs”
Figure 15, PowerShell WebAdministration Module
- Execute: Get-Command –pssnapin WebAdministration or for a specific cmdlet execute: get-help for a list of all available methods.
Figure 16, PowerShell WebAdministration Module