PowerShell Output Field Separator ($OFS variable)

$OFS which is a special variable in Powershell. OFS stands for Output Field Separator. It exposes the .Net’s Systems.String object. as shown below   You would use this to separate objects in your array For example: If you run the below code to display objects in $array you’ll see the objects displayed one in each new line as that is the default object separator: CODE: $array = (1,3,5,7) $array   OUTPUT: 1 3 5 7       By using $OFS variable, you’ll be able to specify your own separator character as shown below: Note: as the OFS operates on […]

Read more

Windows PowerShell 2.0 – The Get-Random Cmdlet

  The information in this article was written against the second Community Technology Preview (CTP2) of Windows PowerShell 2.0. This information is subject to change in future releases of Windows PowerShell 2.0. Randomize Your Results with the Get-Random Cmdlet No doubt when it came time for the 2008 Winter Scripting Games many of you thought, “Gee, I’d love to enter the Scripting Games, except for one thing: the solutions to the Scripting Games often require you to use random numbers, and Windows PowerShell doesn’t have a cmdlet that makes it a snap to generate random numbers. If PowerShell had a […]

Read more