On some versions of Windows Server, you might see this error when trying to access office file. And from here, the solution is extremely easy (and weird).
- Create directory "C:\Windows\SysWOW64\config\systemprofile\Desktop " (for 64 bit Windows) or "C:\Windows\System32\config\systemprofile\Desktop " (for 32 bit Windows)
# for 64 bit Windows
New-item -ItemType Directory -Force -Path "C:\Windows\SysWOW64\config\systemprofile\Desktop"
# for 32 bit Windows
New-item -ItemType Directory -Force -Path "C:\Windows\System32\config\systemprofile\Desktop"
- Set Full control permissions for directory Desktop (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user
"IIS AppPool\DefaultAppPool")