diff --git a/Public/Functions/MicrosoftCatalog.ps1 b/Public/Functions/MicrosoftCatalog.ps1 index 18dd23971..475f62099 100644 --- a/Public/Functions/MicrosoftCatalog.ps1 +++ b/Public/Functions/MicrosoftCatalog.ps1 @@ -4,45 +4,19 @@ function Get-MsUpCat { Query catalog.update.micrsosoft.com for available updates. .DESCRIPTION - Given that there is currently no public API available for the catalog.update.micrsosoft.com site, this - command makes HTTP requests to the site and parses the returned HTML for the required data. + This function uses MSCatalogLTS module to search for updates from Microsoft Update Catalog. .PARAMETER Search Specify a string to search for. - .PARAMETER SortBy - Specify a field to sort the results by. The default sort is by LastUpdated and in descending order. - - .PARAMETER Descending - Switch the sort order to descending. - - .PARAMETER Strict - Force a Search paramater with multiple words to be treated as a single string. - - .PARAMETER IncludeFileNames - Include the filenames for the files as they would be downloaded from catalog.update.micrsosoft.com. - This option will cause an extra web request for each update included in the results. It is best to only - use this option with a very narrow search term. - - .PARAMETER AllPages - By default the Get-MSCatalogUpdate command returns the first page of results from catalog.update.micrsosoft.com, which is - limited to 25 updates. If you specify this switch the command will instead return all pages of search results. - This can result in a significant increase in the number of HTTP requests to the catalog.update.micrsosoft.com endpoint. - - .EXAMPLE - Get-MSCatalogUpdate -Search "Cumulative for Windows Server, version 1903" - - .EXAMPLE - Get-MSCatalogUpdate -Search "Cumulative for Windows Server, version 1903" -SortBy "Title" -Descending - - .EXAMPLE - Get-MSCatalogUpdate -Search "Cumulative for Windows Server, version 1903" -Strict + .PARAMETER Architecture + Specify the architecture to filter results. .EXAMPLE - Get-MSCatalogUpdate -Search "Cumulative for Windows Server, version 1903" -IncludeFileNames + Get-MsUpCat -Search "Cumulative for Windows Server, version 1903" .EXAMPLE - Get-MSCatalogUpdate -Search "Cumulative for Windows Server, version 1903" -AllPages + Get-MsUpCat -Search "Cumulative for Windows Server, version 1903" -Architecture x64 #> [CmdLetBinding()] @@ -51,118 +25,27 @@ function Get-MsUpCat { [string] $Search, [Parameter(Mandatory = $false)] - [ValidateSet("Title", "Products", "Classification", "LastUpdated", "Size")] - [string] $SortBy, - - [Parameter(Mandatory = $false)] - [System.Management.Automation.SwitchParameter] $Descending, - - [Parameter(Mandatory = $false)] - [System.Management.Automation.SwitchParameter] $Strict, - - [Parameter(Mandatory = $false)] - [System.Management.Automation.SwitchParameter] $IncludeFileNames, - - [Parameter(Mandatory = $false)] - [System.Management.Automation.SwitchParameter] $AllPages + [ValidateSet("all", "x64", "x86", "arm64")] + [string] $Architecture = "all" ) try { - $ProgPref = $ProgressPreference - $ProgressPreference = "SilentlyContinue" - - $Uri = "https://www.catalog.update.microsoft.com/Search.aspx?q=$Search" - $Res = Invoke-CatalogRequest -Uri $Uri - - if ($PSBoundParameters.ContainsKey("SortBy")) { - $SortParams = @{ - Uri = $Uri - SortBy = $SortBy - Descending = $Descending - EventArgument = $Res.EventArgument - EventValidation = $Res.EventValidation - ViewState = $Res.ViewState - ViewStateGenerator = $Res.ViewStateGenerator - } - $Res = Sort-CatalogResults @SortParams - } else { - # Default sort is by LastUpdated and in descending order. - $SortParams = @{ - Uri = $Uri - SortBy = "LastUpdated" - Descending = $true - EventArgument = $Res.EventArgument - EventValidation = $Res.EventValidation - ViewState = $Res.ViewState - ViewStateGenerator = $Res.ViewStateGenerator - } - $Res = Sort-CatalogResults @SortParams - } - - $Rows = $Res.Rows - - if ($Strict -and -not $AllPages) { - $StrictRows = $Rows.Where({ - $_.SelectNodes("td")[1].innerText.Trim() -like "*$Search*" - }) - # If $NextPage is $null then there are more pages to collect. It is arse backwards but trust me. - while (($StrictRows.Count -lt 25) -and ($Res.NextPage -eq "")) { - $NextParams = @{ - Uri = $Uri - EventArgument = $Res.EventArgument - EventTarget = 'ctl00$catalogBody$nextPageLinkText' - EventValidation = $Res.EventValidation - ViewState = $Res.ViewState - ViewStateGenerator = $Res.ViewStateGenerator - Method = "Post" - } - $Res = Invoke-CatalogRequest @NextParams - $StrictRows += $Res.Rows.Where({ - $_.SelectNodes("td")[1].innerText.Trim() -like "*$Search*" - }) - } - $Rows = $StrictRows[0..24] - } elseif ($AllPages) { - # If $NextPage is $null then there are more pages to collect. It is arse backwards but trust me. - while ($Res.NextPage -eq "") { - $NextParams = @{ - Uri = $Uri - EventArgument = $Res.EventArgument - EventTarget = 'ctl00$catalogBody$nextPageLinkText' - EventValidation = $Res.EventValidation - ViewState = $Res.ViewState - ViewStateGenerator = $Res.ViewStateGenerator - Method = "Post" - } - $Res = Invoke-CatalogRequest @NextParams - $Rows += $Res.Rows - } - if ($Strict) { - $Rows = $Rows.Where({ - $_.SelectNodes("td")[1].innerText.Trim() -like "*$Search*" - }) - } + # Install and import MSCatalogLTS if not available + if (!(Get-Module -ListAvailable -Name MSCatalogLTS)) { + Install-Module MSCatalogLTS -Force -SkipPublisherCheck } - if ($Rows.Count -gt 0) { - foreach ($Row in $Rows) { - if ($Row.Id -ne "headerRow") { - [MsUpCat]::new($Row, $IncludeFileNames) - } - } + if (Get-Module -ListAvailable -Name MSCatalogLTS -ErrorAction Ignore) { + Import-Module MSCatalogLTS -Force + Get-MSCatalogUpdate -Search $Search -Architecture $Architecture } else { - Write-Warning "No updates found matching the search term." + Write-Warning "Could not install required PowerShell Module MSCatalogLTS" } - $ProgressPreference = $ProgPref } catch { - $ProgressPreference = $ProgPref - if ($_.Exception.Message -like "We did not find*") { - #Write-Warning $_.Exception.Message - } else { - throw $_ - } + throw $_ } } + function Get-MsUpCatUpdate { [CmdLetBinding()] param ( @@ -174,7 +57,7 @@ function Get-MsUpCatUpdate { [Alias('Architecture')] [string]$Arch = 'x64', - [ValidateSet('22H2','21H2','21H1','20H2',2004,1909,1903,1809,1803,1709,1703,1607,1511,1507)] + [ValidateSet('24H2','23H2','22H2','21H2','21H1','20H2',2004,1909,1903,1809,1803,1709,1703,1607,1511,1507)] [string]$Build = '22H2', [ValidateSet('LCU','SSU','DotNetCU')] @@ -185,20 +68,19 @@ function Get-MsUpCatUpdate { [System.Management.Automation.SwitchParameter]$ListAvailable ) #================================================= - # MSCatalog PowerShell Module - # Ryan-Jan - # https://github.com/ryan-jan/MSCatalog + # MSCatalogLTS PowerShell Module # This excellent work is a good way to gather information from MS # Catalog #================================================= - if (!(Get-Module -ListAvailable -Name MSCatalog)) { - Install-Module MSCatalog -Force -SkipPublisherCheck + if (!(Get-Module -ListAvailable -Name MSCatalogLTS)) { + Install-Module MSCatalogLTS -Force -SkipPublisherCheck } #================================================= # Make sure the Module was installed first #================================================= if (Test-MicrosoftUpdateCatalog) { - if (Get-Module -ListAvailable -Name MSCatalog -ErrorAction Ignore) { + if (Get-Module -ListAvailable -Name MSCatalogLTS -ErrorAction Ignore) { + Import-Module MSCatalogLTS -Force #================================================= # Details #================================================= @@ -235,7 +117,7 @@ function Get-MsUpCatUpdate { #================================================= # Go #================================================= - $CatalogUpdate = Get-MSCatalogUpdate -Search $SearchString -SortBy "Title" -AllPages -Descending |` + $CatalogUpdate = Get-MSCatalogUpdate -Search $SearchString -Architecture $Arch |` Sort-Object LastUpdated -Descending |` Select-Object LastUpdated,Classification,Title,Size,Products,Guid #================================================= @@ -293,7 +175,7 @@ function Get-MsUpCatUpdate { #================================================= } else { - Write-Warning "Save-MsUpCatUpdate: Could not install required PowerShell Module MSCatalog" + Write-Warning "Save-MsUpCatUpdate: Could not install required PowerShell Module MSCatalogLTS" } } else { @@ -301,6 +183,7 @@ function Get-MsUpCatUpdate { } #================================================= } + function Invoke-MSCatalogParseDate { param ( [String] $DateString @@ -309,8 +192,9 @@ function Invoke-MSCatalogParseDate { $Array = $DateString.Split("/") Get-Date -Year $Array[2] -Month $Array[0] -Day $Array[1] } + function Save-MsUpCatDriver { - [CmdletBinding(DefaultParameterSetName = 'ByPNPClass')] + [CmdLetBinding(DefaultParameterSetName = 'ByPNPClass')] param ( [System.String]$DestinationDirectory, @@ -336,306 +220,470 @@ function Save-MsUpCatDriver { $MSUpCatDriversOSDCloudUSBPath = "$($OSDCloudUSB.DriveLetter):\OSDCloud\MsUpCatDrivers" } #================================================= - # MSCatalog PowerShell Module - # Ryan-Jan - # https://github.com/ryan-jan/MSCatalog + # MSCatalogLTS PowerShell Module # This excellent work is a good way to gather information from MS # Catalog #================================================= -<# if (!(Get-Module -ListAvailable -Name MSCatalog)) { - Install-Module MSCatalog -Force -SkipPublisherCheck -ErrorAction Ignore - } #> + if (!(Get-Module -ListAvailable -Name MSCatalogLTS)) { + Install-Module MSCatalogLTS -Force -SkipPublisherCheck -ErrorAction Ignore + } #================================================= #$HardwareIDPattern = 'VEN_([0-9a-f]){4}&DEV_([0-9a-f]){4}&SUBSYS_([0-9a-f]){8}' $HardwareIDPattern = 'v[ei][dn]_([0-9a-f]){4}&[pd][ie][dv]_([0-9a-f]){4}' $SurfaceIDPattern = 'mshw0[0-1]([0-9]){2}' if (Test-MicrosoftUpdateCatalog) { - #================================================= - # ByPNPClass - #================================================= - if ($PSCmdlet.ParameterSetName -eq 'ByPNPClass') { - $Params = @{ - ClassName = 'Win32_PnpEntity' - Property = 'Name','Description','DeviceID','HardwareID','ClassGuid','Manufacturer','PNPClass' - } - $Devices = Get-CimInstance @Params - - if ($Devices) { - if ($PNPClass -match 'Display') { - $Devices = $Devices | Where-Object {($_.Name -match 'Video') -or ($_.PNPClass -match 'Display')} - } - elseif ($PNPClass -match 'Net') { - $Devices = $Devices | Where-Object {($_.Name -match 'Network') -or ($_.PNPClass -match 'Net')} - } - elseif ($PNPClass) { - $Devices = $Devices | Where-Object {$_.PNPClass -match $PNPClass} - } - else { - #All Devices + if (Get-Module -ListAvailable -Name MSCatalogLTS -ErrorAction Ignore) { + Import-Module MSCatalogLTS -Force + #================================================= + # ByPNPClass + #================================================= + if ($PSCmdlet.ParameterSetName -eq 'ByPNPClass') { + $Params = @{ + ClassName = 'Win32_PnpEntity' + Property = 'Name','Description','DeviceID','HardwareID','ClassGuid','Manufacturer','PNPClass' } - } + $Devices = Get-CimInstance @Params - if ($Devices) { - if ($PNPClass) { - Write-Verbose "Devices were found for PNPClass $PNPClass" + if ($Devices) { + if ($PNPClass -match 'Display') { + $Devices = $Devices | Where-Object {($_.Name -match 'Video') -or ($_.PNPClass -match 'Display')} + } + elseif ($PNPClass -match 'Net') { + $Devices = $Devices | Where-Object {($_.Name -match 'Network') -or ($_.PNPClass -match 'Net')} + } + elseif ($PNPClass) { + $Devices = $Devices | Where-Object {$_.PNPClass -match $PNPClass} + } + else { + #All Devices + } } - - foreach ($Item in $Devices) { - $FindHardwareID = $null - - #See if DeviceID matches the pattern - # Write-Host -ForegroundColor DarkGray "DeviceID: $($Item.DeviceID)" - $FindHardwareID = $Item.DeviceID | Select-String -Pattern $HardwareIDPattern -AllMatches | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Value - if (-not ($FindHardwareID)) { - if ($Item.HardwareID) { - Write-Verbose "HardwareID: $($Item.HardwareID[0])" - $FindHardwareID = $Item.HardwareID[0] | Select-String -Pattern $HardwareIDPattern -AllMatches | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Value - } + if ($Devices) { + if ($PNPClass) { + Write-Verbose "Devices were found for PNPClass $PNPClass" } - - if ($FindHardwareID) { - # Write-Verbose "Searching: $FindHardwareID" - $SearchString = "$FindHardwareID".Replace('&',"`%26") - try { - $WindowsUpdateDriver = Get-MsUpCat -Search "22H2+$PNPClass+$SearchString" -Descending | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore - - if (-not ($WindowsUpdateDriver)) { - $WindowsUpdateDriver = Get-MsUpCat -Search "21H2+$PNPClass+$SearchString" -Descending | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore - } - if (-not ($WindowsUpdateDriver)) { - $WindowsUpdateDriver = Get-MsUpCat -Search "Vibranium+$PNPClass+$SearchString" -Descending | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore - } - if (-not ($WindowsUpdateDriver)) { - $WindowsUpdateDriver = Get-MsUpCat -Search "1903+$PNPClass+$SearchString" -Descending | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore - } - if (-not ($WindowsUpdateDriver)) { - $WindowsUpdateDriver = Get-MsUpCat -Search "1809+$PNPClass+$SearchString" -Descending | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore - } - if (-not ($WindowsUpdateDriver)) { - $WindowsUpdateDriver = Get-MsUpCat -Search "$SearchString" -Descending | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore - } + + foreach ($Item in $Devices) { + $FindHardwareID = $null - if ($WindowsUpdateDriver.Guid) { - if ($Item.Name -and $Item.PNPClass) { - Write-Host -ForegroundColor Cyan "$($Item.PNPClass) $($Item.Name)" + #See if DeviceID matches the pattern + # Write-Host -ForegroundColor DarkGray "DeviceID: $($Item.DeviceID)" + $FindHardwareID = $Item.DeviceID | Select-String -Pattern $HardwareIDPattern -AllMatches | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Value + + if (-not ($FindHardwareID)) { + if ($Item.HardwareID) { + Write-Verbose "HardwareID: $($Item.HardwareID[0])" + $FindHardwareID = $Item.HardwareID[0] | Select-String -Pattern $HardwareIDPattern -AllMatches | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Value + } + } + + if ($FindHardwareID) { + # Write-Verbose "Searching: $FindHardwareID" + $SearchString = "$FindHardwareID".Replace('&',"`%26") + try { + # Try multiple Windows versions for driver search + $WindowsUpdateDriver = $null + + # Try Windows 11 24H2 first + $WindowsUpdateDriver = Get-MSCatalogUpdate -Search "24H2+$PNPClass+$SearchString" -Architecture x64 | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore + + if (-not ($WindowsUpdateDriver)) { + $WindowsUpdateDriver = Get-MSCatalogUpdate -Search "23H2+$PNPClass+$SearchString" -Architecture x64 | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore } - elseif ($Item.Name) { - Write-Host -ForegroundColor Cyan "$($Item.Name)" + if (-not ($WindowsUpdateDriver)) { + $WindowsUpdateDriver = Get-MSCatalogUpdate -Search "22H2+$PNPClass+$SearchString" -Architecture x64 | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore } - else { - Write-Host -ForegroundColor Cyan $Item.DeviceID + if (-not ($WindowsUpdateDriver)) { + $WindowsUpdateDriver = Get-MSCatalogUpdate -Search "21H2+$PNPClass+$SearchString" -Architecture x64 | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore + } + if (-not ($WindowsUpdateDriver)) { + $WindowsUpdateDriver = Get-MSCatalogUpdate -Search "Vibranium+$PNPClass+$SearchString" -Architecture x64 | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore + } + if (-not ($WindowsUpdateDriver)) { + $WindowsUpdateDriver = Get-MSCatalogUpdate -Search "1903+$PNPClass+$SearchString" -Architecture x64 | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore + } + if (-not ($WindowsUpdateDriver)) { + $WindowsUpdateDriver = Get-MSCatalogUpdate -Search "1809+$PNPClass+$SearchString" -Architecture x64 | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore + } + if (-not ($WindowsUpdateDriver)) { + $WindowsUpdateDriver = Get-MSCatalogUpdate -Search "$SearchString" -Architecture x64 | Select-Object LastUpdated,Title,Version,Size,Guid -First 1 -ErrorAction Ignore } - Write-Host -ForegroundColor DarkGray "HardwareID: $FindHardwareID" - Write-Host -ForegroundColor DarkGray "SearchString: $SearchString" - - Write-Host -ForegroundColor DarkGray "$($WindowsUpdateDriver.Title) version $($WindowsUpdateDriver.Version)" - Write-Host -ForegroundColor DarkGray "Version $($WindowsUpdateDriver.Version) Size: $($WindowsUpdateDriver.Size)" - Write-Host -ForegroundColor DarkGray "Last Updated $($WindowsUpdateDriver.LastUpdated)" - Write-Host -ForegroundColor DarkGray "UpdateID: $($WindowsUpdateDriver.Guid)" - if ($DestinationDirectory) { - $DestinationPath = Join-Path $DestinationDirectory $WindowsUpdateDriver.Guid - #If OSDCloud USB Attached, Check for Driver in Cache and Copy ro Local Cache - if ($OSDCloudUSB){ - $USBCachePath = Join-Path $MSUpCatDriversOSDCloudUSBPath $WindowsUpdateDriver.Guid - if (Test-Path $USBCachePath){ - Write-Host -ForegroundColor DarkGray "Driver already expanded at $USBCachePath, copying to $DestinationPath" - Copy-Item -Path $USBCachePath -Destination $DestinationPath -Recurse -Force - } + if ($WindowsUpdateDriver.Guid) { + if ($Item.Name -and $Item.PNPClass) { + Write-Host -ForegroundColor Cyan "$($Item.PNPClass) $($Item.Name)" } - #Check if Driver is already Local Cache - if (Test-Path $DestinationPath) { - Write-Host -ForegroundColor DarkGray "Driver already expanded at $DestinationPath" + elseif ($Item.Name) { + Write-Host -ForegroundColor Cyan "$($Item.Name)" } - #Download if not already found in Local Cache else { - Write-Host -ForegroundColor DarkGray "Downloading and expanding to $DestinationPath" - $WindowsUpdateDriverFile = Save-UpdateCatalog -Guid $WindowsUpdateDriver.Guid -DestinationDirectory $DestinationPath - if ($WindowsUpdateDriverFile) { - expand.exe "$($WindowsUpdateDriverFile.FullName)" -F:* "$DestinationPath" | Out-Null - Remove-Item $WindowsUpdateDriverFile.FullName | Out-Null + Write-Host -ForegroundColor Cyan $Item.DeviceID + } + Write-Host -ForegroundColor DarkGray "HardwareID: $FindHardwareID" + Write-Host -ForegroundColor DarkGray "SearchString: $SearchString" + + Write-Host -ForegroundColor DarkGray "$($WindowsUpdateDriver.Title) version $($WindowsUpdateDriver.Version)" + Write-Host -ForegroundColor DarkGray "Version $($WindowsUpdateDriver.Version) Size: $($WindowsUpdateDriver.Size)" + Write-Host -ForegroundColor DarkGray "Last Updated $($WindowsUpdateDriver.LastUpdated)" + Write-Host -ForegroundColor DarkGray "UpdateID: $($WindowsUpdateDriver.Guid)" + + if ($DestinationDirectory) { + $DestinationPath = Join-Path $DestinationDirectory $WindowsUpdateDriver.Guid + #If OSDCloud USB Attached, Check for Driver in Cache and Copy ro Local Cache + if ($OSDCloudUSB){ + $USBCachePath = Join-Path $MSUpCatDriversOSDCloudUSBPath $WindowsUpdateDriver.Guid + if (Test-Path $USBCachePath){ + Write-Host -ForegroundColor DarkGray "Driver already expanded at $USBCachePath, copying to $DestinationPath" + Copy-Item -Path $USBCachePath -Destination $DestinationPath -Recurse -Force + } + } + #Check if Driver is already Local Cache + if (Test-Path $DestinationPath) { + Write-Host -ForegroundColor DarkGray "Driver already expanded at $DestinationPath" } + #Download if not already found in Local Cache else { - Write-Warning "Save-MsUpCatDriver: Could not find a Driver for this HardwareID" + Write-Host -ForegroundColor DarkGray "Downloading and expanding to $DestinationPath" + try { + # ������� ��������� ����� ��� ���������� + $TempDownloadPath = Join-Path $env:TEMP "MSCatalogDownload" + if (!(Test-Path $TempDownloadPath)) { + New-Item -Path $TempDownloadPath -ItemType Directory -Force | Out-Null + } + + # ��������� ���� + $WindowsUpdateDriverFile = Save-MSCatalogUpdate -Guid $WindowsUpdateDriver.Guid -Destination $TempDownloadPath + Write-Verbose "Download result: $WindowsUpdateDriverFile" + + if ($WindowsUpdateDriverFile -and $WindowsUpdateDriverFile -ne "") { + # ��������� ��������� ���������� + if ($WindowsUpdateDriverFile -and $WindowsUpdateDriverFile -ne "") { + Write-Verbose "Download successful, file: $WindowsUpdateDriverFile" + + # ���������, ��� ���� ���������� + if (Test-Path $WindowsUpdateDriverFile) { + Write-Verbose "File exists, expanding to $DestinationPath" + expand.exe "$WindowsUpdateDriverFile" -F:* "$DestinationPath" | Out-Null + Remove-Item $WindowsUpdateDriverFile -Force + Write-Host -ForegroundColor Green "Driver successfully downloaded and expanded to $DestinationPath" + } + else { + Write-Warning "Downloaded file not found at: $WindowsUpdateDriverFile" + } + } + else { + Write-Warning "Save-MSCatalogUpdate returned empty result" + + # �������������� ������ - ���� ���� � ��������� ����� + Write-Verbose "Trying alternative method - searching for MSU file in $TempDownloadPath" + $MsuFile = Get-ChildItem -Path $TempDownloadPath -Filter "*.msu" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1 + + if ($MsuFile) { + Write-Verbose "Found MSU file: $($MsuFile.FullName)" + expand.exe "$($MsuFile.FullName)" -F:* "$DestinationPath" | Out-Null + Remove-Item $MsuFile.FullName -Force + Write-Host -ForegroundColor Green "Driver successfully downloaded and expanded to $DestinationPath (alternative method)" + } + else { + Write-Warning "Save-MsUpCatDriver: Could not download driver file using any method" + } + } + } + else { + Write-Warning "Save-MsUpCatDriver: Could not download driver file" + } + } + catch { + Write-Warning "Save-MsUpCatDriver: Error downloading driver - $($_.Exception.Message)" + Write-Verbose "Exception details: $($_.Exception.ToString())" + } } } } + else { + Write-Host -ForegroundColor Gray "No Results: $($Item.Name) $FindHardwareID" + } } - else { - Write-Host -ForegroundColor Gray "No Results: $($Item.Name) $FindHardwareID" - #Write-Host -ForegroundColor DarkGray "HardwareID: $FindHardwareID" - #Write-Host -ForegroundColor DarkGray "SearchString: $SearchString" - #Write-Warning "Save-MsUpCatDriver: Could not find a Windows Update GUID" - } + catch{ + Write-Host -ForegroundColor Gray "Unable to get Driver for Hardware component" + } + } + else { + Write-Verbose "DeviceID: $($Item.DeviceID)" } - catch{ - Write-Host -ForegroundColor Gray "Unable to get Driver for Hardware component" - } - } - else { - Write-Verbose "DeviceID: $($Item.DeviceID)" - #Write-Host -ForegroundColor Gray "No Results: $FindHardwareID" } } } - } - #================================================= - # ByHardwareID - #================================================= - if ($PSCmdlet.ParameterSetName -eq 'ByHardwareID') { - foreach ($Item in $HardwareID) { - Write-Verbose "Save-MsUpCatDriver: ByHardwareID" - Write-Verbose $Item - - $WindowsUpdateDriver = $null + #================================================= + # ByHardwareID + #================================================= + if ($PSCmdlet.ParameterSetName -eq 'ByHardwareID') { + foreach ($Item in $HardwareID) { + Write-Verbose "Save-MsUpCatDriver: ByHardwareID" + Write-Verbose $Item - #See if DeviceID matches the pattern - $FindHardwareID = $Item | Select-String -Pattern $HardwareIDPattern | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Value + $WindowsUpdateDriver = $null - if (-not ($FindHardwareID)) { - $FindHardwareID = $Item | Select-String -Pattern $SurfaceIDPattern | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Value - } - - if ($FindHardwareID) { - $SearchString = "$FindHardwareID".Replace('&', "`%26") + #See if DeviceID matches the pattern + $FindHardwareID = $Item | Select-String -Pattern $HardwareIDPattern | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Value - try { - Write-Verbose "Save-MsUpCatDriver Search: 23H2 $SearchString" - $WindowsUpdateDriver = Get-MsUpCat -Search "23H2+$SearchString" -Descending | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 -ErrorAction Ignore - } - catch { - <#Do this if a terminating exception happens#> - } - if (-not ($WindowsUpdateDriver)) { - try { - Write-Verbose "Save-MsUpCatDriver Search: 22H2 $SearchString" - $WindowsUpdateDriver = Get-MsUpCat -Search "22H2+$SearchString" -Descending | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 -ErrorAction Ignore - } - catch { - <#Do this if a terminating exception happens#> - } + if (-not ($FindHardwareID)) { + $FindHardwareID = $Item | Select-String -Pattern $SurfaceIDPattern | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Value } - if (-not ($WindowsUpdateDriver)) { + + if ($FindHardwareID) { + $SearchString = "$FindHardwareID".Replace('&', "`%26") + try { - Write-Verbose "Save-MsUpCatDriver Search: 21H2+$SearchString" - $WindowsUpdateDriver = Get-MsUpCat -Search "21H2+$SearchString" -Descending | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 -ErrorAction Ignore + # Try multiple Windows versions for driver search + Write-Verbose "Save-MsUpCatDriver Search: 24H2 $SearchString" + $SearchResults = Get-MSCatalogUpdate -Search "24H2 $SearchString" -ErrorAction Ignore + Write-Verbose "Search Results Count: $($SearchResults.Count)" + if ($SearchResults -and $SearchResults.Count -gt 0) { + $WindowsUpdateDriver = $SearchResults | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 + Write-Verbose "Found driver: $($WindowsUpdateDriver.Title)" + } } catch { - <#Do this if a terminating exception happens#> + Write-Verbose "Error searching for 24H2: $($_.Exception.Message)" } - } - if (-not ($WindowsUpdateDriver)) { - try { - Write-Verbose "Save-MsUpCatDriver Search: Vibranium+$SearchString" - $WindowsUpdateDriver = Get-MsUpCat -Search "Vibranium+$SearchString" -Descending | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 -ErrorAction Ignore + + if (-not ($WindowsUpdateDriver)) { + try { + Write-Verbose "Save-MsUpCatDriver Search: 23H2 $SearchString" + $SearchResults = Get-MSCatalogUpdate -Search "23H2 $SearchString" -ErrorAction Ignore + Write-Verbose "Search Results Count: $($SearchResults.Count)" + if ($SearchResults -and $SearchResults.Count -gt 0) { + $WindowsUpdateDriver = $SearchResults | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 + Write-Verbose "Found driver: $($WindowsUpdateDriver.Title)" + } + } + catch { + Write-Verbose "Error searching for 23H2: $($_.Exception.Message)" + } } - catch { - <#Do this if a terminating exception happens#> + + if (-not ($WindowsUpdateDriver)) { + try { + Write-Verbose "Save-MsUpCatDriver Search: 22H2 $SearchString" + $SearchResults = Get-MSCatalogUpdate -Search "22H2 $SearchString" -ErrorAction Ignore + Write-Verbose "Search Results Count: $($SearchResults.Count)" + if ($SearchResults -and $SearchResults.Count -gt 0) { + $WindowsUpdateDriver = $SearchResults | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 + Write-Verbose "Found driver: $($WindowsUpdateDriver.Title)" + } + } + catch { + Write-Verbose "Error searching for 22H2: $($_.Exception.Message)" + } } - } - if (-not ($WindowsUpdateDriver)) { - try { - Write-Verbose "Save-MsUpCatDriver Search: 1903+$SearchString" - $WindowsUpdateDriver = Get-MsUpCat -Search "1903+$SearchString" -Descending | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 -ErrorAction Ignore + + if (-not ($WindowsUpdateDriver)) { + try { + Write-Verbose "Save-MsUpCatDriver Search: 21H2 $SearchString" + $SearchResults = Get-MSCatalogUpdate -Search "21H2 $SearchString" -ErrorAction Ignore + Write-Verbose "Search Results Count: $($SearchResults.Count)" + if ($SearchResults -and $SearchResults.Count -gt 0) { + $WindowsUpdateDriver = $SearchResults | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 + Write-Verbose "Found driver: $($WindowsUpdateDriver.Title)" + } + } + catch { + Write-Verbose "Error searching for 21H2: $($_.Exception.Message)" + } } - catch { - <#Do this if a terminating exception happens#> + + if (-not ($WindowsUpdateDriver)) { + try { + Write-Verbose "Save-MsUpCatDriver Search: Vibranium $SearchString" + $SearchResults = Get-MSCatalogUpdate -Search "Vibranium $SearchString" -ErrorAction Ignore + Write-Verbose "Search Results Count: $($SearchResults.Count)" + if ($SearchResults -and $SearchResults.Count -gt 0) { + $WindowsUpdateDriver = $SearchResults | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 + Write-Verbose "Found driver: $($WindowsUpdateDriver.Title)" + } + } + catch { + Write-Verbose "Error searching for Vibranium: $($_.Exception.Message)" + } } - } - if (-not ($WindowsUpdateDriver)) { - try { - Write-Verbose "Save-MsUpCatDriver Search: 1809+$SearchString" - $WindowsUpdateDriver = Get-MsUpCat -Search "1809+$SearchString" -Descending | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 -ErrorAction Ignore + + if (-not ($WindowsUpdateDriver)) { + try { + Write-Verbose "Save-MsUpCatDriver Search: 1903 $SearchString" + $SearchResults = Get-MSCatalogUpdate -Search "1903 $SearchString" -ErrorAction Ignore + Write-Verbose "Search Results Count: $($SearchResults.Count)" + if ($SearchResults -and $SearchResults.Count -gt 0) { + $WindowsUpdateDriver = $SearchResults | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 + Write-Verbose "Found driver: $($WindowsUpdateDriver.Title)" + } + } + catch { + Write-Verbose "Error searching for 1903: $($_.Exception.Message)" + } } - catch { - <#Do this if a terminating exception happens#> + + if (-not ($WindowsUpdateDriver)) { + try { + Write-Verbose "Save-MsUpCatDriver Search: 1809 $SearchString" + $SearchResults = Get-MSCatalogUpdate -Search "1809 $SearchString" -ErrorAction Ignore + Write-Verbose "Search Results Count: $($SearchResults.Count)" + if ($SearchResults -and $SearchResults.Count -gt 0) { + $WindowsUpdateDriver = $SearchResults | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 + Write-Verbose "Found driver: $($WindowsUpdateDriver.Title)" + } + } + catch { + Write-Verbose "Error searching for 1809: $($_.Exception.Message)" + } } - } - - if ($WindowsUpdateDriver.Guid) { - Write-Host -ForegroundColor Cyan "$Item $($WindowsUpdateDriver.Title)" - Write-Host -ForegroundColor DarkGray "UpdateID: $($WindowsUpdateDriver.Guid)" - Write-Host -ForegroundColor DarkGray "Size: $($WindowsUpdateDriver.Size) Last Updated $($WindowsUpdateDriver.LastUpdated)" - - #Write-Host -ForegroundColor DarkGray "HardwareID: $FindHardwareID" - #Write-Host -ForegroundColor DarkGray "SearchString: $SearchString" - - #Write-Host -ForegroundColor DarkGray "$($WindowsUpdateDriver.Title) version $($WindowsUpdateDriver.Version)" - #Write-Host -ForegroundColor DarkGray "Version $($WindowsUpdateDriver.Version) Size: $($WindowsUpdateDriver.Size)" - #Write-Host -ForegroundColor DarkGray "Last Updated $($WindowsUpdateDriver.LastUpdated)" - - if ($DestinationDirectory) { - $DestinationPath = Join-Path $DestinationDirectory $WindowsUpdateDriver.Guid - #If OSDCloud USB Attached, Check for Driver in Cache and Copy ro Local Cache - if ($OSDCloudUSB){ - $USBCachePath = Join-Path $MSUpCatDriversOSDCloudUSBPath $WindowsUpdateDriver.Guid - if (Test-Path $USBCachePath){ - Write-Host -ForegroundColor DarkGray "Driver already expanded at $USBCachePath, copying to $DestinationPath" - Copy-Item -Path $USBCachePath -Destination $DestinationPath -Recurse -Force + + if (-not ($WindowsUpdateDriver)) { + try { + Write-Verbose "Save-MsUpCatDriver Search: $SearchString" + $SearchResults = Get-MSCatalogUpdate -Search "$SearchString" -ErrorAction Ignore + Write-Verbose "Search Results Count: $($SearchResults.Count)" + if ($SearchResults -and $SearchResults.Count -gt 0) { + $WindowsUpdateDriver = $SearchResults | Select-Object LastUpdated, Title, Version, Size, Guid -First 1 + Write-Verbose "Found driver: $($WindowsUpdateDriver.Title)" } } - if (Test-Path $DestinationPath) { - Write-Host -ForegroundColor DarkGray "Driver already expanded at $DestinationPath" + catch { + Write-Verbose "Error searching for generic: $($_.Exception.Message)" } - else { - Write-Host -ForegroundColor DarkGray "Downloading and expanding to $DestinationPath" - $WindowsUpdateDriverFile = Save-UpdateCatalog -Guid $WindowsUpdateDriver.Guid -DestinationDirectory $DestinationPath - if ($WindowsUpdateDriverFile) { - expand.exe "$($WindowsUpdateDriverFile.FullName)" -F:* "$DestinationPath" | Out-Null - Remove-Item $WindowsUpdateDriverFile.FullName | Out-Null + } + + if ($WindowsUpdateDriver -and $WindowsUpdateDriver.Guid) { + Write-Host -ForegroundColor Cyan "$Item $($WindowsUpdateDriver.Title)" + Write-Host -ForegroundColor DarkGray "UpdateID: $($WindowsUpdateDriver.Guid)" + Write-Host -ForegroundColor DarkGray "Size: $($WindowsUpdateDriver.Size) Last Updated $($WindowsUpdateDriver.LastUpdated)" + + if ($DestinationDirectory) { + $DestinationPath = Join-Path $DestinationDirectory $WindowsUpdateDriver.Guid + #If OSDCloud USB Attached, Check for Driver in Cache and Copy ro Local Cache + if ($OSDCloudUSB){ + $USBCachePath = Join-Path $MSUpCatDriversOSDCloudUSBPath $WindowsUpdateDriver.Guid + if (Test-Path $USBCachePath){ + Write-Host -ForegroundColor DarkGray "Driver already expanded at $USBCachePath, copying to $DestinationPath" + Copy-Item -Path $USBCachePath -Destination $DestinationPath -Recurse -Force + } + } + if (Test-Path $DestinationPath) { + Write-Host -ForegroundColor DarkGray "Driver already expanded at $DestinationPath" } else { - Write-Warning "Save-MsUpCatDriver: Could not find a Driver for this HardwareID" + Write-Host -ForegroundColor DarkGray "Downloading and expanding to $DestinationPath" + try { + # ������� ����� ���������� + if (!(Test-Path $DestinationPath)) { + New-Item -Path $DestinationPath -ItemType Directory -Force | Out-Null + } + + # ������� ��������� ����� ��� ���������� + $TempDownloadPath = Join-Path $env:TEMP "MSCatalogDownload" + if (!(Test-Path $TempDownloadPath)) { + New-Item -Path $TempDownloadPath -ItemType Directory -Force | Out-Null + } + + # ��������� ���� � ��������� ����� ���������� + Write-Verbose "Attempting to download GUID: $($WindowsUpdateDriver.Guid) to $TempDownloadPath" + $null = Save-MSCatalogUpdate -Guid $WindowsUpdateDriver.Guid -Destination $TempDownloadPath + Write-Verbose "Download completed" + + # ���� ��������� ���� � ��������� ����� + Write-Verbose "Searching for downloaded MSU file in $TempDownloadPath" + $MsuFile = Get-ChildItem -Path $TempDownloadPath -Filter "*.msu" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1 + + if ($MsuFile) { + Write-Verbose "Found MSU file: $($MsuFile.FullName)" + + # ���������, ��� ���� ���������� + if (Test-Path $MsuFile.FullName) { + Write-Verbose "File exists, expanding to $DestinationPath" + expand.exe "$($MsuFile.FullName)" -F:* "$DestinationPath" | Out-Null + Remove-Item $MsuFile.FullName -Force + Write-Host -ForegroundColor Green "Driver successfully downloaded and expanded to $DestinationPath" + } + else { + Write-Warning "Downloaded file not found at: $($MsuFile.FullName)" + } + } + else { + Write-Warning "Save-MsUpCatDriver: Could not find downloaded MSU file in $TempDownloadPath" + + # �������������� ������ - ���� � ����� TEMP + Write-Verbose "Trying alternative method - searching for MSU file in $env:TEMP" + $MsuFile = Get-ChildItem -Path $env:TEMP -Filter "*.msu" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1 + + if ($MsuFile) { + Write-Verbose "Found MSU file in TEMP: $($MsuFile.FullName)" + expand.exe "$($MsuFile.FullName)" -F:* "$DestinationPath" | Out-Null + Remove-Item $MsuFile.FullName -Force + Write-Host -ForegroundColor Green "Driver successfully downloaded and expanded to $DestinationPath (alternative method)" + } + else { + Write-Warning "Save-MsUpCatDriver: Could not download driver file using any method" + } + } + } + catch { + Write-Warning "Save-MsUpCatDriver: Error downloading driver - $($_.Exception.Message)" + Write-Verbose "Exception details: $($_.Exception.ToString())" + } } } } + else { + Write-Host -ForegroundColor Gray "No Results: $FindHardwareID" + } } else { Write-Host -ForegroundColor Gray "No Results: $FindHardwareID" } } - else { - Write-Host -ForegroundColor Gray "No Results: $FindHardwareID" - } } - } - #================================================= - # Sync Back to OSDCloudUSB - #================================================= - if ($Global:OSDCloud.SyncMSUpCatDriverUSB -eq $true){ - if ($OSDCloudUSB){ - #Get Size of Cached Drivers in Local Drive Cache - if (Test-Path $DestinationDirectory){ - $MsUpCatDriverCacheSizeGB = (Get-ChildItem $DestinationDirectory -Recurse | Measure-Object -Property Length -Sum).Sum /1GB - #Get Free Space on OSDCloud USB Drive (with buffer) - $OSDCloudUSBFree = ($OSDCloudUSB.SizeRemainingGB - 5) #Free Space with 5GB Buffer - #If enough Free Space, cache files on Flash Drive - if ($MsUpCatDriverCacheSizeGB -lt $OSDCloudUSBFree){ - $Source = $DestinationDirectory #Yes this can seem confusing, remember Destination is where the Drivers were downloaded orginially - $Destination = $MSUpCatDriversOSDCloudUSBPath #OSDCloud Flash Drive cache folder - - Write-Host -ForegroundColor Cyan "Syncing MS Update Catalog Drivers to OSDCloud USB Cache" - Write-Host -ForegroundColor Gray "Transfering $([Math]::Round($MsUpCatDriverCacheSizeGB,2)) GB of MS Update Drivers to $Destination" - Invoke-Exe robocopy $Source $Destination *.* /s /ndl /nfl /njh /njs - } - else { - Write-Host -ForegroundColor Gray "Not enough Free Space on OSDCloudUSB to sync drivers" - Write-Host -ForegroundColor Gray "Requires $([Math]::Round(($MsUpCatDriverCacheSizeGB + 5),2)) GB, but only $($OSDCloudUSB.SizeRemainingGB) GB available" + #================================================= + # Sync Back to OSDCloudUSB + #================================================= + if ($Global:OSDCloud.SyncMSUpCatDriverUSB -eq $true){ + if ($OSDCloudUSB){ + #Get Size of Cached Drivers in Local Drive Cache + if (Test-Path $DestinationDirectory){ + $MsUpCatDriverCacheSizeGB = (Get-ChildItem $DestinationDirectory -Recurse | Measure-Object -Property Length -Sum).Sum /1GB + #Get Free Space on OSDCloud USB Drive (with buffer) + $OSDCloudUSBFree = ($OSDCloudUSB.SizeRemainingGB - 5) #Free Space with 5GB Buffer + #If enough Free Space, cache files on Flash Drive + if ($MsUpCatDriverCacheSizeGB -lt $OSDCloudUSBFree){ + $Source = $DestinationDirectory #Yes this can seem confusing, remember Destination is where the Drivers were downloaded orginially + $Destination = $MSUpCatDriversOSDCloudUSBPath #OSDCloud Flash Drive cache folder + + Write-Host -ForegroundColor Cyan "Syncing MS Update Catalog Drivers to OSDCloud USB Cache" + Write-Host -ForegroundColor Gray "Transfering $([Math]::Round($MsUpCatDriverCacheSizeGB,2)) GB of MS Update Drivers to $Destination" + Invoke-Exe robocopy $Source $Destination *.* /s /ndl /nfl /njh /njs + } + else { + Write-Host -ForegroundColor Gray "Not enough Free Space on OSDCloudUSB to sync drivers" + Write-Host -ForegroundColor Gray "Requires $([Math]::Round(($MsUpCatDriverCacheSizeGB + 5),2)) GB, but only $($OSDCloudUSB.SizeRemainingGB) GB available" + } } } + else { + Write-Host -ForegroundColor Gray "OSDCloudUSB not detected to sync drivers back to, skipping sync" + } } - else { - Write-Host -ForegroundColor Gray "OSDCloudUSB not detected to sync drivers back to, skipping sync" - } + } + else { + Write-Warning "Save-MsUpCatDriver: Could not install required PowerShell Module MSCatalogLTS" } } } + function Save-MsUpCatUpdate { [CmdLetBinding()] param ( - [ValidateSet('Windows 10','Windows Server','Windows Server 2016','Windows Server 2019')] + [ValidateSet('Windows 11','Windows 10','Windows Server','Windows Server 2016','Windows Server 2019')] [Alias('OperatingSystem')] [string]$OS = 'Windows 11', @@ -643,7 +691,7 @@ function Save-MsUpCatUpdate { [Alias('Architecture')] [string]$Arch = 'x64', - [ValidateSet('22H2','21H2','21H1','20H2',2004,1909,1903,1809,1803,1709,1703,1607,1511,1507)] + [ValidateSet('24H2','23H2','22H2','21H2','21H1','20H2',2004,1909,1903,1809,1803,1709,1703,1607,1511,1507)] [string]$Build = '22H2', [ValidateSet('LCU','SSU','DotNetCU')] @@ -657,20 +705,19 @@ function Save-MsUpCatUpdate { [System.Management.Automation.SwitchParameter]$Latest ) #================================================= - # MSCatalog PowerShell Module - # Ryan-Jan - # https://github.com/ryan-jan/MSCatalog + # MSCatalogLTS PowerShell Module # This excellent work is a good way to gather information from MS # Catalog #================================================= - if (!(Get-Module -ListAvailable -Name MSCatalog)) { - Install-Module MSCatalog -Force -SkipPublisherCheck + if (!(Get-Module -ListAvailable -Name MSCatalogLTS)) { + Install-Module MSCatalogLTS -Force -SkipPublisherCheck } #================================================= # Make sure the Module was installed first #================================================= if (Test-MicrosoftUpdateCatalog) { - if (Get-Module -ListAvailable -Name MSCatalog -ErrorAction Ignore) { + if (Get-Module -ListAvailable -Name MSCatalogLTS -ErrorAction Ignore) { + Import-Module MSCatalogLTS -Force #================================================= # Details #================================================= @@ -703,7 +750,7 @@ function Save-MsUpCatUpdate { #================================================= # Go #================================================= - $CatalogUpdate = Get-MSCatalogUpdate -Search $SearchString -SortBy "Title" -AllPages -Descending |` + $CatalogUpdate = Get-MSCatalogUpdate -Search $SearchString -Architecture $Arch |` Sort-Object LastUpdated -Descending |` Select-Object LastUpdated,Classification,Title,Size,Products,Guid #================================================= @@ -763,12 +810,12 @@ function Save-MsUpCatUpdate { # Download #================================================= foreach ($Update in $CatalogUpdate) { - Save-UpdateCatalog -Guid $Update.Guid -DestinationDirectory $DestinationDirectory + Save-MSCatalogUpdate -Guid $Update.Guid -Destination $DestinationDirectory } #================================================= } else { - Write-Warning "Save-MsUpCatUpdate: Could not install required PowerShell Module MSCatalog" + Write-Warning "Save-MsUpCatUpdate: Could not install required PowerShell Module MSCatalogLTS" } } else { diff --git a/Public/OSDCloudTS/Initialize-OSDCloudStartnet.ps1 b/Public/OSDCloudTS/Initialize-OSDCloudStartnet.ps1 index 90f96619b..452403acf 100644 --- a/Public/OSDCloudTS/Initialize-OSDCloudStartnet.ps1 +++ b/Public/OSDCloudTS/Initialize-OSDCloudStartnet.ps1 @@ -142,6 +142,7 @@ function Initialize-OSDCloudStartnet { } } + <# # Check if the OSD Module in the PowerShell Gallery is newer than the installed version $TimeSpan = New-TimeSpan -Start $Global:StartnetStart -End (Get-Date) Write-Host -ForegroundColor DarkGray "$($TimeSpan.ToString("mm':'ss")) Updating OSD PowerShell Module" @@ -157,5 +158,6 @@ function Initialize-OSDCloudStartnet { Import-Module $PSModuleName -Force } } + #> } }