Search Results

Search found 1 results on 1 pages for 'xbnevan'.

Page 1/1 | 1 

  • Why can't i call Contains method from my array?

    - by xbnevan
    Arrrg!I am running into what i feel is a dumb issue with a simple script i'm writing in powershell. I am invoking a sql command that is calling a stored proc, with the results i put it a array. The results look something like this: Status ProcessStartTime ProcessEndTime ------ ---------------- -------------- Expired May 22 2010 8:31PM May 22 2010 8:32PM What i'm trying to do is if($s.Contains("Expired")) , report failed. Simple...? :( Problem i'm running into is it looks like Contains method is not being loaded as i get an error like this: Method invocation failed because [System.Object[]] doesn't contain a method named 'Contains'. At line:1 char:12 + $s.Contains <<<< ("Expired") + CategoryInfo : InvalidOperation: (Contains:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound So, what can i do to stop powershell from unrolling it to string? Actual ps script below - $s = @(Invoke-Sqlcmd -Query "USE DB GO exec Monitor_TEST_ps 'EXPORT_RUN',NULL,20 " ` -ServerInstance "testdb002\testdb_002") if ($s.Contains("Expired")) { Write-Host "Expired found, FAIL." } else { Write-Host "Not found, OK." }

    Read the article

1