Avatar of bibi92
bibi92
Flag for France asked on

get string in logfile

$LogFile = "C:\TEMP\deploy.log"  
$Code = 'TEST'


$LastLines = Get-Content -path $LogFile  | select -Last 30 | select-string $Code


Select-String : Cannot bind argument to parameter 'Path' because it is an empty string.
At line:1 char:36
+ $StringExist = Select-String -path $LastLines -pattern $SearchCode
+                                    ~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Select-String], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Sele
   ctStringCommand

Thank you

Best regards 
Powershell

Avatar of undefined
Last Comment
oBdA

8/22/2022 - Mon
ste5an

The error message has nothing to do with your posted fragment.
ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes