I came across an interesting and slightly perplexing error today when trying to open a ConfigMgr Logfile.
I had a remote desktop connection open to a server running a distribution point role, I was opening ConfigMgr logfiles repeatedly with CMTrace without any issues. When suddenly I received the following error:
Failed to create temporary file.
The reason for the error was due to the fact that as part of my troubleshooting of the Distribution Point role I had flushed the Temp directories, CMTrace uses the %Temp% directory to save the temporary file.
Flushing the Temp directories shouldn’t have caused the error, except in a remote desktop session the %Temp% environment variable actually resolves to a subfolder of the user profiles normal Temp directory.
On a normal user profile %Temp% resolves to something like:
On a remote desktop session %Temp% resolves to something like:
(The number varies between sessions)
To resolve the error you can do one of the following: