1

I 'm trying to get Certificates from a external device using windows-Service . how should a handle limitations for current user?

I have an .exe file that get certificates from an extra device(Token) and it work correctly . but when it called from my windows service using WCF , it doesn't show me all certificates . Does it make a limitation for user or app?

static void LaunchCommandLineApp()
    {
        var path = AppDomain.CurrentDomain.BaseDirectory + 
        @"GetCertificate.exe";
        log.Info("LaunchCommandLineApp basePath is : " + 
        AppDomain.CurrentDomain.BaseDirectory);
        log.Info("LaunchCommandLineApp path is : " + path);
        ApplicationLoader.PROCESS_INFORMATION prcInf = new 
        ApplicationLoader.PROCESS_INFORMATION();
        ApplicationLoader.StartProcessAndBypassUAC(path + " -Verb runAs", 
        out prcInf);
        log.Info("After StartProcessAndBypassUAC");
    }
AmirNorouzpour
  • 1,119
  • 1
  • 11
  • 26
ElhamSouri
  • 35
  • 6
  • The Windows service will most probably run on another user account, usually LocalSystem or LocalService. – Klaus Gütter Feb 02 '19 at 10:11
  • It is LocalSystem right now , and i tried LocalService . but it didn't work . – ElhamSouri Feb 02 '19 at 11:06
  • You wrote something about "current user" in your first sentence - this would then be the LocalService user, yes? – Klaus Gütter Feb 02 '19 at 12:36
  • Yes, it is . And i noticed that the file was not executed by the current user of the system . Windows service creates a user to install, which is not the real user of the system – ElhamSouri Feb 03 '19 at 07:30
  • There might be no, one or many (on terminal server) interactive sessions at any time. So what is the "real user"? – Klaus Gütter Feb 03 '19 at 08:44

1 Answers1

0

I think your problem is Windows Service User Account that cause your exe run as that user not current user. read more about Windows Service user accounts.

And for Run a process from a windows service as the current user.

AmirNorouzpour
  • 1,119
  • 1
  • 11
  • 26