djust270 / Intune-Scripts

53 stars 15 forks source link

Winget-InstallPackage.ps1 log path #5

Closed gbica-hzo closed 1 year ago

gbica-hzo commented 1 year ago

I am not certain where the function function Write-Log($message) #Log script messages to temp directory

or specifically this line Out-File -InputObject $LogMessage -FilePath "$Env:Temp\$Log" -Append -Encoding utf8

outputs the log files. I suspect it puts them in C:\WINDOWS\system32\config\systemprofile\AppData\Local\Temp

if the process is running under the SYSTEM account per https://octopus.com/blog/temp-different-values-for-windows-service

gbica-hzo commented 1 year ago

PS: C:\WINDOWS\system32\config\ is locked by Windows on Win11 and probably Win10, not something that we can pull logs from easily.

gbica-hzo commented 1 year ago

Seems like the path is C:\Windows\Temp