Initialise PowerShell Array with Sequential Server Names
$servers = (1..10 | %{"server{0:00}abc" -f $_}) `
+ (1..2 | %{"server{0:00}def" -f $_})
#output results:
$servers | %{ $_ }
<#
PowerShell code which initialises an array with a list of server names:
server01abc
server02abc
server03abc
server04abc
server05abc
server06abc
server07abc
server08abc
server09abc
server10abc
server01def
server02def
#>
Written by John Bevan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Powershell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#