Welcome to TechNet Blogs Sign in | Join | Help

DPM CLI Tips 'n Tricks: Powershell Basics - Part II

Tab Completion

The most fascinating part of DPM Management Shell is Tab Completion of cmdlets. By learning the common verbs in Powershell (like Get, Set, Start etc.), a Windows or an Exchange admin can easily use that knowledge and learn the DPM cmdlets. This is because the same verbs are used in DPM Management Shell too.

 

For example: To get the list of protected servers backed-up by a DPM server, one needs to just type Get-P and keep pressing tab. This would result in Powershell suggesting the various cmdlets, and you can choose the right one needed. The ones that you would see in this example are - Get-Process, Get-ProductionCluster, Get-ProductionServer etc.

 

In addition, if you can also tab complete the various parameter names too in the same way, by typing a “-“ after the cmdlet name and pressing tab.

 

 

Examples of cmdlet usage(Get-Help <cmdlet> -example)

 

Getting directly to the example usage of a cmdlet can be done easily with optional parameters in Get-Help - Get-help <cmdletname> -example. This will directly print only the example usages of the cmdlet:

 

For example:

 

PS D:\> Get-help Get-ProtectionGroup -example

 

NAME

 Get-ProtectionGroup

 

SYNOPSIS

 Retrieves the list of protection groups on the DPM server.

 

EXAMPLE 1

 Get-ProtectionGroup -DPMServerName TestingServer

 

This command returns the protection group on a DPM server.

 

Getting only the cmdlet syntax (Get-Command <cmdlet> -syntax)

Another quick help about the syntax of cmdlet would be get by typing

 

PS D:\> Get-Command Get-Datasource -syntax

 

Get-Datasource [-DPMServerName] <String> [-Inactive] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>]

 

Get-Datasource [-ProductionServer] <ProductionServer> [-Async] [-Inquire] [-Replica] [-Tag <Object>] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>]

 

Get-Datasource [-ProtectionGroup] <ProtectionGroup> [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>]

 

Get-Datasource [-DPMServerName] <String> [-SearchPath] <String> [[-ProductionServerName] <String>] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>]

 

 

Using the object member properties (Get-Member)

With the help of get-member you can verify/set the property of the object.

 

PS D:\> $pg = Get-ProtectionGroup “MyDPMServerName”

PS D:\> $pg | get-member

 

TypeName: Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.OMCommon.ProtectionGroup

 

Name                                  MemberType    Definition

----                                    ----------       ----------

AddProtectableObject             Method           System.Void AddProtecta...

AddProtectionOptions             Method           System.Void AddProtecti...

.

.

FriendlyName                        Property           System.String FriendlyN...

InitializationType                   Property           Microsoft.Internal.Ente...

 

Now these properties can be used to filter and get a specific PG.

 

For Example:

 

$clipg = Get-ProtectionGroup $dpmname | where { $_.FriendlyName -eq $pgname }

 

 

CLI Help Updates and Errata

Any additional help information or errata gets updated per cmdlet and is available at http://go.microsoft.com/fwlink/?LinkId=95130.

 

- Mukul Shekhawat, Balaji Hariharan

Published Monday, June 30, 2008 3:32 PM by dpm

Comments

Monday, June 30, 2008 2:18 PM by marco.shaw

# re: DPM CLI Tips 'n Tricks: Powershell Basics - Part II

PowerTab when using tab completion for a "graphical presentation" of all the available choices:

http://thepowershellguy.com/blogs/posh/pages/powertab.aspx

Sunday, July 06, 2008 10:07 PM by Sean Kearney

# re: DPM CLI Tips 'n Tricks: Powershell Basics - Part II

Question (Not sure where else to post this)

Is there a cmdlet in Powershell to check the status of DPM agent to notify if it's down for any reason?

Couldn't find one... :P

Thursday, July 10, 2008 11:03 AM by rbrault

# re: DPM CLI Tips 'n Tricks: Powershell Basics - Part II

Sean, A good place to start is here: http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?pg=1&guid=&sloc=en-us&dg=microsoft.public.dataprotectionmanager&fltr=

This is the SPM discussion group. The gentlemen there are very knowledgable and quick to respond.

Friday, July 18, 2008 9:33 PM by Sean Kearney

# re: DPM CLI Tips 'n Tricks: Powershell Basics - Part II

Hey thanks a bundle! My brain shut off.  The forums are an invaluable resource I keep forgetting about!  DOH!

I'll check it out

Sean

Friday Funny Guy

And big fan of DPM.  Hard to believe how EASY it is to run over RRAS!

Anonymous comments are disabled
 
Page view tracker