Windows 10 What's is the default permission of the script which is triggered by StartUp?

  • Thread starter Thread starter Corey Chen
  • Start date Start date
C

Corey Chen

Guest
Goal:

Run script when user login, the script should get fio test started.

Issue Symptom:

I have a PowerShell script, which calls fio.exe to run test on drives, and I put it in "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp", but when I try to login as non-admin user (e.g., user01), the script will encounter "permission denied", then I try to run manually, just open a PowerShell console (with user01 account), it can run correctly. I can't understand why.

Here is the sample code of my script:

test.cmd (put in StartUp)

powershell.exe -ExecutionPolicy Bypass -File %SystemDrive%\Windows_oobe\fiotest.ps

fiotest.ps1

Write-Host "Create temp folder"
New-Item -Path "D:\temp" -ItemType Directory
Sleep 10
fio.exe -filename=D: -direct=1 -size=10g -iodepth=32 ...... --output=D:\temp\small_1vm_128k_seqread.txt | Out-Null

Error Message:

fio: pid=0, err=13/file:filesetup.c:165, func=open, error=Permission denied

Troubleshooting:

I added "Get-ExecutionPolicy" in fiotest.ps1, both of them (startup & manual) show "Bypass".

I spent some time to study this issue, found that the script triggered by StartUp will run as "SYSTEM" (correct me if I was wrong), According to docs(System Account in Windows), the SYSTEM account is the highest privilege level in the Windows user model, it has Full Control Permission.

So why does it encounter "permission denied" problem? But general user can run it normally, I have no idea on this issue, any help is appreciated.

ENV:

OS: Windows10-1909
PowerShell: 5.1 (Build:18362 Revision:145)

More...
 
Back
Top