New-UDUpload permission limitation, always uploads content to C:\windows\systemtemp

Product: PowerShell Universal
Version: 2026.1.3

I’m having an issue working on a file upload script to process a file.

Currently using gMSA account to run this script inside of an App.

I’ve tried every which way to make this happen and the only way its possible is to give modify permission for C:\Windows\SystemTemp to my gMSA account running the application (which i don’t wish to do).

My current test code which works if my gmsa has modify permission on systemtemp, but doesn’t if you remove it:

$IncomingRoot = “C:\PSU\Temp”

New-UDUpload -Text “Upload Test” -OnUpload {

Show-UDToast $Body.Data -Duration 10000

$bytes = [System.Convert]::FromBase64String($Body.Data)

[System.IO.File]::WriteAllBytes(“$IncomingRoot\$($Body.Name)”, $bytes)

}

I believe this to be a limitation of the upload function but I could be wrong, please enlighten me!

I logged into my gMSA through psexec and found that the temp variables are set to the users local appdata folders, so not sure why its defaulting to the systemtemp folder.

Havent had this issue myself, but just looking at your code example, are you sure this isnt just a scoping issue?

If you move $IncomingRoot definition inside the -OnUpload script block, does the same issue happen?

ultimately i had to give my gMSA read access to systemtemp and it works fine now.

So the file is writing to C:\PSU\Temp and not to C:\Windows\SystemTemp - but you still require permissions to the latter?
Interesting if thats the case, I dont have that on mine, only run as a batch rights, and the edit rights on the $Repository folder.

Yep, the upload command temporarily makes a file in the latter, then copies its content to the final destination in my case.