Lab Module 2
Lab Module 2
Formatting System
Module 2
Contents:
Lab: Using the Formatting Subsystem
Exercise 1: Displaying Calculated Properties
Exercise 2: Displaying a Limited Number of Columns
Exercise 3: Displaying All Properties and Values of Objects
Exercise 4: Viewing Objects via HTML
Exercise 5: Displaying a Limited Number of Properties
Exercise 6: Displaying Objects Using Different Formatting
Exercise 7: Displaying a Sorted List of Objects
Lab: Using the Formatting Subsystem
Estimated time: 20 minutes
You are a system administrator for a company and work with a team of developers.Recently,
some users have complained about an in-house developed application. The developers have
asked you to monitor the processes associated with the troubled application and let them have
easy access to the data. You have decided to provide them with that information via an HTML-
based page so they can easily view the information in a Web browser. You also want to
customize your view of this information as you view it in the PowerShell console.
Lab Setup
For this lab, you will use the available virtual machine environment. Before you begin the lab,
you must:
1. Start the AD virtual machine. You don’t need to log on but wait until the boot process is
complete.
• Username: CONTOSO\administrator
• Password: Pa$$w0rd
2. Open a Windows PowerShell session as Administrator.
Exercise 1: Displaying Calculated Properties
Scenario
You need to check the status of processes on your server, and you want to display their status
and also show custom properties in a table format.The main tasks for this exercise are as follows:
1. Retrieve a list of processes.
2. Display a table of objects.
3. Select the properties to display.
4. Use calculated properties to show a custom property.
Hint: Just add the values together—don’t be concerned if one is displayed in KB and
the other in MB.
Results: After this exercise, you will have displayed the CPU, ID and ProcessName values of all
the running processes. You also will have created a custom property adding the physical and
virtual memory using calculated properties.
Exercise 2: Displaying a Limited Number of Columns
Scenario
You need to display a list of services on your systems. You need to filter out some of the
columns that you don’t need when reviewing the status of the services.The main tasks for this
exercise are as follows:
1. Retrieve a list of services.
2. Display a specific number of columns from a collection of objects.
Results: After this exercise, you will have displayed a specific number of columns from all the
installed services instead of displaying all their default properties.
� Task 2: Display every property and value for all the objects
• Retrieve a list of processes and display all their properties and values.
Results: After this exercise, you will have displayed all of the properties of all of the running
processes instead of displaying only their default properties.
Results: After this exercise, you will have displayed a customized HTML page that contains a
listing of the 25 newest events from the Windows Application event log.
Results: After this exercise, you will have displayed a table containing the Name, Length and
Extension properties of all the files in C:\Windows\System32 that start with au and have the
extension .dll.
Results: After this exercise, you will have displayed a table of all the installedservices by
displaying only the DisplayName, Status, and DependentServices properties. You have also
removed any empty spaces between each column.
Results: After this exercise, you will have displayed a table of the installed services sorted by
their Status property.