
Ich weiß, dass der Prozessmonitor die Funktion „Boot-Protokollierung aktivieren“ hat.
Dies wird jedoch erst beim nächsten Start wirksam.
gibt es eine Möglichkeit, die Boot-Protokollierung künftig für jeden Bootvorgang zu aktivieren?
Antwort1
Mir ist keine normale Möglichkeit bekannt, die Boot-Protokollierung dauerhaft zu aktivieren, aber es scheint, dass die Boot-Protokollierung durch zwei Registrierungswerte in der Procmon
Treiberkonfiguration gesteuert wird. Vielleicht funktioniert das (Neu-)Erstellen dieser Werte (z. B. mit einem Startskript) wie gewünscht:
if not exist %SystemRoot%\System32\Drivers\PROCMON23.sys copy PROCMON23.sys %SystemRoot%\System32\Drivers\
reg add HKLM\SYSTEM\CurrentControlSet\services\PROCMON23 /v ImagePath /t REG_SZ /d "System32\Drivers\PROCMON23.sys" /f
reg add HKLM\SYSTEM\CurrentControlSet\services\PROCMON23 /v Start /t REG_DWORD /d 0x0 /f
reg add HKLM\SYSTEM\CurrentControlSet\services\PROCMON23 /v Type /t REG_DWORD /d 0x1 /f
Bevor ich jedoch so etwas probiere, würde ich zunächst eine „normale“ Überwachung (ohne Boot-Logging) ausprobieren. Starten Sie Process Monitor einmal und konfigurieren Sie ihn so, dass er nur den Zugriff auf die hosts
Datei überwacht (Filter → Filter...). Exportieren Sie diese Konfiguration in die Datei C:\hosts.pmc
(Datei → Konfiguration exportieren ...). Führen Sie dann etwas wie das Folgende in einem Startskript aus:
procmon /LoadConfig C:\hosts.pmc /BackingFile C:\hosts_%DATE:/=-%.pml /Quiet > C:\hosts.log 2>&1
Dadurch wird Process Monitor mit der exportierten Konfiguration gestartet ( /LoadConfig C:\hosts.pmc
), die Überwachung ohne Bestätigung der Filtereinstellungen gestartet ( /Quiet
) und die aufgezeichneten Ereignisse in einer Protokolldatei mit dem aktuellen Datum protokolliert ( /BackingFile C:\hosts_%DATE:/=-%.pml
). Der Ausdruck %DATE:/=-%
erzeugt das aktuelle Datum, wobei Schrägstriche /
durch Bindestriche ersetzt werden -
. Wenn Ihr Datumsformat nicht dem entspricht, MM/DD/YYYY
müssen Sie diesen Ausdruck entsprechend ändern.
Startskripte können auf verschiedene Weise konfiguriert werden ( Run
Schlüssel in der Registrierung, geplante Aufgaben, Gruppenrichtlinien, ...). Siehe die Antworten aufdiese Frageauf StackOverflow für eine Übersicht.
Antwort2
Adam Collett/adjman666 hat hierfür ein VB-Skript geschrieben und es in den Sysinternals-Foren gepostet.. Damit dies funktioniert, müssen für die Freigabe \server\procmon die Freigabe- und Dateiberechtigungen so festgelegt sein, dass „Domänencomputer“ von diesem Speicherort lesen können. Andernfalls gibt das Skript die Fehlermeldung „Zugriff verweigert“ aus.
'Script to enable boot logging in Process Monitor at every shutdown to ensure we capture all activity, every time.
'Declare the objects used in the script
Dim objFSO, objShell, objRegistry
'Declare the variables used in the script
Dim strProcmon20KeyPath, strInstancesKeyPath, strPMIKeyPath, strStartValueName, strGroupValueName, strTypeValueName, strImagePathValueName
Dim strDefInstanceValueName, strAltitudeValueName, strFlagsValueName, strComputer
'Declare the constants used in the script
Const HKEY_LOCAL_MACHINE = &H80000002
'Create our FileSystem, Shell and Registry objects
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objShell=WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
'Set all variables ready for use
strProcmon20KeyPath = "SYSTEM\CurrentControlSet\Services\PROCMON20\"
strInstancesKeyPath = "SYSTEM\CurrentControlSet\Services\PROCMON20\Instances\"
strPMIKeyPath = "SYSTEM\CurrentControlSet\Services\PROCMON20\Instances\Process Monitor Instance\"
strStartValueName = "Start"
strGroupValueName = "Group"
strTypeValueName = "Type"
strImagePathValueName = "ImagePath"
strDefInstanceValueName = "DefaultInstance"
strAltitudeValueName = "Altitude"
strFlagsValueName = "Flags"
'Check for the Process Monitor Executable, copy it in if not already on the system.
If not objFSO.FileExists("C:\Windows\System32\procmon.exe") Then
objFSO.CopyFile "\\server\procmon\procmon.exe", "C:\Windows\System32\", true
End If
'Now import the registry settings, one at a time
objShell.RegWrite "HKEY_LOCAL_MACHINE\" & strProcmon20KeyPath & strStartValueName, "0", "REG_DWORD"
objShell.RegWrite "HKEY_LOCAL_MACHINE\" & strProcmon20KeyPath & strGroupValueName, "FSFilter Activity Monitor", "REG_SZ"
objShell.RegWrite "HKEY_LOCAL_MACHINE\" & strProcmon20KeyPath & strTypeValueName, "1", "REG_DWORD"
objShell.RegWrite "HKEY_LOCAL_MACHINE\" & strProcmon20KeyPath & strImagePathValueName, "System32\Drivers\PROCMON20.SYS", "REG_EXPAND_SZ"
objShell.RegWrite "HKEY_LOCAL_MACHINE\" & strInstancesKeyPath & strDefInstanceValueName, "Process Monitor Instance", "REG_SZ"
objShell.RegWrite "HKEY_LOCAL_MACHINE\" & strPMIKeyPath & strAltitudeValueName, "385200", "REG_SZ"
objShell.RegWrite "HKEY_LOCAL_MACHINE\" & strPMIKeyPath & strFlagsValueName, "0", "REG_DWORD"
'Now copy over the PROCMON20.SYS file to the C:\Windows\System32\Drivers folder
If not objFSO.FileExists("C:\Windows\System32\Drivers\PROCMON20.SYS") Then
objFSO.CopyFile "\\server\procmon\PROCMON20.SYS", "C:\Windows\System32\Drivers\", true
End If
'End of Script