Category Archives: powershell

PowerShell related material and PowerShell programs.

A collection without duplicates

If you have a requirement to add strings to a collection but don’t want or need duplicate elements, think about using the HashSet Class. This class can be found in the System.Collections.Generic namespace. HashSet Class Namespace: System.Collections.Generic Demonstration program Sample output The use … Continue reading

Posted in powershell | Leave a comment

Cmdlet parameters

If you wish to find cmdlet’s with a particular parameter, IE ComputerName, try the following PowerShell command: PS> Get-Command -ParameterName computername Sample output     Keywords: powershell cmdlet parameter

Posted in powershell | Leave a comment

UTF8 Encoding

Summary of creating UTF8 objects Continue reading

Posted in powershell | Leave a comment

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