Converting a path to UNC path doesn’t really take that many lines of code, but having recently been in a project where I needed to do this a lot, I got tired of copy-pasting the same 2-3 lines of code back and forth, and decided to create a helper function out of it. (more…)
Change the PowerShell console size and state programmatically
Being able to change the size of the console window (or any window for that matter) are quick and easy to do using the mouse. The same for changing the window state (for example maximizing a window). But if you want to do this programmatically (for whatever reason) it’s not so simple.
I have created a small function that makes this much easier to accomplish. (more…)
Test-PasswordStrength
In my last post I showed you a function to generate secure and complex passwords. This time I have written a small function you can use to test password strength similar to the strength bar you sometimes see in password fields on websites.
New-Password
There is an ocean of password generators out there, and even quite a few written in PowerShell, but there were some features I wanted in a password generator that made me create my own. (more…)
PowerShell Prime
Prime numbers will always have a special place in every mathematicians (or cryptographers) heart. The usefulness for the standard PowerShell user is questionable, but just for the fun of it I have created/translated a couple of functions for working with Primes.
How to reload the PowerShell console session
During lunch with a colleague we started talking about how it would be really nice to be able to reload the current PowerShell session when working in the console. For those of us using the brilliant ISESteroids, this functionality have been available for ISE users for a little while now. (more…)
Convert-Temperature
This function lets you convert between different units of temperature. (more…)
Getting the data types of elements in an array
Arrays in PowerShell are quite forgiving. They are easy to declare, and they can contain elements of different types if you want to. You can quite easily check to see if an object is an array or not, but have you ever needed to check the types of the elements inside the array itself? (more…)
ConvertTo-Digits
Convert an integer into an array of bytes of its individual digits. (more…)
Adding SizeOnDisk to FileInfo
The FileInfo object is great, with lots of useful information. But there is one piece of information I miss, and that is the SizeOnDisk information that we are used to from Windows Explorer. Well, let’s do something about that, shall we? (more…)