Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Get Your Computer Information Using VB.Net

Author: DevASP
Download Source Code : 420_getComputerInformation.zip

How to get the OS version, User login Name, Computer name, Domain name, Logical drives name and many more using VB.net

Create a new VB.Net application and drag 22 labels and a button on it rename the 11 label controls as lblUser , lblRuntime , lblUptime , lblSystemRoot , lblCompName , lblCurrentDirectory , lblUserDomainName , lblWorkingSet , lblCommandLine , lblGetLogicalDrives , lblOsVersion

Now double click on form and write code on form load event:

lblOsVersion.Text = Environment.OSVersion.ToString

lblUser.Text = Environment.UserName.ToString

lblRuntime.Text = Environment.Version.ToString

lblUptime.Text = Mid((Environment.TickCount / 3600000), 1, 5) & " :Hours"

lblSystemRoot.Text = Environment.SystemDirectory.ToString

lblCompName.Text = Environment.MachineName.ToString

lblCurrentDirectory.Text = Environment.CurrentDirectory.ToString

lblUserDomainName.Text = Environment.UserDomainName.ToString

lblWorkingSet.Text = Environment.WorkingSet.ToString

lblCommandLine.Text = Environment.CommandLine.ToString

For i As Integer = 0 To Environment.GetLogicalDrives.Length - 1

lblGetLogicalDrives.Text += Environment.GetLogicalDrives(i)

lblGetLogicalDrives.Text += " "

Next

'''''''''''''''''

Label1.Text = "User Name"

Label2.Text = "Operating System Version"

Label3.Text = "Computer Name"

Label4.Text = "System Root"

Label5.Text = ".Net Run Time"

Label6.Text = "Up Time"

Label7.Text = "Current Directory"

Label8.Text = "User Domain Name"

Label9.Text = "Working Set"

Label10.Text = "Get Command Line for this Project"

Label11.Text = "Get Logical Drives"

  • Now double click on button and write code on button click event

lblOsVersion.Text = Environment.OSVersion.ToString

lblUser.Text = Environment.UserName.ToString

lblRuntime.Text = Environment.Version.ToString

lblUptime.Text = Mid((Environment.TickCount / 3600000), 1, 5) & " :Hours"

lblSystemRoot.Text = Environment.SystemDirectory.ToString

lblCompName.Text = Environment.MachineName.ToString

lblCurrentDirectory.Text = Environment.CurrentDirectory.ToString

lblUserDomainName.Text = Environment.UserDomainName.ToString

lblWorkingSet.Text = Environment.WorkingSet.ToString

lblCommandLine.Text = Environment.CommandLine.ToString

lblGetLogicalDrives.Text = ""

For i As Integer = 0 To Environment.GetLogicalDrives.Length - 1

lblGetLogicalDrives.Text += Environment.GetLogicalDrives(i)

lblGetLogicalDrives.Text += " "

Next

Article Comments
it's a very,very,... good for me.it's really fantastic

Posted on 7/5/2006 6:54:57 AM by muthukumar

Tks.

Good help
Pedro Coutinho

Posted on 1/28/2007 6:23:48 AM by Pedro Coutinho

get the complete information of operating system and version using .Net

Posted on 4/29/2007 2:12:15 AM by nagabhushanam

how do you get the OS installed directory?

Posted on 6/6/2007 2:35:07 PM by azz

great.. nice code.:) tnx.

Posted on 4/15/2008 3:05:21 AM by emme

Thanks for the valuable information.

Posted on 10/2/2008 4:32:04 PM by Manny Lopez

it very usefull knowledges,
thanks

Posted on 10/5/2009 5:36:54 AM by ajeet

Thanks from Germany!

Posted on 1/3/2010 10:56:49 PM by Jürgen

really good work thank you... appreciate it....

Posted on 1/28/2010 8:34:38 AM by radhakrishnan

very nice work its very much helpfull .thank u frm my heart

Posted on 3/19/2010 7:36:25 AM by Prashant

Thanks a Lot...
Really Helpful

Posted on 4/7/2010 10:55:18 AM by Muthukumar

Thanks, it's very nice

Posted on 5/2/2010 11:23:08 PM by Huynhhoc

This tells you about the server.
How would you get the browsing computers information?

Posted on 5/18/2010 12:45:45 PM by RT

Thank you very much!

Posted on 6/15/2010 1:01:25 PM by Tim

Really good!

Posted on 7/12/2010 2:53:07 AM by Neelam Gupta

It is very useful code for getting computer information.

Posted on 7/13/2010 6:54:57 AM by supreet awasthi

Thanks a Lot
its very much help full

Posted on 8/14/2010 2:57:20 PM by sampath

Very useful Help. I got what information (machine name) i wanted immediately on search.

Posted on 8/26/2010 10:00:32 PM by Ramanathan

You know if you want to only view user name but include extra words
you could always use this

Label1.Text = ("Welcome Back") + (Environment.UserName.ToString)

Posted on 11/11/2010 11:09:42 AM by David

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to Use Flash File in VB.Net

Disclaimer - Privacy
© 2002-2017 DevASP.net