Terminate Install Under SYSTEM Account

Got a problem you cannot solve? Try here.
Sheri_Steeves
Posts: 124
Joined: Mon Oct 22, 2012 2:14 pm

Terminate Install Under SYSTEM Account

Postby Sheri_Steeves » Fri Oct 21, 2016 8:22 am

Hello,

Is there any method from inside InstallAware that I can test if my install is running under the SYSTEM account? I need to terminate one of my installs when run in this environment.

I know about the Get System Setting Logged on User Name - the problem is that the SYSTEM name is locale specific. On an English O/S it is SYSTEM, and on a French system it is SYSTÈME. Is there a way to ask "Are you SYSTEM"? Or get the Well-Known SID (S-1-5-18)?

Right now my only approach is to write a C# console exe that queries that information for me using System.Security.Principal.WindowsIdentity.GetCurrent().IsSystem and to include that in my Support files and call it from inside IA.

Is there is a simpler way to do this from inside IA?

Thanks,

Sheri

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Terminate Install Under SYSTEM Account

Postby FrancescoT » Fri Oct 21, 2016 12:14 pm

Dear Sheri,

I suppose that you are already using the best solution :D

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Sheri_Steeves
Posts: 124
Joined: Mon Oct 22, 2012 2:14 pm

Re: Terminate Install Under SYSTEM Account

Postby Sheri_Steeves » Fri Oct 28, 2016 9:40 am

Francesco,

Thanks for confirming; I just wanted to make sure I wasn't missing anything obvious.

For reference for any other users who may need to do the same thing, I created a C# console app to test this using the following mainline code:

Code: Select all

static int Main(string[] args)
{
    int result = 0;
    using (var identity = System.Security.Principal.WindowsIdentity.GetCurrent())
    {
        if (identity.IsSystem)
        {
            result = 1;
        }
   }
   Console.Write(result.ToString());   
   return result;
}


Sheri

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Terminate Install Under SYSTEM Account

Postby FrancescoT » Mon Oct 31, 2016 12:25 pm

Thanks for sharing :D !

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 79 guests