0

I have a output of PowerCLI stored in a variable. I want to check the string is present in the string, if present continue with for loop.

Below is my script:

$stringtosearch = "test"
$getds = Get-Datastore | Select-Object -ExpandProperty Name
if ($dsname -contains $getds) {
    Write-Host "datastore exists"
    continue
}

The above script is not getting into loop and continuing for loop.

Ansgar Wiechers
  • 184,186
  • 23
  • 230
  • 299
louis
  • 587
  • 2
  • 8
  • 23

0 Answers0