My brief article on working with the [System.DateTime] .Net Class has been posted on PowerShell Magazine. It contains some quick tips on how to utilize this class to work with DateTime objects and how to convert strings to a DateTime object.
For example when converting the ‘accountexpires’ property of an AD account. This can be done as follows:
$Expires = ([adsisearcher]'(samaccountname=jaapbrasser)').FindOne().Properties['accountExpires']
For more tips regarding this topic, please refer to the article on PowerShell Magazine:
PowerShell Magazine has posted another article of mine. The article explains how to use the System.Net.Dns .Net class to resolve host names and IP addresses.
Have a look at the article here:
PowerShell Magazine: #PSTip Resolve IP Address or a host name using .NET Framework
Today my article containing some tips and tricks for working with files and folders in PowerShell was published on PowerShell Magazine. It includes a work-around for working with long path names. Be sure to check it out at:
PowerShell Magazine: Jaap Brasser’s Favorite PowerShell Tips and Tricks
Recently I came across an article about a random number generator based on quantum effects in a vacuum. Scientists at The Australian National University have created the fastest random number generator based on this concept.
Sub-atomic particles appearing and disappearing measured by extremely sensitive light sensors are generating these random numbers. According to Quantum Theory these events are completely random and connect be predicted.
Because I thought the concept was quite interesting I decided to write a small PowerShell script, for PowerShell version 3. Using the new Invoke-Webrequest Cmdlet. The script grabs the content from the dedicated website and finds the block of 1024 hexadecimal characters.
Based on the parameters supplied to the script it can return either a hexadecimal number of 1 to 15 characters or a converted to a decimel integer. As a third option the script can also be leveraged to generate a seed to be used with the Get-Random Cmdlet, because a Quantum Seed is just so much better.
I have uploaded the script to the Microsoft Technet Gallery, you can check it out here:
Quantum Random Number Generator, in PowerShell
By all means check out the ANU Website as well, there are some guessing games as well, so you can try to beat the random generator.