Friday, November 12, 2010

CommandShell TAB expansion is slow

When you have the SCOM snap in loaded in the PowerShell you will experience that the TAB expansion within the shell is very (very!) slow. This is a bug in the snap in.

To fix this, you can do that workaround:
$tabExpand = (get-item function:\tabexpansion).Definition
if($tabExpand -match 'try {Resolve-Path.{49}(?=;)')
{
     $tabExpand = $tabExpand.Replace($matches[0], "if((get-location).Provider.Name -ne 'OperationsManagerMonitoring'){ $($matches[0]) }" )
     invoke-expression "function TabExpansion{$tabExpand}"
}
You can find the whole blog from Lincoln (thanks!) here:                          http://blogs.technet.com/b/momteam/archive/2009/12/09/slow-tab-expansion-in-ops-mgr-powershell-v2-console.aspx

However, the better way is to download and install the latest version of PowerTab where this bug should be fixed. You can find some information and the link to the bits on my colleagues blog (thanks, Marc!): http://thepowershellguy.com/blogs/posh/pages/powertab.aspx
All information is provided "as is" without any warranty! Try in lab before. Handle with care in production.

0 Comments:

Post a Comment