Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions RunAsLoggedOnUserContext.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,9 @@ function Start-ProcessAsUserWithScript {

# Main script execution
try {
$currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$isSystem = $currentUser -eq "NT AUTHORITY\SYSTEM"
$isSystem = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value -eq 'S-1-5-18'
if (-not $isSystem) {
throw "Script is not running as SYSTEM. This script is designed to run in the SYSTEM context."
throw "Script is not running as SYSTEM. This script is designed to run in the SYSTEM context. "
}

# Create the embedded script using the custom script content
Expand Down
Loading