Posts Tagged "Powershell Function"

Create ConfigMgr Boundary based on Active Directory Site and Services Subnet

Subnets
Every now and then I run into a case where a customer have a problem to deploy an application to a machine. Quite often the problem lies with a missing Content Boundary in Configuration Manager. Many uses the boundary type AD Site, and that is fine – IF, and only...

Encrypt files and folders using PowerShell and EFS

/ One of my customers were in need to encrypt a specific folder and all files and subfolders in that folder. Instead of using cipher they wanted to use PowerShell. I wrote a simple script to just that but this is a more refined version put into a PowerShell function....

Convert byte into kilobyte etc

I got a question from a fellow on how to convert the total size of a couple of files into a readable string that a normal user can understand. This PowerShell function at least convert a number from bytes to “best form” of bytes (MB, GB etc). /Tim

Howto write PowerShell Cmdlet in C# using Visual Studio 2012: Write Verbose Output

So we’ve come to the part when it’s time to learn how to write verbose output just like the feature “Write-Verbose” in normal PowerShell functions. Once again I continue my work on my first DLL. You can read part 1, 2, 3 and 4 on the blog. Here we use...

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...

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. One...

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....

Get-OperatingSystemSKU

During a larger script, as always, I had to create a function to get the SKU of the Operating System. Thought I should share it with you… Hope if will help. /Tim

Get-LocalDriveWithMostFreeSpace

During my scripts that downloads all TechEd sessions (found here) I created a function to find the local drive with the most free space in order to know where to store all those videos. One commenter at one post mentions that the videos from just TechEd North America ended up...

Get-FileHash

While developing a larger script I had to create a function in PowerShell to verify a file hash (aka file checksum). I didn’t really want to use the FCIV feature from Microsoft since I would be bound to have that binary downloaded since it is not part of the OS....