Skip to content

Commit 378a3e1

Browse files
dpaulson45Copilot
andcommitted
Fix HKU PSDrive creation failing under -WhatIf in EOMT
New-PSDrive supports ShouldProcess, so when EOMT.ps1 is run with -WhatIf the drive creation is skipped and Get-ChildItem HKU: fails. Adding -WhatIf:$false ensures the read-only PSDrive is always created. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 38224a7 commit 378a3e1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Security/src/EOMT/SharedFunctions/Install-IISUrlRewriteModule.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function Install-IISUrlRewriteModule {
6464
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
6565
)
6666

67-
New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS -ErrorAction SilentlyContinue | Out-Null
67+
New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS -WhatIf:$false -ErrorAction SilentlyContinue | Out-Null
6868

6969
$UninstallKeys += Get-ChildItem HKU: | Where-Object { $_.Name -match 'S-\d-\d+-(\d+-){1,14}\d+$' } | ForEach-Object {
7070
"HKU:\$($_.PSChildName)\Software\Microsoft\Windows\CurrentVersion\Uninstall"

0 commit comments

Comments
 (0)