Database, Software, and System Engineering

Importing and Exporting Windows Features with PowerShell

This applies to Windows 7, Windows Server 2008 and Windows Server 2008 R2 and the use of Get-WindowsFeature and Add-WindowsFeature.  For Windows 8, Windows Server 2012, and Windows Server 2012 R2 Microsoft has overhauled these two cmdlets that I’ll handle the same usage in a different post. First the cmdlets we need are in the server manager module […]


PEM Certificate from .NET/PowerShell

It is a tough thing – cryptography.  Especially when you try to standardize it enough for consumption among various components on hosted on multiple platforms.  Microsoft has done a good job of making their import features agnostic to file format.  Other platforms are not so forgiving and require it to be very specific based on […]

Grant NTFS Permissions to a Domain Group using C#

Coupled with creating a network file share, you need to also ensure NTFS permissions are not more restrictive than the permissions you create on your share.  Otherwise, they will trump those permissions and your file share will be half done.  The least restrictive permissions always win.  See technet for more details on the security model. Using […]


Network File Share in .NET C#

Well, kinda… Using the ManagmentClass class (someone might be regretting the naming here) we can expose WMI in .NET.  Then, we can operate on methods of the Windows Managment Interface to create shares in C# code. Like all Windows API work, this isn’t super clear throughout MSDN or the Internet.  I also find that Windows […]


Using Write-EventLog cmdlet in PowerShell

I set out to create a standard method of interacting with the Write-EventLog cmdlet.  Simply put it will fail and I think it shouldn’t.  It could be a little more robust, so I created my own function that is.  The big thing that most people will benefit from is the ability to create a new […]


Asymmetric Encryption of Text using x.509 Certificates in PowerShell

I’ve been requested to encryption sections of my script (user name/password) using a certificate issued by a trusted CA.  No problem. To do this in the blog, I’ll I created a self-signed x.509 certificate and a CN of “PowerShellCert”.  I will use the public portion of the certificate in a file that’s base64 .cer to encrypt the […]

, ,

PowerShell for Free Space?

I needed a script that could be executed to report free space.  I’ll review how to do it locally and how to wrap it around an array of computer names so it can be ran from anywhere with RPC access to the target machines. For Starters Here’s the script that gets my my report from […]

, ,

To VARCHAR or NVARCHAR? (and how it bit me using HASHBYTES)

The Difference The key difference between the two data types is how they’re stored. VARCHAR is stored as regular 8-bit data, NVARCHAR strings are stored in the database as UTF-16. UTF-8 (UCS Transformation Format—8-bit) is a variable-width encoding that can represent every character in the Unicode character set. It was designed for backward compatibility with […]

WinRM for an Environment Simplified

Windows Remote Management (WinRM) is the Microsoft implementation of WS-Management Protocol.  In many key items within the latest offerings from Microsoft management, included most obviously for me, PowerShell, it is the under pinning of many of the remote management operations. The idea is a good one.  Align with a standard in your latest technologies methods used to manage […]

, ,

Execute PowerShell from a ASP.NET Web Application

I had an interesting request come in to automate existing server-side PowerShell processes that have been initiated by server admins thus far locally on the server, using a web interface instead.  Turns out, the admins want to offload the work back to the business users so it can be more on demand. Essentially, they want the […]

Previous Posts