Leveraging Proxy Functions in PowerShell

March 30, 2012

@DSotnikov just released the video recording of the session from the PowerShell Deep Dive in Frankfurt (last year). In this video, MVP Kirk Munro (poshoholic) and I demoed a project we've been working on that let's you create proxy functions. Here's a reminder of the session abstract. In this session as they take a deep dive into proxy functions in PowerShell. Shay and Kirk have been working together on PowerShell Proxy Extensions, a powerful module that leverages proxy functions and makes it easier than ever to create these powerful extensions to PowerShell. They will demonstrate what proxy functions...

Counting objects in PowerShell 3.0

March 19, 2012

Consider the following command, how many objects are in $dir? PS> $dir = Get-ChildItem The most common way to find it is to check the Count property: PS> $dir.Count But… the Count property is available only if Get-Something returns more than one object (array/collection), If the result has one object only (scalar) the Count property returns nothing, not even zero. If the result contains more than one object, the objects are accumulated in an Array (collection), and Arrays have a Count property so we get the number of objects. Now back to the question above, how...
one comment

Auto reconnect to a server you just rebooted with PowerShell 3.0

January 8, 2012

Yesterday I saw a tweet that caught my eye: Sounds familiar? What do you usually do to reconnect to your server once it is back online? How do you monitor it’s availability? In this post, Justin shares a great function (115 lines) that restarts a server, waits for it to come back online and then starts a remote desktop connection to it. Now, what if I told you that in PowerShell 3.0 you can replace that function with only two lines of code? In PowerShell 3.0, the Restart-Computer cmdlet got improved (mainly to support Workflow scenarios) and it now supports...

PSRR – Remote Registry PowerShell 3.0 Module

November 2, 2011

var addthis_config = {"data_track_clickback":true}; One of the new improvements in the .NET Framework version 4 is the Microsoft.Win32.RegistryView enumeration. On the 64-bit version of Windows, portions of the registry are stored separately for 32-bit and 64-bit applications. There is a 32-bit view for 32-bit applications and a 64-bit view for 64-bit applications. Many of the 32-bit keys have the same names as their 64-bit counterparts, and vice versa. In the 64-bit version of Registry Editor, 32-bit keys are displayed under the following registry key: HKEY_LOCAL_MACHINE\Software\WOW6432Node. I’m pleased to announce that the PSRemoteRegistry module has...

New advanced functions language features in PowerShell v3

October 24, 2011

var addthis_config = {"data_track_clickback":true}; PowerShell 3.0 CTP1 includes many new language enhancements. Here are four of them for advanced functions.   CmdletBinding and Parameter attributes We are no longer required to assign a value of $true to CmdletBinding and Parameter attributes. For example, in v2 we had to write:   param( [Parameter(Position=0, ...
no comments

Windows PowerShell 3.0 CTP1 is available for download!

September 20, 2011

var addthis_config = {"data_track_clickback":true}; Windows Management Framework 3.0 Community Technology Preview (CTP1) is available for download for Windows 7 SP1 and Windows Server 2008 R2 SP1. Read the full announcement on the PowerShell team blog. Check out this post on the PowerShell Magazine site for a quick review of new cmdlets and parameters in v3. var addthis_config = {"data_track_clickback":true};
one comment

How to disable positional parameter binding in PowerShell vNext

September 19, 2011

var addthis_config = {"data_track_clickback":true}; Windows PowerShell supports two kind of parameters: Named and Positional. In a nutshell, Named parameters must be specified on the command line while Positional parameters are inferred by the argument’s position on the command line. The type of the parameter is controlled by the attribute (see about_Parameters). What if we wanted to disable positional parameters and force users to write the parameter name and its value? Consider the following example, all parameters values are positional. Can you guess the parameter names? PS> Register-ObjectEvent $timer Elapsed Timer.Random...

Get Your Game On! Leverage Proxy Functions In Windows PowerShell

September 1, 2011

var addthis_config = {"data_track_clickback":true}; I’m excited to announce that MVP Kirk Munro (aka poshoholic) and I are going to present in the upcoming PowerShell Deep Dive track at the The Experts Conference in Frankfurt, Germany (17-19 October 2011).   In this session we will take a deep dive into proxy functions in PowerShell. We have been working together on PowerShell Proxy Extensions, a powerful module that leverages proxy functions and makes it easier than ever to create these powerful extensions to PowerShell. We will demonstrate what proxy functions are and why they are important, and then show how...
no comments