我正在编写一个PowerShell构建脚本,该脚本在具有管理员权限的构建服务器(GitLab Runner)上运行。我无法控制这个脚本是如何启动的。从这个脚本我需要启动一个.exe文件。
C:\Windows\system32\config\systemprofile\AppData\ 而不是 C:\Users\User\AppData\ 这会导致意想不到的行为。
C:\Windows\system32\config\systemprofile\AppData\
C:\Users\User\AppData\
有没有办法从系统服务启动的脚本中以普通windows用户的身份启动exe?
在脚本中,我检查用户如下:
[System.Security.Principal.WindowsIdentity]::GetCurrent().Name NT AUTHORITY\SYSTEM