This function will let you create a database connection object for connecting to a Microsoft SQL Server database. It supports the usual parameters; DatabaseServer, DatabaseName, Port and Credential and will return a database connection object. (more…)
New-MySqlConnection
This function will let you create a database connection object for connecting to a MySQL database. It supports the usual parameters; DatabaseServer, DatabaseName, Port and Credential and will return a MySqlConnection object. (more…)
The Holy Trinity of PowerShell Cmdlets
If you have just decided to learn PowerShell, and don’t have any prior knowledge of scripting or programming, your first meeting with it can be quite overwhelming.
This blog post is written for the absolute beginner that has no idea where to start. If that is you, please read on to get a jump-start to PowerShell! (more…)
How to add a progress bar to your PowerShell script
[Update] If you want to learn how to calculate seconds remaining when using progress bars, head on over to this post!
A very typical workflow when working with PowerShell, is to iterate through a collection of data. Inside each loop, you would perform some action, like getting or setting some data for instance. Depending on the size of the array, and the particular work you are doing within each iteration, this might often be a part of your script where users get little-to-none feedback that the script is still running.
Usability-wise this is bad, and you should strive to give the user some feedback that ‘stuff is happening‘. In this post I will show you how you can use the Write-Progress cmdlet to add a progress bar to your script, to give the user the needed visibility to know it’s running. (more…)
Quick tip: Determine if input comes from the pipeline or not
Usually you shouldn’t need to know whether data input comes from the pipeline or a parameter, but in case you are in a position where you really need to know, this post will show you a quick and easy way of determining this. (more…)
Quick tip: Get all .NET cultures
If you are working with different cultures, this quick tip might be for you. This is a one-liner that will show all cultures that ship with .NET, including neutral and specific cultures. (more…)
Show-Calendar, cal for PowerShell
This is a PowerShell implementation of the cal command found in Unix/Linux. Its task is quite simply to output a calendar view of the choosen month(s). (more…)
Quick tip: Convert to Title Case
Most people know how to convert a string to all upper case or all lower case. In this quick tip, I’ll show you how to use ‘TextInfo’ to convert a string to Title Case. (more…)
Get-FileType
The other day I came across an excellent function written by Boe Prox, called Get-FileSignature. His function will read a file and give you the Hex and ASCII signature of the file. I thought a bit about how I could use this function and came across several sites on-line listing the file signatures of known file formats. That got me thinking! What if I could create a function that tried to determine a files type based on its file signature? (more…)