I like the idea and it actually was there in the early blueprints of the function. However, it seems that the code isn't working as expected - at least for me. I'm getting:
Get-WUFileById : No candidate rows have been found for KB 4475776
At line:1 char:1
+ Get-WUFileById -KB 4475776 -SearchCriteria 'SQL Server 2016'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-WUFileByID
I'm fine with adding something like this to the function, as long as it works and I don't need to support web parsing :D
@bigbearzhu - do you have any additional code/info that can help @nvarscar ?
@nvarscar working for me, give it another try?
PS C:\Dev\dbatools> Get-WUFileByID -KB 4495256 -SearchCriteria 'SQL Server*'
Directory: C:\Dev\dbatools
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 10/06/2019 13:56 748919880 sqlserver2016-kb4495256-x64_f1b206222329d623c55c8fac16851a76b6247df3.exe
Apparently this function errors out when running on PS6.0+ by default:
if($PSVersionTable.PSEdition -eq 'Core')
{
throw 'The script uses Internet Explorer engine and, therefore, requires the Desktop edition of PowerShell'
}
I'm not sure if there are any plans to support Core edition. Can anyone who has an experience with Invoke-WebRequest in 6.0+ check if the script can be ported to 6.0 at all?