fix(Test-WeakADPasswords): stop marking PSGallery as Trusted on the host
Ensure-NuGetAndPSGallery silently ran Set-PSRepository PSGallery -InstallationPolicy Trusted as a side effect of installing DSInternals, permanently changing the host's module trust policy for every later Install-Module by anyone on that machine. Removed it. The operator has already confirmed the install at this point, and both install calls (Install-Module and Save-Module) pass -Force, which skips the untrusted-repository prompt for that call only.
This commit is contained in:
@@ -237,7 +237,8 @@ function Ensure-NuGetAndPSGallery {
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
} catch { Write-Verbose ("NuGet provider install warning: {0}" -f $_.Exception.Message) }
|
||||
try { Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -ErrorAction Stop } catch { }
|
||||
# PSGallery is deliberately left untrusted: the operator already confirmed this install, and
|
||||
# -Force on Install-Module/Save-Module covers it without changing the host's repository policy.
|
||||
}
|
||||
|
||||
function Ensure-ADModule {
|
||||
|
||||
Reference in New Issue
Block a user