bibi92
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
$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
The error message has nothing to do with your posted fragment.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.