How to Get the logged in User name in a Windows Service App

J

Jim Covington

I am writing a program that needs certain information from a pc on a
network. I have it written and it is a vb.net service. I need the
logged in user name. The app now returns a user "SYSTEM" because it is
a service. How does one get the logged in user?

Also, I need the IPAddress, THe Service Pack Level of the OS, and other
system information.

Can anyone point me to the appropriate class?


YBraker
 
A

Adrian Forbes [ASP MVP]

How does one get the logged in user?

Not sure on that one.
Also, I need the IPAddress
System.Net.Dns.Resolve(System.Net.Dns.GetHostName).AddressList(0).ToString

THe Service Pack Level of the OS, and other
system information.

Environment.Version.Major
Environment.Version.Minor
Environment.Version.Build
Environment.Version.Revision
Environment.Version.ToString
Environment.OSVersion.Platform
Environment.OSVersion.Version.ToString
Environment.OSVersion.ToString
 
C

Cor

Hi Jim,

Have a look at the system.management class.

(You have to set a reference for that to use it)

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top