Skip to content

Commit

Permalink
Added Create-VIAComputerName .ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
DeploymentBunny committed Nov 4, 2016
1 parent 9e86f9e commit fee6719
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Tools/Create-VIAComputerName/Create-VIAComputerName.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<#
.Synopsis
Create-VIAComputerName
.DESCRIPTION
Create-VIAComputerName
.PARAMETER ComputerPrefix
String that defines the prefix of the computername to be generated
.PARAMETER LowNumber
Integer the defines the starting number
.PARAMETER HigNumber
Integer the defines the ending number
.EXAMPLE
Create-VIAComputerName -ComputerPrefix SERVER- -LowNumber 1 -HigNumber 10
The command will return the following
SERVER-001
SERVER-002
SERVER-003
SERVER-004
SERVER-005
SERVER-006
SERVER-007
SERVER-008
SERVER-009
SERVER-010
.NOTES
Created: Nov 4, 2016
Version: 1.0
Author - Mikael Nystrom
Twitter: @mikael_nystrom
Blog : http://deploymentbunny.com
Disclaimer:
This script is provided "AS IS" with no warranties, confers no rights and
is not supported.
.LINK
http://www.deploymentbunny.com
#>
function Create-VIAComputerName
{
Param
(
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
[String]
$ComputerPrefix,

[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=1)]
[int]
$LowNumber,

[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=2)]
[int]
$HigNumber
)

$Servers = $($LowNumber..$HigNumber| ForEach-Object {"$ComputerPrefix{0:D3}" -f $_})
Return $Servers
}


0 comments on commit fee6719

Please sign in to comment.