I am trying to run netmon on a series of machines, I am able to start netmon, which appears to be fine. However when I issue a Stop-Job *
it appears that netmon is not closing correctly, which causes the packet capture to be useless. Netmon is expecting a "ctrl + C" , is there a way to issue this when I am stopping the jobs? Netmon can use other key sequences using the /stopwhen /keypress option is used
$server = get-content C:\Server.txt
$capturedevice = "CAPTUREMACHINE"
foreach ($server in $server)
{ $scriptBlockContent = { param ($servername)
Nmcap /capture /network * /file C:\temp\"$servername".chn:400MB }
Invoke-Command -ComputerName $server -Scriptblock $scriptBlockContent -ArgumentList $server -AsJob }
foreach ($capturedevice in $capturedevice){ $scriptBlockContent =
{ param ($capturedevicename) Nmcap /capture /network * /file D:\temp\"$capturedevicename".chn:400MB }
Invoke-Command -ComputerName $capturedevice -Scriptblock $scriptBlockContent -ArgumentList $capturedevice -AsJob }