Вы находитесь на странице: 1из 56

3.

5
User Guide

2012 Quest Software, Inc. ALL RIGHTS RESERVED.


This guide contains proprietary information protected by copyright. The software described in this guide is furnished under a software license or nondisclosure agreement. This software may be used or copied only in accordance with the terms of the applicable agreement. No part of this guide may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording for any purpose other than the purchasers personal use without the written permission of Quest Software, Inc. If you have any questions regarding your potential use of this material, contact: Quest Software World Headquarters LEGAL Dept 5 Polaris Way Aliso Viejo, CA 92656 www.quest.com Email: legal@quest.com Refer to our Web site (www.quest.com) for regional and international office information.

TRADEMARKS
Quest, Quest Software, the Quest Software logo, Simplicity at Work are trademarks and registered trademarks of Quest Software, Inc. For a complete list of Quest Software's trademarks, please see http://www.quest.com/legal/trademark-information.aspx. Other trademarks and registered trademarks are property of their respective owners.

DISCLAIMER
The information in this document is provided in connection with Quest products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Quest products. EXCEPT AS SET FORTH IN QUEST'S TERMS AND CONDITIONS AS SPECIFIED IN THE LICENSE AGREEMENT FOR THIS PRODUCT, QUEST ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL QUEST BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF QUEST HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Quest makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Quest does not make any commitment to update the information contained in this document.

For More Information


Get the latest product information, find helpful resources, test the product betas, and join a discussion with the PowerGUI Quest team and other community members. Join the PowerGUI community at http://powergui.org.

PowerGUI Version 3.5 Last updated May 2, 2012

Contents
About This Guide..................................................................................................... 5
Overview ............................................................................................................................ 5 Conventions ............................................................................................................... 5

Introduction ............................................................................................................. 6 PowerGUI Setup ...................................................................................................... 7


System Requirements ....................................................................................................... 7 Installing PowerGUI ........................................................................................................... 8 Running with PowerShell 3.0 ..................................................................................... 8 Silent Installation ........................................................................................................ 9 USB Flash Drive Installation .................................................................................... 10

Working with the PowerGUI Administrative Console ......................................... 12


Concepts .......................................................................................................................... 12 Launching Admin Console in Authoring Mode ................................................................ 13 Organizing Data: Nodes .................................................................................................. 13 Using Customizable HTML Pages: Details Tab .............................................................. 14 Working with Results: Results Tab .................................................................................. 16 Working With Results: Chart Tab .................................................................................... 18 Using Actions ................................................................................................................... 20 Working with PowerPacks ............................................................................................... 21 Discovering and Installing PowerPacks .................................................................. 22 Downloading, Importing and Exporting PowerPacks .............................................. 22 Creating PowerPacks .............................................................................................. 23 Sharing Your PowerPacks Online ........................................................................... 24 Delegating Administrative Tasks ..................................................................................... 24 Using Configuration Snapshots ....................................................................................... 26 Creating Snapshots ................................................................................................. 26 Comparing Snapshots ............................................................................................. 26 Viewing Snapshots .................................................................................................. 27 Reverting to Earlier Configurations.......................................................................... 27 Removing Snapshots ............................................................................................... 27 Running PowerGUI Administrative Console in Multithreaded Apartments Mode ........... 27

Developing Scripts in the PowerGUI Script Editor ............................................. 28


Syntax Highlighting .......................................................................................................... 29 IntelliSense ...................................................................................................................... 29 Code Snippets ................................................................................................................. 29 Using Snippets ......................................................................................................... 30 Managing Snippets .................................................................................................. 30 Creating a Custom Snippet from a Pre-Installed Snippet ....................................... 30 Block Indent ..................................................................................................................... 31 Block Comment ............................................................................................................... 31 Bookmarks ....................................................................................................................... 31 AutoRecover .................................................................................................................... 32 Automatic Variables ......................................................................................................... 32 Code Folding ................................................................................................................... 33 Multiline Command Support ............................................................................................ 33
3

Passing Script Parameters .............................................................................................. 33 Viewing Definition of Functions ....................................................................................... 34 Compiling Scripts ............................................................................................................. 34 Executable File from Script ...................................................................................... 34 Windows Service from Script ................................................................................... 35 Executing Scripts Remotely............................................................................................. 37 Working with Version Control .......................................................................................... 38 Integrating TortoiseSVNSCC with PowerGUI Script Editor .................................... 39 Customizing the PowerGUI Script Editor ........................................................................ 40 Creating a PowerGUI Script Editor Add-On ............................................................ 40 Searching for PowerGUI Script Editor Add-Ons Online .......................................... 41 Running PowerGUI Script Editor in Multithreaded Apartments Mode ............................ 42

Use Scenarios ........................................................................................................ 43


Making an Organizational Chart Using a Downloadable PowerPack ............................. 43 Creating a Custom Report Using a Display Filter ........................................................... 44 Finding Code Online ........................................................................................................ 46 Editing and Debugging a Script ....................................................................................... 47 Creating a Custom GUI for Helpdesk Users ................................................................... 50 Creating a Specialized Helpdesk Console .............................................................. 50 Disabling Changes to the Console .......................................................................... 50 Sharing the Console Configuration.......................................................................... 51 Distributing the Configuration .................................................................................. 51 Customizing the Console Start Page (Optional) ..................................................... 52

About Quest Software, Inc. ................................................................................... 53


Contacting Quest Software.............................................................................................. 53 Contacting Quest Support ............................................................................................... 53

Third Party Contributions ..................................................................................... 54


Extend OpenFileDialog and SaveFileDialog 1.0: License Text ...................................... 54

PowerGUI 3.5 - User Guide

About This Guide


Overview
This document introduces PowerGUI, explains its setup and initial configuration, and provides instructions on how to customize the product for a wide range of administrative needs. It is intended for administrators who deploy and use the product in production environments.

Conventions
In order to help you get the most out of this guide, we have used specific formatting conventions. These conventions apply to procedures, icons, keystrokes and crossreferences.
ELEMENT CONVENTION

Select Bolded text Italic text

This word refers to actions such as choosing or highlighting various interface elements, such as files and radio buttons. Interface elements that appear in Quest products, such as menus and commands. Used for comments. Introduces a series of procedures. Indicates a cross-reference. When viewed in Adobe Acrobat, this format can be used as a hyperlink. Used to highlight additional information pertinent to the process being described. Used to provide Best Practice information. A best practice details the recommended course of action for the best result. Used to highlight processes that should be performed with care.

Bold Italic text


Blue text

+ |

A plus sign between two keystrokes means that you must press them at the same time. A pipe sign between elements means that you must select the elements in that particular sequence.

PowerGUI 3.5 - User Guide

Introduction
PowerGUI is a comprehensive solution helping you get the most of Windows PowerShell. The product has two components: Administrative Console Script Editor and debugger

This guide provides information about the components listed above.


The MobileShell remote server management toolset is no longer included in PowerGUI. If you need functionality similar to MobileShell, try out the Quest Mobile IT product. For information on Quest Mobile IT, go to http://www.quest.com/mobile-it/.

The PowerGUI Administrative Console is designed to: Streamline PowerShell-based administration tasks by providing ready-made tools through a unified interface Make the extensive capabilities of PowerShell accessible to users who are not comfortable with the text console environment Help establish administration tiers by making specific tools available to specific groups of users, such as Active Directory administrators, help desk staff, and end users

The PowerGUI Script Editor is a complete PowerShell IDE with advanced code editing, debugging and customization capabilities, and a built-in PowerShell prompt.

PowerGUI 3.5 - User Guide

PowerGUI Setup
System Requirements
HARDWARE

CPU: 1GHz 32-bit or 64-bit Memory: 1GB Disk space: about 70MB for the setup and extra disk space for user profiles and PowerPacks that are not included in the setup

OPERATING SYSTEM

One of the following: Windows Vista Service Pack 1 Windows 7 Windows Server 2008 Windows Server 2008 R2 Windows XP Professional Service Pack 3 Windows Server 2003 Service Pack 2 Windows Server 2003 R2 Service Pack 2

For successful installation, the Windows Management Instrumentation service must be running on the target system.
ADDITIONAL SOFTWARE

All of the following: Microsoft .NET Framework 3.5 Service Pack 1 or Microsoft .NET Framework 4.0 (Full) Microsoft PowerShell 2.0 or Microsoft PowerShell 3.0 Community Technology Preview (CTP) Any software for which you are installing additional PowerPacks. For example, Exchange 2007 Management Shell must be installed if you select the Exchange 2007 PowerPack, and so on. If you are going to use VMware vSphere Client integration, VMware vSphere Client 4.0 version or later and VMware vSphere PowerCLI 4.1 version or later are required. If you are going to use source control in the PowerGUI Script Editor, a source control client that supports the MSSCCI provider is required. The following version control systems have been verified to work with the PowerGUI Script Editor: Microsoft Visual SourceSafe Microsoft Team Foundation Server Other version control systems should work if their providers fully support MSSCCI (for example, Subversion with the TortoiseSVNSCC provider), but they have not been tested with the PowerGUI Script Editor.

PowerGUI 3.5 - User Guide

Installing PowerGUI
To start the installation, run the PowerGUI.3.5.x.x.msi installation package provided. On the Select Features step, specify the following: The PowerPacks and other components that you want to install

Setup tries to detect the software that is already installed, and suggests a selection of features based on this information. The Local System, Export Actions, Network and HTML Reporting PowerPacks are available for any configuration. The installation folder

Once you have configured these options, complete the installation wizard.

Running with PowerShell 3.0


By default, PowerGUI is intended to be used with Microsoft PowerShell 2.0. To work with Microsoft PowerShell 3.0 for testing purposes, run the following command-lines for PowerGUI Administrative Console and PowerGUI Script Editor:
AdminConsole.exe version 3.0 ScriptEditor.exe version 3.0

These files are located in the PowerGUI installation folder.

PowerGUI 3.5 - User Guide

Silent Installation
To install PowerGUI in silent mode (without user interaction), from the command line, run the following command:
msiexec /quiet /i <Installation package location>\PowerGUI.3.5.x.x.msi PF_POWERGUI=<Installation folder> To specify whether PowerGUI can automatically collect anonymous product usage data, set the USAGE_INFO_COLLECTING_OPTIONS property to Collect (default value) or DontCollect, respectively.

Selecting Features to Install


The default installation behavior is to detect snap-ins (i.e. Active Directory) and to install the corresponding PowerPacks for detected snap-ins. If no snap-ins are detected, then only Local System and Network PowerPacks are installed. You can also manually select features to be installed using standard Windows Installer properties like ADDLOCAL, REMOVE, etc. For a full list of available properties with descriptions, see the MSDN article at http://msdn.microsoft.com/enus/library/aa367536(VS.85).aspx. The features include the PowerGUI components and bundled PowerPacks: PowerGUI The root feature UILocalization PowerGUI graphical user interface localizations ScriptEditor PowerGUI Script Editor with debugger PSFilesAssociation Association of PowerShell scripts with PowerGUI Script Editor PowerPacks Add-ons for PowerGUI Administrative Console a) b) c) d) e) f) PowerPack_ActiveDirectory Active Directory PowerPack PowerPack_Network Network PowerPack PowerPack_Exchange Exchange 2007 PowerPack PowerPack_LocalSystem Local System PowerPack PowerPack_ExportActions Common reporting and export actions PowerPack_VMware VMWare PowerPack

PowerGUI 3.5 - User Guide

g)

PowerPack_HTML Reporting HTML Reporting PowerPack

Integration_vSphere VMWare vSphere Client integration

For example, running the following command from the command line installs PowerGUI Administrative Console, PowerGUI Script Editor and Local System PowerPack:
msiexec /quiet /i <Installation package location>\PowerGUI.3.5.x.x.msi ADDLOCAL=PowerGUI,ScriptEditor,PowerPack_LocalSystem PF_POWERGUI=<Installation folder>

Adding Custom PowerPacks


You can also make PowerGUI automatically install custom PowerPacks that are not included in the setup by default. To do this, perform the following: 1. 2. Create the Additional PowerPacks subfolder in the folder containing the PowerGUI.3.5.x.x.msi installation package. Put the PowerPack files you want to be installed to the Additional PowerPacks folder.
For information about downloading new PowerPacks or creating your own PowerPacks, refer to Working with PowerPacks section of this document.

USB Flash Drive Installation


PowerGUI can be installed on a USB flash drive, and then can be used without setup and configuration on every computer with PowerShell 2.0 and .NET Framework version 3.5 installed. To install PowerGUI on the USB flash drive, perform the following: 1. If PowerGUI is not yet installed on your computer, install it as described above in the Installing PowerGUI section of this document and configure according to your needs. Insert the USB flash drive with at least 80MB of free space into a USB port on your computer. Launch PowerGUI Script Editor and in the embedded PowerShell Console run the following script:
& "$PGHome\InstallPortable.ps1"

2. 3.

4.

5.

The script starts the PowerGUI installation, or if it has not found any USB flash drives connected to your computer, the script prompts you for a folder where to install PowerGUI. After installation, you can safely remove your USB flash drive.

To use PowerGUI installed on the USB flash drive: 6. Insert the USB flash drive into a USB port on a computer with PowerShell 2.0 and .NET Framework version 3.5 installed.
10

PowerGUI 3.5 - User Guide

7. 8.

Navigate to a folder on the USB flash drive where PowerGUI is installed. Launch PowerGUI Administrative Console or PowerGUI Script Editor by running PowerGUI AdminConsole.exe or PowerGUI ScriptEditor.exe respectively.
By default, the 64-bit version of PowerGUI is launched on 64-bit versions of Microsoft Windows. To launch the 32-bit version of PowerGUI, run PowerGUI AdminConsole_x86.exe or PowerGUI ScriptEditor_x86.exe.

11

PowerGUI 3.5 - User Guide

Working with the PowerGUI Administrative Console


Concepts
The PowerGUI Administrative Console provides a familiar MMC-like interface. In a default configuration, the left pane contains a navigation tree, including nodes and folders. The output pane in the center displays associated objects and provides filtering and sorting capabilities. The right pane lists actions you can apply to displayed objects. If you want to rearrange the interface elements, panes can be moved, turned off, detached, or docked. Specifically, the PowerGUI Administrative Console contains the following: Nodes Nodes help organize the functionality of the console in a tree-like representation. They are located in the Navigation Tree pane. Customizable HTML Pages Customizable HTML pages display additional information for nodes/actions in HTML format. They are located on the Details tab in the output pane. Objects Objects are displayed on the Results tab in the output pane. In PowerGUI Administrative Console, the type of an object defines what you can do with the object. When multiple objects are selected in the grid, then only common actions applicable to each selected object are displayed. Charts Charts display the nodes/actions output data in a graphical form. You can create various charts for each node/action using chart presets. Charts are located on the Chart tab in the output pane. Actions Actions are activities that you can perform with displayed objects. Actions can change objects, use object data for other purposes, and so on. Actions may or may not require a selection of objects to work. They can also provide a connection from the currently selected objects to their related objects (for example, users that own the selected mailboxes, or permissions on selected files), helping you gather more information and explore the system.

12

PowerGUI 3.5 - User Guide

PowerShell Scripts The additional PowerShell Script tab in the output pane allows you to view the underlying PowerShell code at any time. If required, you can copy the displayed code and reuse it on the command line or in your scripts. Messages This optional dockable window lets you view errors that occurred during script execution, or information about PowerPack installations and upgrades. Where possible, links to the underlying PowerShell code are provided.

Launching Admin Console in Authoring Mode


PowerGUI Administrative Console can be launched in basic mode (the default mode) and in Authoring mode. In basic mode all PowerPack, node and action changes are disallowed except for importing and removing PowerPacks. To perform restricted tasks, stated above, you need to launch PowerGUI Administrative Console in Authoring mode. To do it, perform one of the following: Click Administrative Console (Authoring Mode) in the Quest Software | PowerGUI section of the Start menu. Run either the 32-bit or the 64-bit executable of the PowerGUI Administrative Console from the command line with the -AuthoringMode parameter.

Organizing Data: Nodes


PowerGUI Administrative Console nodes are essentially scripts that are executed when you click them in the navigation tree. When you click a node, the script contained in the node is launched and the list of returned objects is displayed on the Results tab in the output pane. To view the properties of a node, right-click it in the navigation tree and select Properties. PowerGUI Administrative Console nodes effectively help you break down administrative tasks by narrowing the processing scope.
To perform tasks described in this section, you should launch PowerGUI Administrative Console in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

Creating Nodes
You can create basic nodes and script nodes. To create a basic node 1. 2. 3. Right-click the node under which you want to create a new node, and select New | Node. Select the required cmdlet from the Command drop-down list or search for it. Optionally, specify cmdlet parameters, and select the parameters you want to be prompted for. The list of cmdlets available to you is defined by the set of libraries installed on your computer (to list them, select File | PowerShell Libraries in the main menu).
13

PowerGUI 3.5 - User Guide

For basic nodes, only Get- cmdlets are available.

To create a script node 1. 2. Right-click the node under which you want to create a new node and select New | Script Node. Leave the Custom script option selected in the Command drop-down list and type or paste your script in the field below.

The type of node can be selected not only during node creation, but also at any time for any existing node. For that, use the Command drop-down list in the node's properties dialog box.
Before you edit the contents of an existing node, consider turning off filters in the output pane, especially if your changes can affect the type of the returned data.

Creating Folders to Nest Nodes


The PowerGUI Administrative Console provides nesting capabilities, so you can create nodes under other nodes and drag-and-drop nodes within the navigation tree. You can create folders to better organize your nodes. Folders are nodes that do not contain any scripts. When you click a folder, the output pane shows the start page. To create a folder, right-click the node under which you want to create it and select New | Folder. When you create a folder, leave the No command option selected from the Command drop-down list.

Deleting or Renaming Nodes


To delete a node, right-click it in the navigation tree and select Delete. To rename a node, right-click it in the navigation tree and select Rename.

Using Customizable HTML Pages: Details Tab


The Details tab in the output pane of the PowerGUI Administrative Console displays the custom HTML page for the selected node/action. For example, the page can contain Useful information Hyperlinks Custom graphics Links to nodes Links to actions

You can load a team SharePoint site or intranet Web page, or create any other custom page for specific PowerPack users.

14

PowerGUI 3.5 - User Guide

Displaying the Details Tab for a Node


To display the Details tab for a node/action 1. 2. Select the node/action you need. On the View menu, click Details.
Details are not displayed by default and should be turned on separately for node/action you want.

Customizing the Details Tab


Customizing Details tab is allowed only when PowerGUI Administrative Console is running in Authoring Mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

To customize the Details tab 1. 2. 3. Click Customize at the top of the details toolbar. In the dialog box that opens, select the previously created Web page. Click Open, and your custom HTML page will be displayed.
If there are problems with graphics loading, try using a Web archive file (*.mht).

All Web links on the HTML page will be valid if the PowerGUI client is connected to the Internet.

15

PowerGUI 3.5 - User Guide

Creating Links to Nodes and to Actions


Creating links to nodes and actions is allowed only when PowerGUI Administrative Console is running in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

To make jumping to node in the navigation tree or executing action available by one click you can insert to your custom page hyperlink to node or to action you want. Examples: Creating hyperlink to node a) Using node address

<a href="powergui://navigation/Root/Local%20System/ Network%20Configuration/Network%20Interfaces">Jump to node</a>

This hyperlink jumps to node in the navigation tree with the specified node address. b) Using node GUID (Globally Unique Identifier)
<a href="powergui://navigation/{a2475c22-a617-44c5-8287373941e2ae38}">Jump to node</a>

This hyperlink jumps to node in the navigation tree with the specified node GUID. Creating hyperlink to action
<a href="powergui://action/{3780b4ca-12e9-4151-b3c36004dca70c75}">Execute action</a>

This hyperlink executes action with the specified action GUID (Globally Unique Identifier)
Currently the only way to get action or node GUID is to open PowerPack file and find the GUID (the same as container id tag value) you want.

Resetting Details Tab to Default


Resetting Details tab is allowed only when PowerGUI Administrative Console is running in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

Click Reset to Default to revert back to the default HTML page.

Working with Results: Results Tab


The Results tab in the output pane of the PowerGUI Administrative Console displays the output of the selected node. The output is presented as a table of objects returned by the script that is contained in the node. You can filter and sort data, change the icons for object types, and modify the displayed columns to customize the output view.

16

PowerGUI 3.5 - User Guide

Filtering Displayed Information


To filter displayed objects 1. 2. 3. On the Results tab in the output pane, click the Filters button. Select the Property and Operator options from the corresponding drop-down lists and enter the value for the filter. Click Apply to apply your filter settings.

You can also clear all filter settings or save the filter configuration as a new script node.
When you select Save As, the filter is saved under the selected node as a child node.

Modifying the Table


To modify the columns displayed on the Results tab, right-click column headers to select the ones you want to see, and use drag-and-drop to set the columns in the right order. Alternatively, right-click column headers, select More, and in the dialog box that appears, select the check boxes next to the parameters you want to see in the table. To change the column order, use the Move Up and Move Down buttons. PowerGUI Administrative Console will save your settings, and the next time you execute the script, only the selected columns will be displayed with last set widths for the selected node. Objects displayed in the table have icons showing the type of object. If you want to change the default icon for an object type or the PowerGUI Administrative Console does not have an appropriate icon for the objects, right-click the object of the necessary type and select Change Object Icon.
Change Object Icon option is enabled only when PowerGUI Administrative Console is running in Authoring Mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.
17

PowerGUI 3.5 - User Guide

Working With Results: Chart Tab


The Chart tab in the output pane of the PowerGUI Administrative Console displays the series of output data of the selected node/action in a graphical form. It makes it easier to understand large quantities of output data and the relationship between different series of output data.

Displaying the Chart Tab for a Node/Action


To display the Chart tab for a node/action 1. 2. Select the node/action you need. On the View menu, click Chart.
Charts are not displayed by default and should be turned on separately for node/action you want.

Creating Chart Presets


Charts are based on presets, which are chart templates that can be quickly loaded using the Preset drop-down list. Multiple presets can be created for each node/action.
Creating chart presets is allowed only when PowerGUI Administrative Console is running in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

18

PowerGUI 3.5 - User Guide

Here is an example of creating a preset for local system disk drives node: 1. 2. 3. 4. 5. 6. 7. 8. Select the Local System | Drives | File system node in the navigation tree. Click the Create New Preset button (icon representing a blank sheet of paper) at the top of the chart toolbar. Type your chart name(e.g., DiskCapacity). Select your chart type (e.g., Stacked column). Select the Show all properties check box. In the list of check boxes that appears, select the Used and Free check boxes. Click the Appearance tab and change the Legend Visible value to true. Click OK, and your chart, similar to the chart above, will be displayed.

Customizing Chart Presets


Customizing chart presets is allowed only when PowerGUI Administrative Console is running in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

To customize a previously created chart preset 1. 2. 3. 4. Select the preset to customize from the Preset drop-down list. Click Customize to open the Customize Preset dialog box. Perform the necessary customization. Click OK to apply the changes.
You can define custom colors for chart elements in addition to predefined colors. To do it, perform the following: 1. Select setting that defines color of the chart element you want to change. 2. Expand color selection dialog of the selected setting. 3. On the Custom tab, right-click one of the empty white boxes to open the Define Color dialog box. 4. Select desired custom color for the chart element and click Add Color.

Deleting Chart Presets


Deleting chart presets is allowed only when PowerGUI Administrative Console is running in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

To delete a chart preset 1. 2. Select the preset to delete in the Preset drop-down list. Click the Delete Preset button (red cross icon) at the top of the chart toolbar.

Saving or Printing Charts


Click Save as Image at the top of the chart toolbar to save a static image of your chart. Click Print at the top of the chart toolbar to print a static image of your chart.

19

PowerGUI 3.5 - User Guide

Using Actions
The actions available for objects displayed on the Results tab are listed in the Actions pane of the PowerGUI Administrative Console. An action is basically some wrapped PowerShell code: a cmdlet or a script. PowerPacks in PowerGUI provide different action categories, which are essentially labels that help organize actions. The following are examples of action categories (marked bold) from some predefined PowerPacks: Related Information actions provide connections from the currently selected objects to their related objects (for example, users for selected mailboxes, or permissions for selected files). In general, actions from this category do not affect objects; they allow you to gather more information and explore the system. General actions are procedures applied to the selected objects in the table. Common actions are available for all object types, while actions from other categories are executed by default for the specific types of objects.

In addition to these categories of actions, you can introduce your own categories.
All tasks described below in this section except for viewing property of an action can be performed only when PowerGUI Administrative Console is running in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

Creating Actions
You can create basic actions and script actions. First, decide on the category (such as Links, Actions: Common, or some custom category) that your action belongs to. If it does not fit into any existing categories, create a new category by right-clicking in the Actions pane of the PowerGUI Administrative Console and selecting New | Category. To create a basic action 1. 2. Right-click the category and select New | Action. Select the required command from the Command drop-down list or search for it, and then specify predefined parameters and select the parameters you want to be prompted for. The list of commands available to you is defined by the set of libraries installed on your computer (File | PowerShell Libraries). Click Display Configuration to configure action properties:
The category to contain the action How to display results Whether this action affects selected objects so the view needs to refresh. Whether this action requires a selection (and pipeline input) or works without any incoming objects (for example, creating a new user does not need user objects to be piped in) Object types associated with the action

3.

20

PowerGUI 3.5 - User Guide

To create a script action 1. 2. 3. Right-click the category and select New | Script Action. Leave the Custom script option selected in the Command drop-down list and type or paste your script in the field below. Click Display Configuration to configure action properties: a) b) c) d) The category to contain the action How to display the results Whether this action affects selected objects so the view needs to refresh. Whether this action requires a selection (and pipeline input) or works without any incoming objects (for example, creating a new user does not need user objects to be piped in) Object types associated with the action

e)

You can drag-and-drop actions both within and among available categories.

Other Options
To view or edit the property of an action, right-click it and select Properties. Click Display Configuration to configure action properties, set up a category to locate the action, select how to display results, and specify whether this action affects groups of objects. You can also change the type of objects associated with this action. To delete an action, right-click it and select Delete. To rename an action, right-click it and select Rename.

An action can be made the default action for selected objects. Default actions are performed when you double-click an object on the Results tab. To set an action as a default action, right-click it in the Actions pane and use the Make Default toggle.

Working with PowerPacks


A PowerPack is a collection of nodes and actions that are used to extend the PowerGUI Administrative Console. Each node or action has a PowerShell script associated with it. Nodes are also used to order PowerPack content logically in the PowerGUI Administrative Console tree. Every PowerPack includes functionality for managing a particular type of server object; for example the Exchange PowerPack is used for managing Exchange Server-related objects. There are a number of PowerPacks available in the PowerGUI setup: Export Actions Active Directory Exchange 2007 Local system Network VMware HTML Reporting
21

PowerGUI 3.5 - User Guide

For a full list of available PowerPacks, refer to the PowerPacks section of the PowerGUI website (http://powergui.org). The site organizes PowerPacks into categories, which include Active Directory, SharePoint, Virtualization, and so on.

Discovering and Installing PowerPacks


1. 2. In the PowerGUI Administrative Console open the Tools | Find PowerPacks Online dialog box. Type applicable keywords in the search box of the Find PowerPacks Online dialog box and click Search (to display all available add-ons, simply leave the search box blank). Search is performed within the PowerGUI unity website.

3.

Select the desired PowerPacks and click Install.


All necessary snap-ins and modules installed on the computer are automatically loaded along with the PowerPacks.

Downloading, Importing and Exporting PowerPacks


To download a PowerPack 1. 2. 3. 4. 5. Go to http://powergui.org. Select PowerPacks from the list of links at the top of the page. Choose the subcategory and locate the PowerPack you want to download. Click the desired PowerPack link to open its web page. Click the link to the *.powerpack file in the Downloads section of the page. If your browser lists the contents of the file instead of saving it, right-click the link and use your browser's Save command.
Make sure you save the PowerPack using the .powerpack file extension.

22

PowerGUI 3.5 - User Guide

To import a PowerPack 1. 2. 3. 4. 5. Open the PowerPack Management dialog from the File menu. Select Import. The Open dialog box appears. Browse to the location of the PowerPack. On the right pane of the dialog box, the PowerPack description and required PowerShell snap-ins and modules will be displayed. Select the PowerPack and click Open.

To export a PowerPack
Exporting PowerPacks is allowed only when PowerGUI Administrative Console is running in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

1. 2. 3. 4.

Open the PowerGUI Administrative Console. Open the PowerPack Management dialog box from the File menu. Select a PowerPack and click Export in the toolbar. Provide a file path to the PowerPack location and the version number, and then click the Export button.

Any node in any PowerPack can be included in any other PowerPacks or excluded from any PowerPacks it currently belongs to. This is configured on a per-node and per-action basis: open the properties of the node or action you need, click the More button, and use the PowerPacks list box to change the associations of the node or action with PowerPacks.

Creating PowerPacks
You can add your own functionality to PowerGUI to extend the PowerGUI Administrative Console.
Creating PowerPacks is allowed only when PowerGUI Administrative Console is running in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document. For more detailed information about creating PowerPacks, refer to the PowerPacks section on the http://wiki.powergui.org website.

To create a PowerPack 1. 2. 3. Open the PowerGUI Administrative Console. Right-click the node that you want to make the root node of the new PowerPack, and select Create New PowerPack. If the node does not exist yet, create it first. In the New PowerPack dialog box, enter the following for the new PowerPack: a) b) c) Name Version number Description (optional)

23

PowerGUI 3.5 - User Guide

d) e) f)

PowerPack requirementsrequired PowerShell snap-ins and modules (optional) PowerPack file linkthe URL or intranet location of the *.powerpack file for automatic update checks (optional) PowerPack home pagethe Web page with information about the PowerPack (optional). If the home page is set, a link to it is displayed next to the PowerPack name in the PowerPack Management dialog box.

It is recommended that you specify the optional information for your users convenience. This information helps them understand what the PowerPack does (from the description and home page), automatically check requirements, and look for updates (if a valid PowerPack link is specified).

4.

If necessary, click the Advanced button to select specific nodes, actions, and icons, and then click OK.

Sharing Your PowerPacks Online


You can easily share functionality with other users by adding files to the library on the PowerGUI community site. You have the option of exporting the entire tree or folder structure, which in effect writes a script that creates the node or a set of nodes. You can easily upload and import functionality created by other users from PowerGUI community site. To share a PowerPack with the community 1. 2. 3. 4. 5. 6. Log in at the http://powergui.org site. PowerPacks can be uploaded only by registered users. Click the Browse the Library link in the PowerGUI Library section. Select a sub-category, and then click the Add a Document link in the Tools menu. Enter the document type (PowerPack), description, and a short summary so that other users can locate your PowerPack. Click on Attach Files to browse for the PowerPack and then attach it. Click Post Document.

Delegating Administrative Tasks


PowerGUI provides capabilities for tailoring the default interface to specific administrative roles, such as helpdesk operators, to create targeted consoles with only the necessary nodes and actions. In this case the user of the customized console obtains a restricted subset of PowerGUI functionalityfor example, without the ability to view and modify the PowerShell code contained in PowerGUI actions, and so on. Customization involves working with files in PowerGUI user profile folders, which are located in %AppData%\Quest Software\PowerGUI. In general, to delegate administrative tasks, you need to take the following steps: 1. Prepare the set of PowerPacks for sharing as *.powerpack files.
24

PowerGUI 3.5 - User Guide

2. 3.

Copy the *.powerpack files to a share that is available to all future users of the customized consolefor example, \\mysrv\public. Prepare a Redirections.xml file to make the customized configuration available to authorized users. This file contains the paths to PowerPack folders and lockdown settings. A sample Redirections.xml file is created by default when you deploy the product; it can be found in your profile folder. Store the paths to the folder with the *.powerpack files in the <PowerPackFolders> element in Redirections.xml like this:

<PowerPackFolders> <Folder>\\mysrv\public</Folder> <Folder>\\anothersrv\public\powerpacks</Folder> </PowerPackFolders>

All *.powerpack files found in the specified folders will now be loaded every time the PowerGUI Administrative Console starts up. Changes since the last time are applied as follows:
If there have been updates to existing PowerPacks, these updates will be applied (unless the existing copy of the PowerPack has a later version than the shared copy). If new PowerPacks have been added, these PowerPacks will appear in the PowerGUI Administrative Console. If any PowerPacks have been removed, existing versions of these PowerPacks will remain in the PowerGUI Administrative Console.

4.

Use the lockdown feature to deactivate or hide the functionality that the users are not supposed to access (for example, disallow adding or modifying nodes in the tree, viewing the PowerShell code behind the functionality, and so on). To lock configuration items and actions, modify the Lockdown.xml file in the PowerGUI user profile folder. Save the modified file in an easily accessible location, for example, \\mysrv\public\LD1\lock.xml. For details about editing the Lockdown.xml file, see the Creating a Custom GUI for Helpdesk Users section of this document. Store the full path to the lockdown file in the <Lockdown> element in the Redirections.xml file like this: To distribute the customized configuration and lockdown settings to users across the network, use the Redirections.xml file. For that, any suitable file distribution method can be used: remote access, logon script, Group Policy, and so on. The Redirections.xml file should be stored in the PowerGUI user profile folder.
Alternatively you can distribute the Redirections.xml file to the All Users profile to make it available for all users of the computer. However, the profiles of particular users have a higher priority, so the settings in the All Users profile have an effect only in the absence of overriding settings in user profiles.

5.

<Lockdown>\\mysrv\public\LD1\lock.xml</Lockdown>

6.

For a step-by-step use scenario, see the Creating a Specialized Helpdesk Console section of this document.

25

PowerGUI 3.5 - User Guide

Using Configuration Snapshots


A snapshot is a state of your PowerGUI Administrative Console configuration at a specific moment of time. Snapshots allow you to: Save the states of PowerGUI Administrative Console configuration. Compare different configurations of PowerGUI Administrative Console. Revert PowerGUI Administrative Console to previously saved configurations.
All snapshot tasks can be performed only when PowerGUI Administrative Console is running in Authoring mode. For more information, see the Launching Admin Console in Authoring Mode section of this document.

Creating Snapshots
To create a new snapshot, open the File | Snapshots dialog box and click Take Snapshot. Now you have your current PowerGUI Administrative Console configuration saved and can revert to it any time you want.
When the PowerPack collection is changed (some PowerPacks have been added, removed or updated), a snapshot of the previous configuration is created automatically. Thus you can check what exactly has changed and revert to the previous configuration if necessary.

Comparing Snapshots
To compare two saved PowerGUI Administrative Console snapshots, you should select necessary PowerGUI Administrative Console snapshots in the Snapshots dialog box and click Compare.
If you want to compare your current configuration with a snapshot, just select the snapshot and click Compare. It will be automatically compared with your current PowerGUI Administrative Console configuration.

26

PowerGUI 3.5 - User Guide

A report will be generated and automatically opened in the Web browser. To see detailed information about each change, click the entry for that change, and the information about it will be shown.

Viewing Snapshots
Select a snapshot in the Snapshots dialog box and click View to see how reverting to this snapshot will affect your PowerGUI Administrative Console configuration without making any changes to your current configuration state. A new instance of PowerGUI Administrative Console will be started using the configuration in the selected snapshot.

Reverting to Earlier Configurations


Using snapshots, you can revert your PowerGUI Administrative Console configuration to previously saved states. To do this, select the necessary snapshot in the Snapshots dialog box and click Revert. Your current PowerGUI Administrative Console state will be reconfigured to match the selected snapshot.
If you revert to a saved configuration, your current configuration of the PowerGUI Administrative Console will be overwritten. To avoid this, take snapshot of your current configuration before reverting.

Removing Snapshots
To remove unnecessary snapshots, select them in the Snapshot dialog box and click Remove.

Running PowerGUI Administrative Console in Multithreaded Apartments Mode


By default, PowerGUI Administrative Console runs in the Single-Threaded Apartments (STA) mode. Some PowerPacks, such as the Facebook Organizer PowerPack, require STA mode to be enabled in order to function properly. However, if you want PowerGUI Administrative Console to work in the Multithreaded Apartments mode, run either the 32bit or the 64-bit executable of the PowerGUI Administrative Console from the command line with the -MTA parameter. For more information about single-threaded and multithreaded apartments, please refer to the Processes, Threads, and Apartments MSDN article.

27

PowerGUI 3.5 - User Guide

Developing Scripts in the PowerGUI Script Editor


The PowerGUI Script Editor provides advanced editing and debugging capabilities for PowerShell scripts and an integrated PowerShell Console. The main menu and context menus contain a number of self-explanatory commands and options common to contemporary advanced text editors, such as line number display, split view, auto-recovery, support for multiple editor instances, and so on. For details, see the Editing and Debugging a Script section of this document.

28

PowerGUI 3.5 - User Guide

Syntax Highlighting
In the PowerGUI Script Editor, the following is highlighted in specific colors to help identify tokens in a script: Cmdlet names Alias names Statement identifiers Variables .NET types Comments Quoted strings

Syntax highlighting works inside remote sessions as well.

IntelliSense
IntelliSense provides features that make language references easy to access. When coding, you do not have to leave the edit view to perform searches on language elements. You can keep your context, find the information that you need, insert language elements directly into your code, and even have IntelliSense complete your typing for you. The PowerGUI Script Editor supports IntelliSense for: Cmdlets Parameters WMI objects .NET objects Variables File paths

IntelliSense is activated automatically when certain keys are pressed, such as when you press the dash (-) key after typing Get. IntelliSense can also be activated manually by pressing Ctrl+Space or through the Complete Word item in the Edit menu. This feature works inside remote sessions as well.

Code Snippets
Snippets are ready-made small PowerShell code templates that make it easier to create syntactically correct scripts. In addition to regular snippets, the PowerGUI Script Editor comes with VBScript snippets, which are PowerShell code templates implementing VBScript functionality.

29

PowerGUI 3.5 - User Guide

Using Snippets
PowerGUI supports insertion of snippets in the PowerGUI Administrative Console and in the PowerGUI Script Editor. To insert a snippet in the PowerGUI Script Editor, select Edit | Insert Snippet (Ctrl + I) or Edit | Insert VBScript Snippet (Ctrl + B). To insert a snippet in the embedded editor in the PowerGUI Administrative Console, press Ctrl + I for a PowerShell snippet or Ctrl + B for a VBScript snippet.

Managing Snippets
Snippets can be managed using the PGSnippetPath environment variable. It provides capabilities for adding new snippets and overriding the existing ones without changing the core installation. The PGSnippetPath variable contains a semicolon-separated list of folders where PowerGUI searches for snippets (*.snippet files).
When loading a PowerShell module, PowerGUI automatically adds the path of the snippets folder placed in the root folder of the module to PGSnippetPath and removes it when the module is unloaded. Thus, if you want to add some snippets when importing a PowerShell module, you should put them in the snippets folder of the module.

The priority of each folder is determined by its position in PGSnippetPath; the first folder has the highest priority. This allows overriding snippets without changing the original ones. See the following situation for an example: PGSnippetPath equals %UserProfile%\My Documents\WindowsPowerShell\snippets;%PGInstallDir%\snippets. Both folders contain a snippet named test.snippet. If you insert test.snippet in your script, you will get the snippet from the %UserProfile%\My Documents\WindowsPowerShell\snippets folder, because it has a higher priority than the second folder.

Creating a Custom Snippet from a Pre-Installed Snippet


You can create a custom snippet from a snippet pre-installed with PowerGUI Script Editor. To do this, perform the following: 1. 2. 3. Open the snippets or snippets\VBScript folder in the PowerGUI installation folder (%PGInstallDir%). Make a copy of the necessary snippet file and edit it. Add the full path of the folder that contains the edited snippet to the PGSnippetPath environment variable.
To override the original snippet with the edited one, the path of folder that contains edited snippet should be positioned in PGSnippetPath before the path of the folder that contains the original snippet.

30

PowerGUI 3.5 - User Guide

Block Indent
You can increase or decrease indent of a block of code by selecting the lines you want to move and then selecting Edit | Advanced | Increase Indent or Edit | Advanced | Decrease Indent. You can also use the following shortcut keys: To increase indent of the selected block of code, press Tab. To decrease indent of the selected block of code, press Shift + Tab.
For formatting consistency, you can easily convert tab indents to space indents and the other way around. For that, use the Edit | Advanced | Convert Tabs to Spaces and Edit | Advanced | Convert Spaces to Tabs commands. In the PowerGUI Script Editor Options dialog box on the Text Editor screen, you can configure the size of tabs and whether spaces should always be used instead of tabs.

Block Comment
You can comment out a block of code by selecting the lines you want to change and then selecting Edit | Advanced | Comment Block or Edit | Advanced | Uncomment Block. You can also use the following shortcut keys: To comment out the selected block of code, press Ctrl + Shift + C. To uncomment the selected block of code, press Ctrl + Shift + U

Bookmarks
You can set bookmarks to mark the places in your script that you are working on. Bookmarks are used for making modifications in multiple places in large files when you cannot see the entire script on a page or two. For bookmark controls, click Edit | Bookmarks. These controls are not located in the toolbar by default but you can easily add them. For that, click Tools | Customize, and drag the following commands from the Customize dialog box to the toolbar: Toggle Bookmark Previous Bookmark Next Bookmark Clear Bookmarks

31

PowerGUI 3.5 - User Guide

These commands are on the Commands tab in the EditCommand category.

Before you close your editing session, you will be asked whether you want the currently opened scripts to be loaded automatically (with the same bookmark, breakpoint, and code folding settings) the next time you start the PowerGUI Script Editor.

AutoRecover
PowerGUI Script Editor has AutoRecover functionality. If you turn on AutoRecover, your script files are automatically saved in particular periods of time. Therefore, if you have been working for a long time without saving a script and your computer unexpectedly turned off, the recovered script contains all or at least some of the work you have done since you last saved the original script. To turn on AutoRecover, select it in the Tools | Options | Text Editor dialog box. Also you can set how often AutoRecover information should be saved (every 60 seconds by default).
If you change the frequency of AutoRecover information saves, then new value of period is applied only when previous interval is over.

Automatic Variables
The state of PowerGUI is stored in the following automatic PowerShell variables that you can use in scripts: $PGHome Full path of the installation directory for PowerGUI
32

PowerGUI 3.5 - User Guide

$PGUICulture Current language of the PowerGUI user interface $PGVersionTable Hash table of PowerGUI version details. Contains versions of the following components: a) b) PowerGUI PowerGUI Script Editor SDK

$PGSE Current instance of PowerGUI Script Editor


Variables listed above are available only if you execute scripts from the PowerGUI Script Editor.

Code Folding
The PowerGUI Script Editor supports code folding, outlining, and regions. This helps you to organize your script and make it more readable. You can easily hide a block of code from view. For example, user-defined regions can be created by using the #region / #endregion construct. By default, regions are collapsed every time you open a script that contains them.

Multiline Command Support


When you type a command in the PowerShell Console window, PowerGUI ScriptEditor automatically determines whether the command is complete. If the command is incomplete, then PowerGUI Script Editor does not execute command when you press the Enter key but just moves the carriage to a new line, likewise pressing Shift+Enter, so you can continue typing the command. When the command is complete, press Enter key to execute the command.

Passing Script Parameters


In PowerGUI Script Editor you can execute scripts with parameters as in the native PowerShell Console. To pass parameters to the script, type them in the parameters text box on the Debug toolbar before running the script.
If a parameter value contains spaces, then the parameter value should be put in single or double quotes, or each space should be escaped using the PowerShell escape character (backtick character: `). Parameters specified in the parameters text box are passed to each script run in PowerGUI Script Editor. Debug | Run in External PowerShell Window command (Alt+F5) passes parameters specified in the parameters text box to the scripts as well.

33

PowerGUI 3.5 - User Guide

Viewing Definition of Functions


In the PowerGUI Script Editor you can easily move to the place in the script where a specific function is defined. To view the definition of a function, right-click the function name and select Go To Definition. If the function does not exist in the runspace, then PowerGUI Script Editor searches for the function definition in the current opened file only. Otherwise, if the function exists in the runspace, then PowerGUI Script Editor opens the script document where the function is defined.
Definitions of internal PowerShell functions or definitions of functions from the embedded PowerShell Console window are opened in a new script document.

Compiling Scripts
You can compile scripts into standalone executable files. Such files can be run by users without any specific PowerShell knowledge on any computer with Windows PowerShell 2.0 installed. Also your scripts can be compiled into Windows services. In that case PowerGUI Script Editor produces service installation files. To prevent unauthorized usage of the compiled executable files and the source script code within them, you can protect the executable files with a password. By default, compiled executable file or windows service is compatible with the same PowerShell version as the PowerGUI Script Editor that was used to create this file or service. To work with other PowerShell versions, run a compiled executable file or windows service with the -version parameter on the target computer, as follows:
<file name>.exe version <version number> When generating an executable file, the PowerGUI Script Editor creates the executable (<file name>.exe) and the corresponding configuration file (<file name>.exe.config). To work with different versions of PowerShell, you need to copy both files on the target computer.

Executable File from Script


To compile a script into an executable file, perform the following: 1. 2. In the PowerGUI Script Editor open the script you want to create an executable from. Open the Tools | Compile Script dialog box.

34

PowerGUI 3.5 - User Guide

3. 4. 5.

Specify the path where the target executable file should be placed after the compilation. Specify additional PowerShell Console window settings. If you want to protect the executable file and its contents with a password, select the Protect script source code with password option, then enter and confirm the password.
The source code of the script within the executable file will be encrypted using the specified password.

6.

7.

If your script relies on additional PowerShell files, then specify them in the Dependencies dialog box. These files will be compiled into the executable file as well as your script. Click OK to create the target executable file from the source script with specified settings.

Windows Service from Script


To compile a script into a Windows service, perform the following: 1. 2. In the PowerGUI Script Editor open the script you want to create a service from. Open the Tools | Compile Script into Service dialog box.

35

PowerGUI 3.5 - User Guide

3. 4.

Specify the path where the service installation file should be placed after the compilation. Specify service settings that will be used by default. These settings can be changed when user starts the service installation wizard.
Specified service name cannot be changed later.

5.

If you want to protect the service installation file and its contents with a password, select the Protect script source code with password option, then enter and confirm the password.
The source code of the script within the service installation file will be encrypted using the specified password.

6.

7.

If your script relies on additional PowerShell files, then specify them in the Dependencies dialog box. These files will be compiled into the service installation file as well as your script. Click OK to create the service installation file from the source script with specified settings.

Installing and Uninstalling Services


To install a service, compiled from script perform the following: 1. 2. 3. Copy a service installation file to a computer on which the service is planned to be installed Run the service installation file. In the service installation dialog change default settings if necessary, and click Install.
36

PowerGUI 3.5 - User Guide

4.

Complete the service installation.


Do not delete the service installation file after service installation because it is required for service uninstalling.

To uninstall the service, run the service installation file from command line with the -service uninstall parameter.

Executing Scripts Remotely


You can run an entire script or a portion of a script on one or more systems using the PowerShell 2.0 remoting feature. You can also generate a containing script that will run your script remotely so that you can use your script on other machines later on, for example by scheduling the containing script. Open the script you want in the PowerGUI Script Editor and navigate to the Debug | Run on Remote System menu command. The Run on Remote System dialog box will be displayed. You can either supply computers one-by-one, or select a remoting configuration that you want to use when running your script remotely. Remoting configurations allow you to use a static list of computer names or a script to dynamically determine the list of target computers. They also allow you to configure any remoting options that should be used when running the script: URI address, proxy server credentials, certificates, security context, background job support, throttling, etc. You can use predefined remoting configurations, or create new ones. To edit a remoting configuration: 1. 2. In the Run on Remote System dialog box select the remoting configuration you want, Click Edit. The Edit Remoting Configuration dialog box will be displayed.

37

PowerGUI 3.5 - User Guide

Working with Version Control


The PowerGUI Script Editor lets you work with files stored in your preferred source control system. Before you can work with version control, you must have a version control client with MSSCCI support installed on your workstation and have a connection to an existing version control database. The following version control systems are supported (through MSSCCI): Microsoft Visual SourceSafe Microsoft Team Foundation Server; the provider is available from the following locations: a) For Visual Studio 2008: http://www.microsoft.com/downloads/details.aspx?familyid=faeb7636-644e451a-90d4-7947217da0e7&displaylang=en For Visual Studio 2005: http://www.microsoft.com/downloads/details.aspx?familyid=87e1ffbd-a4844c3a-8776-d560ab1e6198&displaylang=en
38

b)

PowerGUI 3.5 - User Guide

Other version control systems should work if their providers fully support MSSCCI (for example, Subversion with the TortoiseSVNSCC provider), but they have not been tested with the PowerGUI Script Editor. For specific information about integrating TortoiseSVNSCC with PowerGUI Script Editor, see the corresponding section below.

To connect to the version control provider 3. 4. 5. 6. 7. On the Tools menu, click Options. In the Options dialog box, select Version Control. Select the source control provider from the list, or select None if you need to disable version control. Use the Advanced button to configure the settings for your source control provider. This option may not be available for some version control providers. Consider using Dont show Check In dialog box when checking in items option.

You can identify your file status in version control. If a blue check mark icon appears on the document tab, your file is under version control and checked in. The check mark becomes red when the file is checked out from version control. The following actions are available in the Version Control menu: Get Latest Version Copies the file to the local computer if you do not have it already. If the file is already there, it will be updated if it has changed. Check Out Locks the file for editing. Check In Adds the new version of the file to version control. Undo Check Out Reverts the checkout operation. Add to Version Control Places the current file under version control. Get Files from Version Control Copies files from the specified directory located in the version control database to the local computer. The dialog is supplied by the version control provider.

If version control support is configured, when you save a file, you are prompted to add it to version control. The user experience depends on the version control provider you are using.

Integrating TortoiseSVNSCC with PowerGUI Script Editor


This section provides details about integrating TortoiseSVNSCC with PowerGUI Script Editor. TortoiseSVNSCC is a Subversion plugin for TortoiseSVN client. Note that the

39

PowerGUI 3.5 - User Guide

Subversion (SVN) version control system is not officially supported by PowerGUI Script Editor, so its proper operation is not guaranteed.
The TortoiseSVNSCC provider, which is freeware available from http://tortoisesvnscc.tigris.org, requires version 1.3.5 of the TortoiseSVN client to be installed. Note that this version of TortoiseSVN is not current.

If you install the TortoiseSVNSCC as documented in its readme file, but SVN does not become available in the PowerGUI Script Editor, the installation procedure may require a slight variation. The readme file that comes with TortoiseSVNSCC tells you to unpack the DLL file provided and register it using the regsvr32 utility. Registration works correctly only on systems where User Account Control (UAC) is absent or disabled. UAC was first introduced in Vista, later than TortoiseSVNSCC was released. On systems where UAC is enabled, the procedure, as described in the readme file, works with a virtual registry. As a result, the source control provider is not properly registered. To fix this issue, perform the registration step on such systems as follows: 1. 2. Open the command prompt as an administrator. Use regsvr32 in the administrator command prompt to register the DLL file.

If regsvr32 fails, perform the following: 1. 2. 3. 4. 5. 6. 7. Download the http://tortoisesvnscc.tigris.org/files/documents/2074/18555/install.reg file. Change the extension of the downloaded file to *.reg if it differs. Open file with a text editor. Edit the paths in the downloaded file to match your TortoiseSVNSCC provider configuration. Run regedit with administrative privileges. In the registry editor click File | Import and open the previously downloaded file. Add the path <TortoiseSVNSCC Installation Folder>\bin to your PATH environment variable.

Customizing the PowerGUI Script Editor


You can add the functionality you want to the PowerGUI Script Editor using a .NET object model. The sections below describe how to create a simple add-on for PowerGUI Script Editor and where to get existing add-ons from the Internet. For more information about customizing the PowerGUI Script Editor, see the PowerGUI Script Editor API Reference.

Creating a PowerGUI Script Editor Add-On


PowerGUI Script Editor add-ons are PowerShell 2.0 modules that use the PowerGUI Script Editor API to extend the PowerGUI Script Editor functionality. Users can choose what add-ons are loaded at PowerGUI Script Editor start-up in the Snapins/Modules dialog box (File | PowerShell Libraries).
40

PowerGUI 3.5 - User Guide

To create your own PowerGUI Script Editor add-on 1. 2. 3. Open the %UserProfile%\My Documents\WindowsPowerShell\Modules folder or create it if necessary. Create a subfolder for your add-on. Start the PowerGUI Script Editor and create a file containing the following add-on script code:

if ($host.Name ne PowerGUIScriptEditorHost) { return } $se = [Quest.PowerGUI.SDK.ScriptEditorFactory]::CurrentInstance # TODO: Put your actual code here write-host "Hello World"

This add-on checks that it is run under the PowerGUI Script Editor, gets access to the PowerGUI Script Editor API and outputs "Hello World" message. 4. Save this file as PowerShell module file (*.psm1) to the previously created addon folder.
The name of the PowerShell module file and the add-on folder should be the same.

5. 6.

Select your created add-on in the Snapins/Modules dialog box (File | PowerShell Libraries). When you click OK you can see that the add-on gets loaded and Hello World is displayed in the embedded PowerShell Console.
If you get an error message ensure that execution of scripts is enabled on your system using Get-ExecutionPolicy and Set-ExecutionPolicy cmdlets.

Note that because of the PowerShell 2.0 specifics some parts of add-on script code may not be executed properly. Mostly it concerns event handlers such as command scripts used in menus/toolbars and PowerGUI Script Editor DebuggerStateChanged event handler. Automatic variables like $_, $args, $input, $this and $pscmdlet may return $null instead of existing object when used in event handlers causing improper script execution. In this case try to replace constructions that contain listed automatic variables with the other PowerShell constructions (for example foreach statement instead of ForEach cmdlet, if-else statement instead of Where-Object cmdlet etc.), reduce usage of PowerShell advanced functions etc. For more information, see this Microsoft Connect page: https://connect.microsoft.com/PowerShell/feedback/details/559223.

Searching for PowerGUI Script Editor Add-Ons Online


To find and get PowerGUI Script Editor add-ons, click Tools | Find Add-ons Online. This will open the Find Add-ons Online dialog:

41

PowerGUI 3.5 - User Guide

Supply applicable keywords in the search box and click Search (to display all available add-ons, simply leave the search box blank). Search is performed within the PowerGUI community website.

Running PowerGUI Script Editor in Multithreaded Apartments Mode


By default, PowerGUI Script Editor runs in the Single-Threaded Apartments (STA) mode. However, if you want PowerGUI Script Editor to work in Multithreaded Apartments mode, run either the 32-bit or the 64-bit executable of the PowerGUI Script Editor from the command line with the -MTA parameter. For more information about single-threaded and multithreaded apartments, please refer to the Processes, Threads, and Apartments MSDN article.

42

PowerGUI 3.5 - User Guide

Use Scenarios
This section discusses a few real-world examples, which you can adapt to your needs.

Making an Organizational Chart Using a Downloadable PowerPack


The Sharing Your PowerPacks Online section introduced the PowerPack library on http://powergui.org. This scenario shows how versatile PowerGUI can be. You can create an organizational chart in a matter of minutes with nothing more than an Internet connection. Take the following steps: 1. 2. 3. Make sure that the computer where you want to put the PowerPack has Quest ActiveRole Management Shell for Active Directory installed. Download the Org Chart PowerPack from http://powergui.org/entry.jspa?externalID=2424&categoryID=46. Import the downloaded PowerPack into the PowerGUI Administrative Console. For that, click File | PowerPack Management in the main menu, and use the Import button in the dialog box that opens.

43

PowerGUI 3.5 - User Guide

4.

Expand the newly-added Org Chart node and select Entire Organization. Confirm the operation in the prompt, and wait for the chart generation to complete.

The resulting chart can be viewed with as much detail as needed and exported to multiple formats.

Creating a Custom Report Using a Display Filter


In this scenario, you create a quick report showing who has local administrator rights on the computer that hosts PowerGUI. Take the following steps: 1. In the PowerGUI Administrative Console, select the Local System | Local Users and Groups | Groups node. The Results pane shows a list of available computer local groups.

44

PowerGUI 3.5 - User Guide

2.

To focus on the administrators, create a filter. For that, click the Filters button, select Name in the Property column, Contains in the Operator column, type "admin" in the Value column, and click Apply.

3.

The list is reduced to the single Administrators group. Double-click the group to perform the default action, which in this case is View Members. It is bolded in the Actions pane. The list of group members is shown.

4.

Select all members and click the Export to CSV action. In the dialog box that opens, specify the full path to the CSV file, for example, C:\Windows\Temp\local-admins.csv.

45

PowerGUI 3.5 - User Guide

Finding Code Online


Suppose you need a script that exports information about objects to HTML. In this scenario, you find a suitable script in an Internet repository using the integrated online search tool in the PowerGUI Script Editor. Take the following steps: 1. 2. 3. Make sure the computer is connected to the Internet. In the PowerGUI Script Editor, select File | Search Online in the main menu, or press Ctrl + K. The Search Online dialog box opens. Enter "Export" in the search box. The online search tool queries http://poshcode.org for matching script names. To view only the latest versions of commands in the list, select the Display latest version only option.

Quest is not affiliated with http://poshcode.org and assumes no responsibility for the code you find in this online repository. You should always review and test publicly available code before using it in a production environment.

4.

In the list of available scripts, select Export-HTML, and click Download.

46

PowerGUI 3.5 - User Guide

5. 6.

Run the script to make the function declarations known to PowerShell. In the PowerShell Console pane, type: The IntelliSense prompt suggests auto-completion options as you go along.

Get-Process | Export-Html test.html

7.

Execute the command you have typed, and see the results.

Editing and Debugging a Script


This scenario steps you through debugging this sample script in the PowerGUI Script Editor:
$wmiServices = @{} Get-WmiObject -Class Win32_Service | ForEach-Object { $wmiServices.Add($_.Name,$_) } Get-Service | ForEach-Object { $_ | Add-Member -Name Win32_Service -MemberType NoteProperty ` -Value $( if ($wmiServices.ContainsKey($_.ServiceName)) {$wmiServices[$_.ServiceName]} else {$null} ) -PassThru } | Add-Member -Name Description -MemberT ScriptProperty -Value { if ($this.Win32_Service) { $this.Win32_Service.Description } } -PassThru | Add-Member -Name LogonAs -M ScriptProperty -Val { if ($this.Win32_Service) { $this.Win32_Service.StartName } } -PassThru | Add-Member -N StartupType -M ScriptProperty -Va { if ($this.Win32_Service) { $this.Win32_Service.StartMode } } PassThru

Take the following steps: 1. 2. Copy the code into the PowerGUI Script Editor and save it as a local file. Set a breakpoint at the $wmiServices.Add($_.Name,$_) method call location. For that, right-click this word and select Toggle BreakPoint or place your cursor on the word and press F9.

47

PowerGUI 3.5 - User Guide

3.

Start debugging the script by pressing F5.


If the PowerShell execution policy is set to the default policy AllSigned, then debugging unsigned scripts may fail. To avoid this, change the PowerShell execution policy or select the Turn off the requirement for scripts to be signed option in Tools | Options | Debug Options.

4.

When the script stops at the breakpoint you have set, check the Variables pane in the lower left corner to view the current values of variables.

5.

Use the Debug | Step Into command again to progress one step further and check the variables again.

48

PowerGUI 3.5 - User Guide

6.

7.

Remove the breakpoint from $wmiServices.Add($_.Name,$_) by right-clicking it and selecting Toggle BreakPoint or by placing the cursor on the word and pressing F9. Select Debug | Start Debugging in the main menu or press F5. See the output in the PowerShell Console pane, and note how the Count property of the $wmiServices variable has changed.

If you have multiple scripts to debug, consider whether you want to perform all your debugging activity in the same PowerShell runspace, or create a clean runspace for each debugging run. This is specified in the Options dialog box on the Debug Options screen by the Run all scripts in the same runspace (the default) and Reset PowerShell runspace each time debugging is started options.
You can manually create a clean PowerShell runspace by clicking Debug | Reset Runspace. When the Reset PowerShell runspace each time debugging is started option is on, the runspace is not cleared for text selections that you execute or
49

PowerGUI 3.5 - User Guide

for commands that you enter in the PowerShell Console pane of the PowerGUI Script Editor.

Creating a Custom GUI for Helpdesk Users


In this scenario, you create a customized PowerGUI-based console for helpdesk operators. You expose only the functionality needed for day-to-day helpdesk operations, and remove the ability to extend that functionality. Take the following steps: 1. 2. 3. 4. Prepare the necessary set of nodes and actions, and export it as a standalone PowerPack. Disable modifications to the user interface with the Lockdown.xml file. Deploy the PowerGUI Administrative Console on the target users' computers. Distribute the new standalone PowerPack and lockdown settings using the Redirections.xml file.

Creating a Specialized Helpdesk Console


The predefined Active Directory PowerPack can be used as a starting point for making a customized helpdesk console. Remove the nodes and actions that are not intended for helpdesk operators, and add new actions and commands if necessary. Once the console looks and works the way you want, export the resulting configuration as a new PowerPack. To prepare for using this PowerPack as a standardized console for helpdesk operators, take the following steps: 1. 2. Copy the resulting *.powerpack file to a network share that is available to all future users of the customized consolefor example, \\mysrv\public\cfg. Configure PowerGUI on helpdesk operators' computers to load the configuration from this location.

Disabling Changes to the Console


Now that you have the set of functionality that you need, prevent users from inadvertently or intentionally modifying this functionality. In the PowerGUI user profile folder (for details about profile locations, see the Delegating Administrative Tasks section in this document), find the Lockdown.xml file, and open it with your preferred XML editor. The file contains <Item> blocks like the following:
<Item Guid="6EEC597F-2CFA-400b-98A2-32469C7C86FB" DisplayName="Folder: Rename"> <Enabled>True</Enabled> <Visible>True</Visible> </Item>

The <Enabled> element specifies whether the action in <Item> is allowed. The <Visible> element specifies whether it even appears in context menus in the user interface.

50

PowerGUI 3.5 - User Guide

To effectively disallow user interface customization, it is sufficient to set <Enabled> and <Visible> to False for items with display names such as the following: TreeNode: New TreeNode: Delete TreeNode: Rename TreeNode: View Properties TreeNode: Change Cmdlet TreeNode: Change Cmdlet Parameters

Depending on the purpose of your console, you may want to restrict other items as well. Save your changes and copy the file to a network share that is available to all future users of the customized console. For example, the file becomes \\mysrv\public\cfg\helpdeskui-lockdown.xml.

Sharing the Console Configuration


Now you need to make helpdesk operators' PowerGUI instances load the PowerPacks you have prepared. For that, make a Redirections.xml file that points to the lockdown file and the folder with PowerPack files. Create a Redirections.xml file with contents like the following:
<?xml version="1.0" encoding="utf-8"?> <Redirections> <Lockdown>\\mysrv\public\cfg\helpdesk-ui-lockdown.xml</Lockdown> <PowerPackFolders> <Folder>\\mysrv\public\cfg</Folder> </PowerPackFolders> </Redirections>

In the <Lockdown> elements, specify the XML file you have prepared. In the <PowerPackFolders> element, specify the folder with the custom *.powerpack file.

Distributing the Configuration


To distribute the Redirections.xml file among helpdesk operators, use any method approved in your environment: remote access, logon script, Group Policy, and so on. The Redirections.xml file can be stored in the following locations: The user's PowerGUI profile folder The All Users profile folder

The Delegating Administrative Tasks section in this document contains details about PowerGUI profiles and a note about using the All Users profile.

51

PowerGUI 3.5 - User Guide

Customizing the Console Start Page (Optional)


When you create a specialized PowerGUI Administrative Console, it is appropriate to customize its start page and use company branding on it. This can be done with PowerGUI. First, create the home page in a Web authoring tool that can save MHT files. MHT is the only single-file format supported by PowerGUI for its start page. When you have created the page, take the following steps: 1. Copy the MHT file to a network share that is available to all future users of the customized consolefor example, \\mysrv\public\cfg\helpdesk-welcomepage.mht. Add an entry like the following entry to the Redirections.xml file described in the previous procedures:

2.

<WelcomePagePath>\\mysrv\public\cfg\helpdesk-welcomepage.mht</WelcomePagePath>

In the <WelcomePagePath> element, specify the MHT file you have prepared. The <WelcomePagePath> element must be inside the <Redirections> element. 3. Distribute the updated Redirections.xml file using any method approved in your environment, as described in the Distributing the Console section above.

52

PowerGUI 3.5 - User Guide

About Quest Software, Inc.


Established in 1987, Quest Software (Nasdaq: QSFT) provides simple and innovative IT management solutions that enable more than 100,000 global customers to save time and money across physical and virtual environments. Quest products solve complex IT challenges ranging from database management, data protection, identity and access management, monitoring, user workspace management to Windows management. For more information, visit www.quest.com.

Contacting Quest Software


Email Mail info@quest.com Quest Software, Inc. World Headquarters 5 Polaris Way Aliso Viejo, CA 92656 USA www.quest.com

Web site

Refer to our Web site for regional and international office information.

Contacting Quest Support


Quest Support is available to customers who have a trial version of a Quest product or who have purchased a Quest product and have a valid maintenance contract. Quest Support provides unlimited 24x7 access to our Support Portal at www.quest.com/support From our Support Portal, you can do the following: Retrieve thousands of solutions from our online Knowledge Base Download the latest releases and service packs Create, update and review Support cases

View the Global Support Guide for a detailed explanation of support programs, online services, contact information, policies and procedures. The guide is available at: www.quest.com/support.

53

PowerGUI 3.5 - User Guide

Third Party Contributions


PowerGUI contains some third party components (listed below). Copies of their licenses may be found at http://www.quest.com/legal/third-party-licenses.aspx. COMPONENT LICENSE OR ACKNOWLEDGEMENT

Extend OpenFileDialog and SaveFileDialog 1.0

The Code Project Open License (CPOL) 1.02

Extend OpenFileDialog and SaveFileDialog 1.0: License Text


Preamble This License governs Your use of the Work. This License is intended to allow developers to use the Source Code and Executable Files provided as part of the Work in any application in any form.

The main points subject to the terms of the License are:

Source Code and Executable Files can be used in commercial applications; Source Code and Executable Files can be redistributed; and Source Code can be modified to create derivative works. No claim of suitability, guarantee, or any warranty whatsoever is provided. The software is provided "as-is". The Article accompanying the Work may not be distributed or republished without the Author's consent This License is entered between You, the individual or other entity reading or otherwise making use of the Work licensed pursuant to this License and the individual or other entity which offers the Work under the terms of this License ("Author").

License THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CODE PROJECT OPEN LICENSE ("LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.

BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HEREIN, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE AUTHOR GRANTS YOU THE RIGHTS CONTAINED HEREIN IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. IF YOU DO NOT AGREE TO ACCEPT AND BE BOUND BY THE TERMS OF THIS LICENSE, YOU CANNOT MAKE ANY USE OF THE WORK.

Definitions. "Articles" means, collectively, all articles written by Author which describes how the Source Code and Executable Files for the Work may be used by a user. "Author" means the individual or entity that offers the Work under the terms of this License. "Derivative Work" means a work based upon the Work or upon the Work and other pre-existing works. "Executable Files" refer to the executables, binary files, configuration and any required data files included in the Work.

54

PowerGUI 3.5 - User Guide "Publisher" means the provider of the website, magazine, CD-ROM, DVD or other medium from or by which the Work is obtained by You. "Source Code" refers to the collection of source code and configuration files used to create the Executable Files. "Standard Version" refers to such a Work if it has not been modified, or has been modified in accordance with the consent of the Author, such consent being in the full discretion of the Author. "Work" refers to the collection of files distributed by the Publisher, including the Source Code, Executable Files, binaries, data files, documentation, whitepapers and the Articles. "You" is you, an individual or entity wishing to use the Work and exercise your rights under this License. Fair Use/Fair Use Rights. Nothing in this License is intended to reduce, limit, or restrict any rights arising from fair use, fair dealing, first sale or other limitations on the exclusive rights of the copyright owner under copyright law or other applicable laws. License Grant. Subject to the terms and conditions of this License, the Author hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: You may use the standard version of the Source Code or Executable Files in Your own applications. You may apply bug fixes, portability fixes and other modifications obtained from the Public Domain or from the Author. A Work modified in such a way shall still be considered the standard version and will be subject to this License. You may otherwise modify Your copy of this Work (excluding the Articles) in any way to create a Derivative Work, provided that You insert a prominent notice in each changed file stating how, when and where You changed that file. You may distribute the standard version of the Executable Files and Source Code or Derivative Work in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution. The Articles discussing the Work published in any form by the author may not be distributed or republished without the Author's consent. The author retains copyright to any such Articles. You may use the Executable Files and Source Code pursuant to this License but you may not repost or republish or otherwise distribute or make available the Articles, without the prior written consent of the Author. Any subroutines or modules supplied by You and linked into the Source Code or Executable Files this Work shall not be considered part of this Work and will not be subject to the terms of this License. Patent License. Subject to the terms and conditions of this License, each Author hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, import, and otherwise transfer the Work. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: You agree not to remove any of the original copyright, patent, trademark, and attribution notices and associated disclaimers that may appear in the Source Code or Executable Files. You agree not to advertise or in any way imply that this Work is a product of Your own. The name of the Author may not be used to endorse or promote products derived from the Work without the prior written consent of the Author. You agree not to sell, lease, or rent any part of the Work. This does not restrict you from including the Work or any part of the Work inside a larger software distribution that itself is being sold. The Work by itself, though, cannot be sold, leased or rented. You may distribute the Executable Files and Source Code only under the terms of this License, and You must include a copy of, or the Uniform Resource Identifier for, this License with every copy of the Executable Files or Source Code You distribute and ensure that anyone receiving such Executable Files and Source Code agrees that the terms of this License apply to such Executable Files and/or Source Code. You may not offer or impose any terms on the Work that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute the Executable Files or Source Code with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License.

55

PowerGUI 3.5 - User Guide You agree not to use the Work for illegal, immoral or improper purposes, or on pages containing illegal, immoral or improper material. The Work is subject to applicable export laws. You agree to comply with all such laws and regulations that may apply to the Work after Your receipt of the Work. Representations, Warranties and Disclaimer. THIS WORK IS PROVIDED "AS IS", "WHERE IS" AND "AS AVAILABLE", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OR CONDITIONS OR GUARANTEES. YOU, THE USER, ASSUME ALL RISK IN ITS USE, INCLUDING COPYRIGHT INFRINGEMENT, PATENT INFRINGEMENT, SUITABILITY, ETC. AUTHOR EXPRESSLY DISCLAIMS ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES OR CONDITIONS, INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF MERCHANTABILITY, MERCHANTABLE QUALITY OR FITNESS FOR A PARTICULAR PURPOSE, OR ANY WARRANTY OF TITLE OR NON-INFRINGEMENT, OR THAT THE WORK (OR ANY PORTION THEREOF) IS CORRECT, USEFUL, BUG-FREE OR FREE OF VIRUSES. YOU MUST PASS THIS DISCLAIMER ON WHENEVER YOU DISTRIBUTE THE WORK OR DERIVATIVE WORKS. Indemnity. You agree to defend, indemnify and hold harmless the Author and the Publisher from and against any claims, suits, losses, damages, liabilities, costs, and expenses (including reasonable legal or attorneys fees) resulting from or relating to any use of the Work by You. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL THE AUTHOR OR THE PUBLISHER BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK OR OTHERWISE, EVEN IF THE AUTHOR OR THE PUBLISHER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Termination. This License and the rights granted hereunder will terminate automatically upon any breach by You of any term of this License. Individuals or entities who have received Derivative Works from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 6, 7, 8, 9, 10 and 11 will survive any termination of this License. If You bring a copyright, trademark, patent or any other infringement claim against any contributor over infringements You claim are made by the Work, your License from such contributor to the Work ends automatically. Subject to the above terms and conditions, this License is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, the Author reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. Publisher. The parties hereby confirm that the Publisher shall not, under any circumstances, be responsible for and shall not have any liability in respect of the subject matter of this License. The Publisher makes no warranty whatsoever in connection with the Work and shall not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. The Publisher reserves the right to cease making the Work available to You at any time without notice Miscellaneous This License shall be governed by the laws of the location of the head office of the Author or if the Author is an individual, the laws of location of the principal place of residence of the Author. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this License, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. This License constitutes the entire agreement between the parties with respect to the Work licensed herein. There are no understandings, agreements or representations with respect to the Work not specified herein. The Author shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Author and You.

56

Вам также может понравиться