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.