DPM and Invoke-Command, bring the DPM shell to your machine

Posted: June 15, 2011 in Powershell
Tags: , , , ,

Not that long ago, I created an article about DPM and I referenced DPM commands to be run in the DPM shell and only now realised that not everyone has the DPM console installed as this is not the easiest console to install and get working.

So, I am now the Proud Owner of Learn Windows PowerShell in a month of Lunches and I am an now playing and have figured out how to import the necessary commands with Remoting. There are some steps you need to follow to get PSRemoting working across an enterprise, this might help.

Once this is done, let the Magic begin.

First, lets create a New-PSSession

1. New-PSSession –ComputerName <FQDN of DPM Server> (figured this one out the hard way)

example : New-PSSession –ComputerName mydpmserver.mydomain.com

Second, lets use Invoke-Command to import the module (we are going to add the DPM Snapin)

2. invoke-Command -ScriptBlock {add-pssnapin Microsoft.DataProtectionManager.PowerShell}  -Session (Get-PSSession –ComputerName <FQDN of DPM Server>)

Third, we are going to import these commands using Import-PSSession (you can add a prefix here using –prefix to identify them in a unique way)

3. Import-PSSession -Session (Get-PSSession -ComputerName <FQDN of DPM Server>) -module Microsoft.DataProtectionManager.PowerShell

Fourth, you can run Get-Command to confirm this (filtered by DPM)

4. Get-Command *DPM*

Cleaned up transcript and copied into a word file for ease here


For those of who read my previous post, you would have noticed the attach-productionserver.ps1 command. If you are really observant you would have noticed that it and a few others are not here.

So, lets try to get a workaround for that.

It is still a work in progress, however i am using Enter-PSSession for now

1. Enter-PSSession –ComputerName <FQDN of DPM Server>

2. Navigate to the DPM Bin Folder

   cd ‘C:\Program Files\Microsoft DPM\DPM\bin’

3. You will now see that the attach- commands are available

4. When done, use Exit-PSSession

Cleaned up transcript and copied into a word file for ease here


I recommend you follow Don Jones, author of the above mentioned book and PowerShell MVP

Hope you find this helpful and as interesting as I did.


Follow me

facebook-small322 twitter-small322


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s