Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Blog posts : "scripting"

Create PowerShell array of object in different way

When working with arrays and PSObject in PowerShell, there are several efficient methods for creating and managing array elements. Below are examples that highlight both the creation of arrays and the addition of elements in different ways. 

To create an empty array in PowerShell, you have two m…

Read more

Powershell adding leading zeros to string or int

I was working on a script project where I wanted to create and defined names for multiple virtual machine in the series, with maintaining length of the string of names with numbers adding leading zeros, Below -f format operator one-liner command helps me to create the list.

Read more

PowerShell slice array into groups of smaller arrays

This is a small script to slice or break array into groups of smaller array, and I use it in my scripts most often. This script is very helpful when I want to batch process multiple server at time but not on all the server, instead fewer servers at servers in batch. Once I have a very big fat list o…

Read more

3 blog posts

Blog Search

Page Views

12383872

Follow me on Blogarama