How to check if installation is running in user or system context

Hello,

I have packaged an application with the App Deployment Toolkit.

I install the application with the command:

Start-Process -FilePath $setupx64 -ArgumentList “/silent /install” -verb runas

That works. But only if the installation is running in the user context and not in the system context. If the installation runs in the system context (via SCCM) I need this command without the parameter -verb runas => otherwise it does not work

Start-Process -FilePath $setupx64 -ArgumentList “/silent /install”

How can I check in Deploy-Application.ps1 if the installation is started in the user context or in the system context?

Thank you!!

BR

Do not use -verb runas with SCCM. It’s already elevated.

If you must, however, create spaghetti code that might work, here you go:

If ($ProcessNTAccount -eq 'NT AUTHORITY\SYSTEM') {
	Write-log "Running as SYSTEM"
}

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.