Skip to content

"Run as System"-detection is failing in non-english versions of Windows #1

@kaivonderchrom

Description

@kaivonderchrom

Hi,

thank you for your great work it helped me a lot! Only one thing I like to add, if your scripts checking, if it´s runing in SYSTEM context, it´s done via a string-compare to the username in line 153:

if($CurrentUserName -ne 'NT AUTHORITY\SYSTEM')

This is failing in, e.g. the german version, because it´s named "NT AUTORITÄT\SYSTEM". So I changed the check and used the well-known SIDs for it:

$CurrentSID = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
if($CurrentSID -ne 'S-1-5-18')

(SIDs can be found here: https://docs.microsoft.com/de-de/windows/security/identity-protection/access-control/security-identifiers)

Maybe it´s helpful in the New-AovpnDeviceTunnel.ps1 and Remove-AovpnDeviceTunnel.ps1.

Thank you!

Yours

Kai

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions