Archive for October, 2012

Howto start shell application from PowerShell cmdlet/function using C# in Visual Studio 2012

Once again, during a work for a bigger, much bigger, project I’ve developed a little feature that I thought I should share with you girls and boys. At Microsoft Knowledge Base Article 305369 I found what I used as a base for this coding exercise. I had the need of...

Howto write a PowerShell Cmdlet Function in c# using Visual Studio 2012: Step 3 – Parameters

Welcome to the third post in my little series of post on how to write PowerShell Cmdlets/functions in Csharp using Visual Studio 2012. This time we will take a look at using  parameters to get stuff done. A new verb I’ve talked about it before but didn’t show it back...

You cannot call a method on a null-valued expression Win32_EncryptableVolume

I’ve been creating a PowerShell script to enable BitLocker in Windows 7. “All of a sudden” the script stopped working. After some time of troubleshooting I found that the problem where that when I called the method ProtectKeyWithTPM on the WMI class Win32_EncryptableVolume I got the error message “You cannot...

Howto write a PowerShell function or Cmdlet in C# using Visual Studio 2012: Step 2–Multiply functions in one DLL

/ I hope you liked my previous guide on how to write a PowerShell function/Cmdlet in C# using Visual Studio 2012. We’ll continue take a baby step towards some more advanced functions like using parameters. This time we’ll look at how to write two or more functions in one DLL....

Howto Write a PowerShell Module or Function in C# with Visual Studio 2012

This is a post in a series of posts, you can read Step 2, 3, 4 and 5 also. So you’ve probably more than stumbled upon Microsoft PowerShell at this point. Or you’ll have some really awesome couple of weeks ahead of yourself now that Windows Server 2012 is released....