File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -5717,7 +5717,8 @@ function ConfigureAuditSettings {
57175717 try {
57185718 $moduleLoggingPath = " HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ModuleLogging\ModuleNames"
57195719 $currentValue = " Not Set"
5720- if (Test-Path $moduleLoggingPath ) {
5720+ $pathExists = Test-Path $moduleLoggingPath
5721+ if ($pathExists ) {
57215722 $prop = Get-ItemProperty - Path $moduleLoggingPath - Name " *" - ErrorAction SilentlyContinue
57225723 if ($prop ) {
57235724 $currentValue = $prop ." *"
@@ -5739,7 +5740,10 @@ function ConfigureAuditSettings {
57395740 }
57405741 if ($response -eq " " -or $response -eq " Y" -or $response -eq " y" )
57415742 {
5742- New-Item - Path $moduleLoggingPath - Force | Out-Null
5743+ if (-not $pathExists )
5744+ {
5745+ New-Item - Path $moduleLoggingPath - Force | Out-Null
5746+ }
57435747 Set-ItemProperty - Path $moduleLoggingPath - Name " *" - Value " *" - Type String
57445748 Write-Host " [OK] Module logging enabled for all modules" - ForegroundColor Green
57455749 }
You can’t perform that action at this time.
0 commit comments