Skip to content

Commit dfb0189

Browse files
committed
Enhance auditpol workflow to include OS-specific output files and improve registry settings export
1 parent 9f8399f commit dfb0189

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

.github/workflows/check-auditpol.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ jobs:
1313
- name: Run auditpol command
1414
shell: pwsh
1515
run: |
16-
auditpol /get /category:* | Out-File -FilePath AuditpolOutput.txt -Encoding utf8
17-
# 確認用にログを表示
18-
Get-Content AuditpolOutput.txt | Write-Host
16+
$os = '${{ matrix.os }}'
17+
$auditFile = "AuditpolOutput-$os.txt"
18+
auditpol /get /category:* | Out-File -FilePath $auditFile -Encoding utf8
19+
Get-Content $auditFile | Write-Host
1920
2021
- name: Run registry check script
2122
shell: pwsh
2223
run: |
23-
# レジストリ設定の定義
24+
$os = '${{ matrix.os }}'
25+
$regFile = "RegistrySettings-$os.csv"
26+
2427
$registrySettings = @(
2528
@{Path = "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ModuleLogging"; Name = "EnableModuleLogging"; Category = "PowerShell"},
2629
@{Path = "HKLM:\SOFTWARE\WOW6432Node\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging"; Name = "EnableScriptBlockLogging"; Category = "PowerShell"},
@@ -58,15 +61,19 @@ jobs:
5861
}
5962
}
6063
61-
# CSV出力
62-
$results | Export-Csv -Path "RegistrySettings.csv" -NoTypeInformation -Encoding UTF8
63-
64-
# コンソールにも表示
64+
$results | Export-Csv -Path $regFile -NoTypeInformation -Encoding UTF8
6565
$results | Format-Table -AutoSize
6666
67+
- name: Upload auditpol artifact
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: auditpol-${{ matrix.os }}-${{ github.run_number }}
71+
path: AuditpolOutput-${{ matrix.os }}.txt
72+
retention-days: 10
73+
6774
- name: Upload CSV artifact
6875
uses: actions/upload-artifact@v4
6976
with:
70-
name: registry-settings-${{ github.run_number }}
71-
path: RegistrySettings.csv
77+
name: registry-settings-${{ matrix.os }}-${{ github.run_number }}
78+
path: RegistrySettings-${{ matrix.os }}.csv
7279
retention-days: 10

0 commit comments

Comments
 (0)