One thing I see people requesting regularly is a way to hide sensitive data in PowerShell scripts. There are multiple ways to achieve this, but the easiest method I managed to find was using PowerLocker. PowerLocker can encrypt your scripts. There's a free community version and pro version available. See the website for details.
The only issue that I found when I was using PowerLocker with PowerShell v1, was that there didn't seem to be a way to emit true objects when running a script that was encrypted using PowerLocker.
Disclaimer:
The PowerShell V2 CTP is not for everyone. You should read this PowerShell Team blog entry ( http://blogs.msdn.com/powershell/archive/2007/11/02/ctp-watch-this-space.aspx ) to find out what it is and what it isn't and then make an informed decision before installing the CTP.
One of the new features in the v2 CTP is scriptcmdlets. This basically allows you to create a regular PowerShell script, yet once the script is loaded, you've basically created something that works exactly like a true cmdlet (without any .NET programming languages like C# or VB.NET).
To show the difference, you can see a couple of my blogs posts where I go through creating a cmdlet, which actually calls another cmdlet from PowerGadgets, using C#:
http://marcoshaw.blogspot.com/2007/09/howto-invoking-cmdlets-within-cmdlet_24.html
http://marcoshaw.blogspot.com/2007/09/howto-invoking-cmdlets-within-cmdlet_25.html
I'm going to use PowerGadgets' invoke-webservice cmdlet again, to show how easy things can be done now, as compared to getting into more complicated C# programming.
My scriptcmdlet script:
----------------------------------------------------------------------------------------
Cmdlet global:my-webservice -SupportsShouldProcess
{
Process{invoke-webservice -wsdl "http://www.webservicex.net/WeatherForecast.asmx?WSDL" -method "GetWeatherByZipCode" "80526"}
}
----------------------------------------------------------------------------------------
(NOTE: Everthing between "{" and "}" must be on one single line.)
Importantly, I declare my cmdlet to be in the global scope, otherwise my-webservice won't be available in my current shell because of how PowerLocker works.
So I encrypt my script with PowerLocker:
PSH> ConvertTo-LockedScript clear.ps1 encrypted.ps1
Then run it to create the scriptcmdlet, and invoke my new scriptcmdlet:
PSH> ./encrypted.ps1
PSH> my-webservice
Latitude : 40.54729
Longitude : 105.1076
AllocationFactor : 0.008857
FipsCode : 08
PlaceName : FORT COLLINS
StateCode : CO
Status :
Details : {WeatherData, WeatherData, WeatherData, WeatherData...}
If I piped my-webservice to get-member, I'd see I have a real object.
That's it! That's was a piece of cake compared to getting down and dirty with C# programming.
Now you have a simple .ps1 script you can invoke or pass around. PowerLocker must be installed on every machine where you try to invoke this .ps1 script.