Avatar of ksd123
ksd123
 asked on

How do I get log details (current logon user /machine name) on remote server in window application?

Hi ,

We have a developed a windows application using c# to start/stop/execute a service (windows service written in .Net) on a remote server.

I need to maintain log information for the current logon user who started /stopped/executed the service on the remote server.That means on the remote server we need details(current logon user who invoked the service) in the  event viewer . How can I achieve this?

Basically we have 3 buttons for start,stop,execute functions and below is simplified piece of code and need to maintan user log information(machine name/current logon user)  on remote server Event viewer.

//  start / stop / execute buttons

try

{

servicecontroller sc =new servicecontroller(servicename,machinename)

sc.start();

}

catch(exeception ex)

{

}
.NET ProgrammingC#Windows Server 2003

Avatar of undefined
Last Comment
ksd123

8/22/2022 - Mon
Yagya Shree

ksd123

ASKER
Hi,

I am looking for c# code.
Yagya Shree

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
ksd123

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ksd123

ASKER
Did not get any relevant answer to my question and to my knowledge the above solution will resolve the issue