Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 178304

Param Validate Script error

$
0
0

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

    )


Viewing all articles
Browse latest Browse all 178304

Trending Articles