1 . 根据要求, 配好一台安全基线服务器, 不同版本,可能存在不同的安全基线要求。 使用LGPO.EXE 导出 adudit.csv;GptTmpl.inf;registry.pol
2. 检查每条policy 是否与 安全基线 (security baseline) 符合
3. 脚本
$User = “ndh\mis”
$PWord = ConvertTo-SecureString -String “!QAZ2wsx” -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord
$serverlist= get-content C:\serverlist.txt
$sesson= New-PSSession -ComputerName $serverlist -Credential $Credential
ForEach ( $sesson in $sesson)
{
Copy-Item -Path “C:\Win_GP” -Destination c:\ -ToSession $sesson -Recurse -Force
Invoke-Command -Session $sesson -ScriptBlock {
if ((Get-WmiObject -Class Win32_OperatingSystem).Caption -like “Microsoft Windows Server 2012*”)
{
Start-Process -FilePath C:\Win_GP\Win_2012\lgpo.exe -ArgumentList "/ac C:\Win_GP\Win_2012\audit.csv" -Verb runas
Start-Process -FilePath C:\Win_GP\Win_2012\lgpo.exe -ArgumentList "/m C:\Win_GP\Win_2012\registry.pol" -Verb runas
Start-Process -FilePath C:\Windows\System32\SecEdit.exe -ArgumentList "/configure /db c:\Windows\security\database\win_2012.sdb /cfg c:\win_gp\Win_2012\GptTmpl.inf"
}
elseif ((Get-WmiObject -Class Win32_OperatingSystem).Caption -like "Microsoft Windows Server 2016*")
{
Start-Process -FilePath C:\Win_GP\Win_2016\lgpo.exe -ArgumentList "/ac C:\Win_GP\Win_2016\audit.csv" -Verb runas
Start-Process -FilePath C:\Win_GP\Win_2016\lgpo.exe -ArgumentList "/m C:\Win_GP\Win_2016\registry.pol" -Verb runas
Start-Process -FilePath C:\Windows\System32\SecEdit.exe -ArgumentList "/configure /db c:\Windows\security\database\win_2016.sdb /cfg C:\Win_GP\Win_2016\GptTmpl.inf"
}
}
}