System specification code


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: System specification code

  1. #1
    Join Date
    Aug 2006
    Posts
    1

    System specification code

    Before I start, I am in no way a developer, so the questions that I am asking may be simple to some of you, but please bear with me.

    I have been given the following code that will check the specifications of the PC that it is run on and output it to a text file. Thats the easy bit. I wish to know how I would actually run this code on a machine. I do not know what the code is written in, i.e .Net etc. I do know that it doesn't look like VB (but what do I know)! Do I need to have any specific software to run the code and if not, what file type should the code be run as. I have it as a text document at the moment.

    Any help with this would be gratefully appreciated.

    The code:

    Private Sub btnRunDiagnostics_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunDiagnostics.Click

    'If CheckForm() = True Then
    Cursor.Current = Cursors.WaitCursor
    Dim f As New frmStatus
    f.Show()

    f.Status += "> Recording computer specification... " & vbCrLf

    'record this into the log
    Dim strFileContent As String
    If System.IO.File.Exists(GetAppPath() & "\SystemInfo.txt") Then
    Dim objSR As System.IO.StreamReader
    objSR = System.IO.File.OpenText(GetAppPath() & "\SystemInfo.txt")
    strFileContent = objSR.ReadToEnd
    objSR.Close()
    End If

    Dim oSW As System.IO.StreamWriter = System.IO.File.CreateText(GetAppPath() & "\SystemInfo.txt")
    oSW.WriteLine("***********************************************************")
    oSW.WriteLine("VERSION: " & Application.ProductVersion)
    oSW.WriteLine("DATE-TIME: " & System.DateTime.Now())
    oSW.WriteLine("")
    oSW.WriteLine("")
    oSW.WriteLine("COMPUTER H.D SPECIFICATIONS")
    oSW.WriteLine("-----------------------------------------------------------")
    oSW.WriteLine(GetTechSpecification("Win32_LogicalDisk"))
    oSW.WriteLine(GetFreeDiskSpace())
    oSW.WriteLine(GetTechSpecification("Win32_DiskDrive"))
    oSW.WriteLine("")
    oSW.WriteLine("NETWORK INFORMATION")
    oSW.WriteLine("-----------------------------------------------------------")
    oSW.WriteLine(GetTechSpecification("Win32_NetworkAdapterConfiguration"))
    oSW.WriteLine("")
    oSW.WriteLine("GENERAL COMPUTER INFORMATION")
    oSW.WriteLine("-----------------------------------------------------------")
    oSW.WriteLine(GetTechSpecification("Win32_ComputerSystem"))
    oSW.WriteLine("")
    oSW.WriteLine("COMPUTER PROCESSOR SPECIFICATIONS")
    oSW.WriteLine("-----------------------------------------------------------")
    oSW.WriteLine(GetTechSpecification("Win32_Processor"))
    oSW.WriteLine("")
    oSW.WriteLine("COMPUTER OPERATING SYSTEM SPECIFICATIONS")
    oSW.WriteLine("-----------------------------------------------------------")
    oSW.WriteLine(GetTechSpecification("Win32_OperatingSystem"))

    'f.Status += "> Applying proxy settings... " & vbCrLf
    'Call ProxySetup()
    'f.Status += "> Attempting to connect... " & vbCrLf
    'Dim blnOK As Boolean = TestConnection(f) 'status is written in this function

    'oSW.WriteLine("CONNECTION DETAILS")
    'oSW.WriteLine("-----------------------------------------------------------")
    'oSW.WriteLine("IE: " & Convert.ToBoolean(rdoDefault.Checked))
    'oSW.WriteLine("PROXY: " & txtProxy.Text)
    'oSW.WriteLine("PORT: " & nudPort.Value)
    'oSW.WriteLine("USERNAME: " & txtUsername.Text)
    'oSW.WriteLine("PASSWORD: [NOT RECORDED FOR SECURITY REASONS]")
    'oSW.WriteLine("DOMAIN: " & txtDomain.Text)
    'oSW.WriteLine("BYPASS: " & Convert.ToBoolean(chbBypassOnLocal.Checked))
    'oSW.WriteLine("USE COMPRESSION: " & Convert.ToBoolean(chbUseCompression.Checked))
    'oSW.WriteLine("ADD HEADERS: " & Convert.ToBoolean(chbAddHeaders.Checked))
    'oSW.WriteLine("USE KEEPALIVES: " & Convert.ToBoolean(chbKeepAlive.Checked))
    'oSW.WriteLine("CONNECTION SHARING: " & Convert.ToBoolean(chbUseConnectionSharing.Checked))
    'oSW.WriteLine("SET REQUEST TIMEOUT: " & Convert.ToBoolean(chbSetRequestTimeout.Checked))
    'oSW.WriteLine("SET USERAGENT: " & Convert.ToBoolean(chbUserAgent.Checked))
    'oSW.WriteLine("SET PROXY TIMEOUT: " & Convert.ToBoolean(chbSetProxyTimeout.Checked))
    'oSW.WriteLine("PROTOCOL VERSION: " & Convert.ToString(g_PROTOCOLVERSION))
    'oSW.WriteLine("")
    'If blnOK = True Then

    ' f.Status += "> Performing speed test 1 of 5... " & vbCrLf

    ' oSW.WriteLine("SPEED TESTS")
    ' oSW.WriteLine("-----------------------------------------------------------")
    ' oSW.WriteLine("Time to get 3 lists, each differing in size...")
    ' oSW.WriteLine(TimeToGet3DifferentLists(g_WEBREF))
    ' f.Status += "> Performing speed test 2 of 5... " & vbCrLf
    ' oSW.WriteLine("Time to get the same list 10 times...")
    ' f.Status += "> Performing speed test 3 of 5... " & vbCrLf
    ' oSW.WriteLine(TimeToGetSameList10Times(g_WEBREF))
    ' f.Status += "> Performing speed test 4 of 5... " & vbCrLf
    ' oSW.WriteLine("Time to ping servers...")
    ' oSW.WriteLine(TimeToPingServer("www.bbc.co.uk"))
    ' oSW.WriteLine(TimeToTraceRTServer("www.bbc.co.uk"))
    ' oSW.WriteLine(TimeToPingServer("www.google.co.uk"))
    ' f.Status += "> Performing speed test 5 of 5... " & vbCrLf
    ' oSW.WriteLine(TimeToTraceRTServer("www.google.co.uk"))
    ' oSW.WriteLine(TimeToPingServer("www.pjbpubs.com"))
    ' oSW.WriteLine(TimeToTraceRTServer("www.pjbpubs.com"))
    'End If

    f.Status += vbCrLf & "> Finished, view " & GetAppPath() & "\SystemInfo.txt" & vbCrLf

    oSW.WriteLine(vbCrLf & f.Status)
    oSW.WriteLine("***********************************************************")
    oSW.WriteLine(vbCrLf & vbCrLf & vbCrLf & strFileContent)
    oSW.Flush()
    oSW.Close()

    f.btnClose.Enabled = True
    Cursor.Current = Cursors.Default
    'End If

    End Sub

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    The code is written in VB.NET. You will need the .NET Framework on any machine on which you run this code, and you'll need to compile it into an .EXE file. You may use the free compiler included with the .NET Framework to compile the program; see http://www.duncanmackenzie.net/samples/commandline/ for more information. Or, if you prefer, you may download Visual Basic Express Edition free of charge and use it to compile the program: http://www.duncanmackenzie.net/samples/commandline/
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. wot is CLR
    By lostguy in forum .NET
    Replies: 8
    Last Post: 04-03-2002, 07:41 PM
  2. Replies: 0
    Last Post: 01-09-2002, 06:04 AM
  3. Brain Washing
    By Danny Bowman in forum .NET
    Replies: 152
    Last Post: 09-13-2001, 08:23 AM
  4. Replies: 0
    Last Post: 12-30-2000, 06:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center