I have the following code
Select-String -path errors.log -Pattern 'VirtualMachine\s*-vm-' | %{$_.Matches
| Select Value}
It outputs:
Value
--
VirtualMachine-vm-
The error file has VirtualMachine-vm-12345 but will change so I need to find not an exact match.