1111 runs-on : ${{ matrix.os }}
1212 steps :
1313 - name : Run auditpol command
14+ shell : pwsh
1415 run : |
15- auditpol /get /category:*
16+ auditpol /get /category:* | Out-File -FilePath AuditpolOutput.txt -Encoding utf8
17+ # 確認用にログを表示
18+ Get-Content AuditpolOutput.txt | Write-Host
19+
20+ - name : Run registry check script
21+ shell : pwsh
22+ run : |
23+ # レジストリ設定の定義
24+ $registrySettings = @(
25+ @{Path = "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ModuleLogging"; Name = "EnableModuleLogging"; Category = "PowerShell"},
26+ @{Path = "HKLM:\SOFTWARE\WOW6432Node\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging"; Name = "EnableScriptBlockLogging"; Category = "PowerShell"},
27+ @{Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit"; Name = "ProcessCreationIncludeCmdLine_Enabled"; Category = "CommandLine"},
28+ @{Path = "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0"; Name = "RestrictSendingNTLMTraffic"; Category = "NTLM"},
29+ @{Path = "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0"; Name = "AuditReceivingNTLMTraffic"; Category = "NTLM"},
30+ @{Path = "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters"; Name = "AuditNTLMInDomain"; Category = "NTLM"}
31+ )
32+
33+ $results = @()
34+
35+ foreach ($setting in $registrySettings) {
36+ $value = "Not Set"
37+ $exists = $false
38+
39+ try {
40+ if (Test-Path $setting.Path) {
41+ $regValue = Get-ItemProperty -Path $setting.Path -Name $setting.Name -ErrorAction SilentlyContinue
42+ if ($regValue) {
43+ $value = $regValue.$($setting.Name)
44+ $exists = $true
45+ }
46+ }
47+ }
48+ catch {
49+ $value = "Error: $_"
50+ }
51+
52+ $results += [PSCustomObject]@{
53+ Category = $setting.Category
54+ Path = $setting.Path
55+ Name = $setting.Name
56+ Value = $value
57+ Exists = $exists
58+ }
59+ }
60+
61+ # CSV出力
62+ $results | Export-Csv -Path "RegistrySettings.csv" -NoTypeInformation -Encoding UTF8
63+
64+ # コンソールにも表示
65+ $results | Format-Table -AutoSize
66+
67+ - name : Upload CSV artifact
68+ uses : actions/upload-artifact@v4
69+ with :
70+ name : registry-settings-${{ github.run_number }}
71+ path : RegistrySettings.csv
72+ retention-days : 10
0 commit comments