Hello,
I have this script:
cls $logfile_package_ct = "" $file = "c:\Temp\DatabaseDeploy.log" $logfile_package_ct = Get-Content $file $logfile_package_ct if ((($logfile_package_ct | select-string -Pattern 'Error | Exception' -AllMatches).Matches.Count) -gt 0 ` -or ($logfile_package_ct -eq $null) ` ) {write-host "found"} else {write-host "not found"}
The value from the logfile is:
The term 'C:\Program Files\DatabaseDeploy.ps1' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correc
t and try again.
At line:1 char:5
+ & {& <<<< 'C:\Program Files\DatabaseDeploy.ps1' 'C:\Program Fil
es\' 'C:\Program Files\Staging\Logs\MESDI\Robocopy_Task.log'
'1.4.6.9.1234523' 'GDC' 'Stage to CONS' 'Database;Client;' '1.2.3.4.5.6.7'}
+ CategoryInfo : ObjectNotFound: (C:\Program File...abaseDeploy.p
s1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Exception
--------------
I know, why the script doesn't work, because the ps1 file is not there.
I want to check, if an error or exception ocure at logfile, the script should stop.
But now, the select-string command doesn't find the value exception.
The result from script is:
not found
Why that,
Thanks Horst MOSS 2007 Farm; MOSS 2010 Farm; TFS 2010; IIS 7.5