locked
how to launch CMD.exe with administrator in a service on vista RRS feed

  • Question

  • Dear all:
       I have a service run on vista (session 0), Currently, I want these service will launch CMD.exe and I want to run it as administrator because I want to use CMD.exe to run some process and show UI, I have used CreateProcessAsUser with explore.exe's token, however, I think on vista, explore.exe has user's token, It will not have the administrator priveledge, So, in this case, What should I do? Can CreateProcessWithLogon solve this problem? Thanks

     

    Wednesday, December 10, 2008 8:10 AM

All replies

  • So, what's your plan when multiple users are logged in simultaneously on different desktops, or when the desktop shell isn't explorer?
    Wednesday, December 10, 2008 8:57 AM
  • hm, Maybe I have something wrong, Currently, I have met a strange problem, I have a service a.exe and an application b.exe, currently, I use a.exe CreateProcessAsUser() to call CMD.exe to run b.exe, It will return CMD.exe initialize fail, If I create another application c.exe, Then a.exe CreateProcessAsUser() to call c.exe, in c.exe, it call CMD.exe to run b.exe, It's OK, So I am confused about this scenario. Could you please explain about this case?

    Wednesday, December 10, 2008 9:11 AM