I am having troubles getting the Windows Update Log on Server 2016. As documented here Server 2016 now logs Windows update logs differently and to view the logs you need to run a Powershell command from the WindowsUpdate module called Get-WindowsUpdateLog.

The script needs to set the Symbol Cache and it does this by running 'Set-Location $SYM_CACHE'. The symbol cache variable is set earlier in the piece by this:

$WORKDIR = "$env:TEMP\WindowsUpdateLog"

The problem I am getting is that my administrative username is 'secur.tima' and the temp variable is set with the 8.3 filename version of this which is 'C:\Users\SECUR~1.TIM\AppData\Local\Temp\4'

When the script tries to set this as the location it fails with this error:

Set-Location : An object at the specified path C:\Users\SECUR~1.TIM does not exist.

    C:\Windows\system32\WindowsPowerShell\v1.0\Modules\WindowsUpdate\WindowsUpdateLog.psm1:194 char:5
    +     Set-Location $SYM_CACHE
    +     ~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Set-Location], PSArgumentException
        + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.SetLocationCommand

I have found this over at StackOverflow: https://stackoverflow.com/questions/10782739/how-to-change-to-temp-directory-in-powershell

However that shows how to fix the problem by changing the script. Whilst I could change the script provided by Microsoft, I am wondering if there is some way I can make this work from the server side or change the way that PowerShell handles 8.3 filenames?



  • Problem I've had before in Windows with the long filename to 8.3 filename conversion was the assumption that the conversion resulted in ~1 as the expansion replacement. Sometimes there's something else preexisting which has already used the ~1 and I get ~2, or even higher, instead. Might not be the problem, but a quick. Easy enough to check using DIR /X in the normal command shell. – user396327 Mar 13 '17 at 2:11
  • This problem only exists in PowerShell. If I run 'cd %TEMP%' from a command window it will change to the location successfully. – Tim Aitken Mar 13 '17 at 2:18
  • Does C:\Users\SECUR~1.TIM exist from within PowerShell, or is it C:\USERS\SECUR~1.TIM? Does PowerShell even understand the 8.3 filenames? – user396327 Mar 13 '17 at 2:29
  • That is interesting; If I run test-path $env:temp the result is true. However if I run Set-location $env:temp the result is: Set-location : An object at the specified path C:\Users\ADMIN~1.TIM does not exist. – Tim Aitken Mar 13 '17 at 2:39
  • Then I'd look at the documentation for Set-Location to see if it is 8.3 conversion aware. – user396327 Mar 13 '17 at 2:41

Get the long version of the 8.3 filename and use it instead. Either:

$WORKDIR = (Get-Item "$env:TEMP\WindowsUpdateLog").FullName


Set-Location (Get-Item $SYM_CACHE).FullName

You can read more about this workaround in my answer on SU.

| improve this answer | |

This technet article seems to indicate that PowerShell doesn't understand 8.3 filenames.

| improve this answer | |
  • 1
    I'm pretty sure that is not what the article is saying, I believe it is telling you how to return the file path in the 8.3 format. I know that PowerShell can "understand" 8.3 file paths because test-path $env:temp or test-path C:\users\SECURE~1.TIM both work. – Tim Aitken Mar 13 '17 at 5:41

Make a batch file that does the CD to the temp directory, and then invoke the powershell script from within the batch file?

cd %temp%\windowsupdatelog
powershell.exe -f c:\dirname\script.ps1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.