Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromirk committed May 18, 2022
1 parent 48e5e41 commit a8fa66a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Tools/DownloadLatestCUs.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#region download MSCatalog module
Write-Output "Checking if MSCatalog PS Module is Installed"
if (!(Get-InstalledModule -Name MSCatalog -ErrorAction Ignore).version -ne ((Find-Module mscatalog).version)){
Write-Output "Checking if latest MSCatalog PS Module is Installed"
if ((Get-InstalledModule -Name MSCatalog -ErrorAction Ignore).version -ne ((Find-Module mscatalog).version)){
# Verify Running as Admin
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
If (!( $isAdmin )) {
Expand All @@ -25,13 +25,15 @@ if ($version.Minor -eq 27){
#patch
$ContentNew=$Content.Replace($Regex1,$Regex2)
if (Compare-Object $ContentNew $Content){
Write-Output "Current version of MSCatalog needs to be patched"
# Verify Running as Admin
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
If (!( $isAdmin )) {
Write-Host "-- Restarting as Administrator to install Modules" -ForegroundColor Cyan ; Start-Sleep -Seconds 1
Write-Host "-- Restarting as Administrator to patch MSCatalog module" -ForegroundColor Cyan ; Start-Sleep -Seconds 1
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
exit
}
Write-Output "Writing new Get-UpdateLinks.ps1 content"
$ContentNew | Out-File "C:\Program Files\WindowsPowerShell\Modules\MSCatalog\$version\Private\Get-UpdateLinks.ps1"
}
}
Expand Down

0 comments on commit a8fa66a

Please sign in to comment.