Statistics

  • Entries (5)
  • Comments (0)

Disable On the Wire Compression 

Posted by David Tuesday, August 25, 2009 11:35:57 AM
Rate this Content 0 Votes

This script will disable on the wire compression for a given protection group.  This script will check if the DPM PowerShell SnapIn is loaded and load if not which means this script can be run in PowerShell as well as the DPM Command Shell.

To run the script:  ./DisableCompression.ps1 -DPMServerName <DPMServerName> -ProtectionGroup <ProtectionGroup>

For usage instructions:  ./DisableCompression.ps1 -help

Here is the PowerShell script for you to copy or you can download the full PS1 file at the bottom of this page.

----------Script Start----------

 

#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''

#

#  Author: David Allen

#  Date:  24/08/09

#  

#  http://www.scdpmonline.org

#

#  Comment:  This script will disable on the wire

#  compression for a given DPM protection group.

#

#  Instructions for use:  ./DisableCompression.ps1 -help

#

#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''


param ([string] $DPMServerName, [string] $ProtectionGroup)


function Usage()

{

write-host

     write-host "Usage::"

write-host "DisableCompression.ps1 -DPMServerName [DPMServername] -ProtectionGroup [ProtectionGroupName]"

write-host

write-host "Run 'DisableCompression.ps1 -detailed' for detailed help"

write-host

}


if(("-?","-help") -contains $args[0])

{

Usage

exit 0

}


if(("-detailed") -contains $args[0])

{

write-host

write-host "Detailed Help :  Use this script to disable on-the-wire compression on a given protection group."

write-host

exit 0

}


#Check status of DPM SnapIn and load as necessary

$SnapIn = "Microsoft.DataProtectionManager.PowerShell"

if (get-PSSnapIn $SnapIn -ea "silentlycontinue") 

{

    write-host "PSSnapIn $snapin is loaded"

}

elseif (get-PSSnapIn $SnapIn -registered -ea "silentlycontinue") 

{

write-host "PSSnapIn $SnapIn is registered but not loaded"

Write-host "Loading PSSnapIn $SnapIn"

Add-PSSnapIn $SnapIn

}

else 

{

write-host "PSSnapIn $SnapIn not found" -foregroundcolor Red

}


#Prompt if the name of the DPM server has not been passed

if(!$DPMServerName)

{

$DPMServerName = read-host "DPMServerName:"

}


#Connect to DPM server

$DpmServer = Connect-DPMServer $DPMServerName

if (!$DpmServer)

{

    write-Error "Unable to connect to DPM server::$DPMServerName"

    exit 1

}


#Prompt if the name of the protection group has not been passed

if(!$ProtectionGroup)

{

$ProtectionGroup = read-host "ProtectionGroup:"

}


write-host "Disabling compression on protection group $ProtectionGroup" 


#Returns a list of all the protection groups on the DPM server and confirms there is at least one

$pgl = @(Get-ProtectionGroup -DPMServerName $DPMServerName)

if($pgl.count -lt 1)

{

    write-Error "No protection groups found on DPM server"

    exit 1

}


#Get protection group 

$pg = $pgl | where {$_.FriendlyName -eq $ProtectionGroup}

if(!$pg)

{

    Write-Error "Failed to get protection group"

    exit 1

}


#Get modifiable protection group

$mpg = Get-ModifiableProtectionGroup -ProtectionGroup $pg

if(!$mpg)

{

    Write-Error "Failed to get modifiable protection group"

    exit 1

}


#Enable Compression

set-performanceoptimization -protectiongroup $mpg -disablecompression


#Set the protection group to apply the change

Set-ProtectionGroup -ProtectionGroup $mpg


Write-Host "Compression disabled for portection group $ProtectionGroup"


#Disconnect from the DPM Server

Disconnect-Dpmserver

 

 

---------- Script End ----------

Attachment:  DisableCompression.ps1

Share This Using Popular Bookmarking Services
Copyright 2010 SCDPMOnline.org
You must sign in to this site to post comments.

Site Map | Printable View | © 2008 - 2010 SCDPM Online

Locations of visitors to this page

Powered by mojoPortal | HTML 5 | CSS | Design by styleshout