Introduction to Essentials 2007



PowerGUI – Graphical User Interface for Windows PowerShell (HOLSW80)

Objectives

In this lab you will learn about PowerGUI – free extensible administrative UI built on top of Windows PowerShell. You will use PowerGUI to manage the local server and Active Directory environment, then learn how you can extend PowerGUI to make it suit your needs.

Prerequisite

Before working on this lab, you should be familiar with the basic concepts PowerShell and Active Directory Management.

Lab Setup

To complete this lab you will need one Virtual Server image

- AD cmdlets & PowerGUI (2k3dc1.2k3.dom) (10.3.0.1)

o Windows 2003 Server Enterprise

o Domain Controller

o DNS

o SQL 2005 Express Advanced

o Microsoft PowerShell

o Quest ActiveRoles Server

o PowerGUI

Estimated time to complete this lab: 30 minutes for all exercises.

Before You Begin

Before you begin the lab, you should make yourself familiar with the lab computers and setup. If you have not used Microsoft® Virtual PC 2004 images before please review the Virtual PC 2004 Overview below.

Microsoft® Virtual PC 2004 Overview

This lab makes use of Virtual PC 2004, which is an application that allows you to run multiple virtual computers on the same physical hardware. During the lab you will be running one or more Virtual PC images on a lab host computer.

During this lab the there may be multiple Virtual PC images running. Some may be running in full screen mode while others maybe run in windowed mode.  Here are some tips in navigating from the host desktop to each of your Virtual PC images:

Input focus for your mouse and keyboard passes to the Virtual PC when you click inside a Virtual PC window.

To move the input focus from a windowed Virtual PC to the desktop or another window move the mouse pointer outside the Virtual PC’s window and click on the relevant window or desktop location.

To logon () to a Virtual PC image use the ALT key to the right of the SPACEBAR + Delete. The ALT key to the right of the SPACEBAR is also known as the “Host Key” so the logon () command is “Host Key+Del”.

Note: Pressing while keyboard focus is on a Virtual PC will cause the Virtual PC’s host computer to capture the event rather than the Virtual PC.

To log on to the AD cmdlets & PowerGUI lab, the following credentials should be used:

• Domain: 2k3

• Username: Administrator

• Password: P@ssword

Getting Started

PowerShell, Active Directory cmdlets and PowerGUI have been installed for you. Use the virtual image provided to work through the following exercises.

Exercise 1

PowerGUI – Using the UI on Top of PowerShell

(Estimated Time to complete this Exercise: 10 minutes)

In this exercise we will use PowerGUI to access the underlying local system and Active Directory and see the PowerShell code behind our actions.

Note

Complete this exercise on the AD cmdlets & PowerGUI Virtual PC image.

1. If you have not done so already, start the virtual machine image, login as Administrator (the password is P@ssword).

2. On the desktop, double-click the PowerGUI icon to start the tool.

3. Expand the nodes in the left-hand pane tree to see the available functionality:

[pic]

4. Click Processes node, to see a list of processes running on the system:

[pic]

5. Click the third Toolbar button [pic] to open the Actions pane:

[pic]

6. On the Windows Start menu click Notepad.

7. In PowerGUI, right-click the processes node and click Refresh:

[pic]

8. Select notepad in the grid and click the Stop on the Actions pane:

[pic]

9. In the Options dialog box click OK.

10. The Notepad application closes.

11. Click the Filters button [pic] above the process list.

12. Set filters to only display processes with the number of Handles greater than 500 and WorkingSet greater than 5,000,000:

[pic]

13. Click Apply and see how the number of processes being displayed decreased (status bar shows you the number of objects displayed).

14. Click the caption of the Handles column to sort the set by the number of handles a process consumes:

[pic]

15. Click the PowerShell Code tab below the process list to switch to the code pane:

[pic]

16. See the code behind what we have just done (getting the processes, filtering and sorting them):

[pic]

17. Click the UI tab to get back to the process list.

18. To further explore the system, click DLLs in the Links pane to see dynamic libraries for these processes:

[pic]

19. PowerGUI now displays the libraries for these resource-intensive processes.

[pic]

20. Change the column order by dragging the ModuleName column caption to the left so it becomes the first column.

21. Right-click the table caption row to select the columns you want to be displayed. You can optionally also filter the entries or sort them by a particular property.

22. On the Actions: Common pane, click Report as HTML to create a simple HTML report based on what you see.

[pic]

23. Supply a filename, e.g. c:\report.html

[pic]

24. Click OK. An HTML report gets opened:

[pic]

25. Note that reports shows only the objects you had after filtering in the order you set by sorting them, and only the columns you selected are reported.

26. Close the browser window.

27. Select a few entries and click Copy to Clipboard on the Actions: Common pane:

[pic]

28. In the Windows Start menu, locate and start Notepad.

29. In Notepad, paste the text and see that these are the objects you selected in PowerGUI.

[pic]

Summary:

In this exercise you:

• Became familiar with PowerGUI.

• Saw how your administrative actions correspond to PowerShell code.

• Used PowerGUI for bulk administration and reporting tasks.

In next two exercises we'll learn how to use PowerGUI to manage Active Directory and how it can be extended based on your needs.

For more information, visit

Exercise 2

Using PowerGUI to Manage Active Directory

(Estimated Time to complete this Exercise: 10 minutes)

In this exercise we'll use PowerGUI to perform basic administrative tasks on Active Directory. PowerGUI will use AD cmdlets that you can use in command-line environment in another lab on this computer.

It is assumed that you already finished exercise 1 and became familiar with PowerGUI.

Note

Complete this exercise on the AD cmdlets & PowerGUI Virtual PC image.

1. If you have not done so already, start the virtual machine image, login as Administrator (the password is P@ssword), and start PowerGUI by double-clicking the icon on the desktop.

2. Expand the Active Directory node and click Users to see a list of user accounts:

[pic]

3. If you don’t see the right-hand pane, click the third Toolbar button [pic] to open the Actions.

4. Select John Lennon, Paul McCartney, Ringo Starr, and George Harrison and click Add to Group Action.

5. In the dialog box, specify the target group 2k3\Beatles and click OK:

[pic]

6. Select any of the four again and now click Groups in the Links pane.

7. As you can see, the users are now in the Beatles group:

[pic]

8. In the left-hand tree, click Groups to get a full list of AD groups.

9. Select Administrators and click the Members link:

[pic]

10. See that the group contains one user and two other groups:

[pic]

11. Get back to the group list by licking Groups in the path control above the list:

[pic]

12. Let's see the full list of all users belonging to the Administrators group even through membership in other groups. To do that, select Administrators again but this time click the Recursive Members link:

[pic]

13. Now PowerGUI goes through the Administrators group and all subgroups and produces a list of members of them all. Luckily Administrator turns out to be indeed the only member.

14. You can switch to the PowerShell Code tab to see the code behind this application logic.

15. Alternatively, you can click the arrow to the right of any of the links and actions, and click Properties on the shortcut menu to see the script or cmdlet behind the functionality. Tree node properties expose the PowerShell code behind the tree nodes.

16. In the next exercise we will learn how to change PowerGUI logic for your specific tasks.

Summary:

In this exercise you used PowerGUI to:

• Find users and groups.

• Add and remove users to/from groups.

• See direct and indirect group membership.

In the next exercises we'll learn how to extend PowerGUI beyond the functionality present in the product.

For more information, visit

Exercise 3

Extending PowerGUI

(Estimated Time to complete this Exercise: 10 minutes)

One of the most important features of PowerGUI is its extensibility allowing you to tailor the product to your specific needs. In this exercise we will learn to add new functionality to the application.

It is assumed that you already completed exercises 1 and 2, and became familiar with PowerGUI.

Note

Complete this exercise on the AD cmdlets & PowerGUI Virtual PC image.

1. If you have not done so already, start the virtual machine image, login as Administrator (the password is P@ssword), and start PowerGUI by double-clicking the icon on the desktop.

2. Expand the Active Directory node in the left-hand tree.

3. Right-click the Active Directory folder in the left-hand tree, and click New/Node on the shortcut menu.

4. The New Node dialog box is displayed.

5. Type in the name you want the node to have – e.g. My Users:

[pic]

6. Click into the Search box and start typing in keywords for the set of objects you would like the tool to display, for example users.

7. As you type, only cmdlets which have these keywords in their name or description are left in the list:

[pic]

8. Double-click the command you would like to be used for the node – e.g. Get-QADUser.

[pic]

9. Click OK to close the dialog box.

10. The new node gets selected and produces the list of users in this environment:

[pic]

11. Let's modify node parameters to limit the set of users it displays. Right click the new node (My Users), and click Properties on the shortcut menu.

12. Note that PowerGUI automatically retrieves command description, the set of parameters, and their help information.

13. In the Parameters section of the Properties dialog box, specify that we only need users whose Company is Beatles:

[pic]

14. Click OK to close the dialog box.

15. Notice that now, unlike the Users node, My Users only show the Beatles accounts:

[pic]

16. Also note that despite the fact that we have just added this new node, PowerGUI populated the Actions pane with the links and actions previously defined for user objects.

Note: You can use the same cmdlet search capabilities to specify links and actions. However, you can also supply a PowerShell script to be executed instead. Let us try this extensibility option by adding the New Group action.

17. In the left-hand pane, click the Groups node.

18. In the right-hand Actions pane, click the Add new item, then click Script Action on the shortcut menu.

[pic]

19. In the New Script Action dialog box, specify the action name (e.g. New Group) and type in the following script:

param($Name,$OrganizationalUnit,$Type,$Scope)

New-QADGroup -name $Name –ou $OrganizationalUnit –GroupType $Type –GroupScope $Scope

Note: The first line of the script defines the parameters the script will make the user supply, then goes the actual script code.

[pic]

20. Click OK to close the dialog box.

21. Click the newly added New Group action.

22. Supply the parameters, e.g.:

[pic]

23. Note that the group list now has the newly created group.

Summary:

In this exercise you learnt how to extend PowerGUI with the functionality you need with little or no scripting required.

Visit to download PowerGUI extensions that other community members created or to share your functionality with the community.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download