Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

ValidateSet funktioniert nicht mit abstand in den strings

$
0
0

hallo zusammen

in mein ValidateSet habe ich div. Collection Name mit abstand und () wo nicht erkannt werden bei ausführen der Function.

es erscheint die FM:

Get-RDSUserTest : Cannot validate argument on parameter 'CollectionName'. The argument "Application" does not belong to the set "Application Servers,Office Applications,Servers (Collection A),Servers (Collection B)" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
At line:1 char:33
+ Get-RDSUserTest -CollectionName Application Servers
+                                 ~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-RDSUserTest], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Get-RDSUserTest

Hier noch meine Function param Block.

[CmdletBinding()]
param(
[Parameter(
    Mandatory=$True,Position=1,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True,
    HelpMessage = "Enter a CollectionName")]
    [ValidateSet("Application Servers","Office Applications","Servers (Collection A)","Servers (Collection B)")]
    [string[]]$CollectionName,

    [Switch]$LoadRemoteDesktopModul
)

Was ich versucht habe die Collection Name mit doppelte Hochkomma ""Application Servers"" oder "'Application Servers'"

Klappt leider auch nicht. Funktioniert ValidateSet überhaupt mit abstand im String? Wenn ja, wie muss ich vorgehen?

Vielen Dank

Grüsse

 


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>