'Unable to get WindowsUpdateLog in Windows 2016

While trying to run Get-WindowsUpdateLog I get the error below. I come across a blog to copy SymSrv.dll file over to the server. This doesn't make sense as I had to troubleshoot across so many servers. Isn't there another way to read Windows Update Log in Windows 2016 ?

Copy-Item : Cannot find path 'C:\Program Files\Windows Defender\SymSrv.dll' because it does not exist.



Solution 1:[1]

You can also get the file locally from WinSxS folder (search within).

This worked for us, but the output in the WindowsUpdate.log file was garbage.

Solution 2:[2]

I faced similar problem when was launching Get-WindowsUpdateLog from 32-bit application, and 32-bit powershell was used by default. This link helped me. Was fixed by making sure we run 64-bit version of powershell. From my 32-bit utility, I apply full path to powershell: C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe (use "sysnative" instead of "System32" to target real System32 folder), and it works OK.

As one can see in C:\Windows\system32\WindowsPowerShell\v1.0\Modules\WindowsUpdate\WindowsUpdateLog.psm1, there is a code:

$SYMSRV_DLL_PATH = "$env:ProgramFiles\Windows Defender\SymSrv.dll" 
..
Copy-Item -Path $SYMSRV_DLL_PATH -Destination $WORKDIR -Force -ErrorAction Stop.

Thus, SymSrv.dll is copied from Program Files folder to temporary folder. But, for 32-bit process, $env:ProgramFiles targets not to Program Files but to Program Files (x86) folder (that does not contain SymSrv.dll). This is why we must run 64-bit version of powershell.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 neildeadman
Solution 2 paff