Untitled
unknown
plain_text
a year ago
1.1 kB
11
Indexable
$BaselinePath = "C:\Baseline" $BaselineFilePath = Join-Path -Path $BaselinePath -ChildPath "ConfigurationBaseline.txt" if (-not (Test-Path -Path $BaselinePath)) { New-Item -ItemType Directory -Path $BaselinePath | Out-Null } $FileList = @( "C:\Windows\ntoskrnl.exe", "C:\Windows\explorer.exe", "C:\Windows\win.ini", "C:\Windows\System32\kernel32.dll", "C:\Windows\System32\services.exe", "C:\Windows\System32\svchost.exe" ) $BaselineData = @{} foreach ($FilePath in $FileList) { if (Test-Path -Path $FilePath -PathType Leaf) { $FileInfo = Get-Item -Path $FilePath $FileProperties = @{ "Name" = $FileInfo.Name "Path" = $FileInfo.FullName "Size" = $FileInfo.Length "LastWriteTime" = $FileInfo.LastWriteTime } $BaselineData[$FilePath] = $FileProperties } } $BaselineData | ConvertTo-Json | Out-File -FilePath $BaselineFilePath Write-Host "Configuration baseline file created successfully. Baseline file saved at: $BaselineFilePath"
Editor is loading...
Leave a Comment