Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

6.10. Lab

This chapter has probably covered more, and more difficult, new concepts than any chapter so far. Hopefully I was able to make it all make sense, but these exercises should help you cement everything. See if you can complete them all, and remember that there are companion videos and sample solutions at Some of these tasks will draw on skills you learned in previous chapters, as a way of refreshing your memory and keeping you sharp.

Identify a cmdlet that will produce a random number.

Identify a cmdlet that will display the current date and time.

What type of object does the cmdlet from task #2 produce? (What is the type name of the object produced by the cmdlet?)

Using the cmdlet from task #2 and Select-Object, display only the current day of the week in a table like this:


Identify a cmdlet that will display information about installed hotfixes.

Using the cmdlet from task #5, display a list of installed hotfixes. Sort the list by the installation date, and display only the installation date, the user who installed the hotfix, and the hotfix ID.

Repeat task #6, but this time sort the results by the hotfix description, and include the description, the hotfix ID, and the installation date. Put the results into an HTML file.

Display a list of the 50 newest entries from the Security event log (you can use a different log, such as System or Application, if your Security log is empty). Sort the list so that the oldest entries appear first, and so that entries made at the same time are sorted by their index. Display the index, time, and source for each entry. Put this information into a text file (not an HTML file, just a plain text file).


You are currently reading a PREVIEW of this book.


Get instant access to over $1 million worth of books and videos.


Start a Free 10-Day Trial

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint