Category Archives: powershell

PowerShell related material and PowerShell programs.

Endianness data storage

I was originally looking at generating random numbers in PowerShell by using the .NET class [System.Security.Cryptography.RandomNumberGenerator]. At some point I got sidetracked and wondered how two and four byte numbers were stored in my byte array. So hence the following … Continue reading

Posted in powershell | Leave a comment

Centre PowerShell forms

The .NET Framework class Form represents a window or dialog box that makes up an application’s user interface. In other words this is how we can build a GUI interface to an application with forms and dialog boxes.   The StartPosition property of … Continue reading

Posted in powershell | Tagged | Leave a comment

List lines from a text file

There may come a time when you want to display just a few lines from a text file. The following PowerShell code can be used to achieve this. The examples will be based upon a sample text file containing the … Continue reading

Posted in powershell | Tagged , | Leave a comment

Enumerating over objects

Looping Through a Collection of Objects. There are two ways of enumerating over objects. One may be considered easier than the other. Nevertheless the two ways are shown below. 1. Using a WHILE loop and GetEnumerator. 2. Using a foreach loop. … Continue reading

Posted in powershell | Tagged , | Leave a comment

Creating CSV files for use with Excel

CSV files Working on a recent project, I was using PowerShell to manipulate a list of MS Word documents that I had to process. Reading other articles on the Internet, I realised how useful it would be if I could … Continue reading

Posted in powershell | Tagged , | Leave a comment

PowerShell and Unix crontables

Recently, I working on ways of documenting crontables we had on the various Unix servers we had a responsibility for. In the end I opted for a PowerShell solution to create an XML file for each of the crontables. The … Continue reading

Posted in powershell | Tagged , | Leave a comment

.NET List Class

The .NET List Class represents a strongly typed list of objects. It also provides methods to search, sort, and manipulate lists. The following code gives an example on how the List Class can be used. Lines 41-46 produced a sorted output … Continue reading

Posted in powershell | Tagged , | Leave a comment