Run command as System User in Powershell Run command as System User in Powershell powershell powershell

Run command as System User in Powershell


https://github.com/mkellerman/Invoke-CommandAs

Made a function to Invoke-Command against local/remote computer using provided credentials or SYSTEM. Returns PSObjects, handles network interruptions and resolves any Double-Hop issues.

Try it out let me know if this resolves your issues.


If you're ok installing a (very useful) 3rd party program, you can try the following. It's a portable .zip, no real installation.

Run as administrator:

C:\WINDOWS\system32>nircmd.exe elevatecmd runassystem c:\windows\System32\cmd.exe

starts a new cmd window:

Microsoft Windows [Version 10.0.18362.418](c) 2019 Microsoft Corporation. All rights reserved.C:\WINDOWS\system32>whoamint authority\systemC:\WINDOWS\system32>

https://www.nirsoft.net/utils/nircmd.html


Domain Admins get access via the local Administrators group. Local Administrators can take ownership of any local object and subsequently grant new permissions to that object.

Running something like this as an administrator should do what you want:

takeown /f C:\some\file_or_folder /a /r /d:yicacls C:\some\file_or_folder /reset /t /c /q

Never use the SYSTEM account for things like this.