Greetings experts
Trying to figure out how to get validatescript to work. Currently it allows incorrect datacenter name and it is allowing me to enter multiple datacenter names, only need to enter only one datacenter name.
Any help would be greatly appreciated
Norm
#cmdlet binding example
[CmdletBinding()]
param(
[Parameter(Mandatory,HelpMessage="Enter a Datacenter Name")]
[ValidateScript(
{
(Get-Datacenter $DCChoice -ErrorAction SilentlyContinue)
throw "Please enter a valid Datacenter Name."
$true
}
)]
[String[]]
$DCChoice
)