$env:USERNAME | Out-file Testit.txt
$env:TEMP | Out-File Testit.txt -Append
Results: - Run as System (NT AUTHORITY\\SYSTEM) = Hostname / C:\\Windows\\TEMP - Run as Network Service (NT AUTHORITY\\NETWORK SERVICE) = Hostname / C:\\Windows\\SERVIC~2\\NETWOR~1\\AppData\\Local\\Temp - Run as Local Service (NT AUTHORITY\\LOCAL SERVICE) = Hostname / C:\\Windows\\SERVIC~2\\LOCALS~1\\AppData\\Local\\Temp
I wasted many days looking for solution of error "Microsoft.ACE.OLEDB.12.0" for linked server "(null)". [SQLSTATE 42000] (Error 7303)" and so on.
Thank you for advices, you gave me great new idea!
On our standalone MSSQL2014 @ Windows 2012R2, for export to Excel file SQL Agent Job needed write privileges for temporary folder of SQL Server (of the same instance). In our case "C:\Users\MSSQL$<instance>\AppData\Local\Temp".
When it has it, OLE DB Jet exporting to Excel file works normally (as ran manually from SSMS :)
Without these privilages the same job generated this stupid error:
"Executed as user: NT SERVICE\SQLAgent$<instance>. Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)". [SQLSTATE 42000] (Error 7303) OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Nieokreślony błąd." <it means: "Unknown error" or similar>. [SQLSTATE 01000] (Error 7412). The step failed.
2 People are following this question.