I am stuck with capturing the command line values , I need to capture the last 4 number in the command line
The screen shot is from Process Explorer
my code is as follows
$process = "notepad.exe"
$CommandLine_QID = Get-WmiObject Win32_Process -Filter "name = '$process'" |
Select-Object CommandLine # just capture the command line
I need to split the last 4 digit number from command line and store in a variable from here.
$Process_PID = Get-Process -Name "notepad" -ErrorAction SilentlyContinue | Select-Object ID
I then need to cross check with a variable stored in DB machines with the the variable values of $CommandLine_QID
eg: db_var1 = 9998
if($CommandLine_QID -contain db_var1)
{
write-host "value contained."
}