Jump to content

Recommended Posts

Posted

Hello,

 

I am using visual basic 2008 express which I think uses visual basic 6 :S (correct me if I am wrong)

 

I have mad a nice little application to hand out to teachers which has a few administrative we can ask them to click when they have an issue. Simple stuff really like "ipconfig /renew" and "installrm" It also has a tab with system info on it.

 

I was wondering if there is a way to get it to display the current XP Service pack in a text box. I have managed to achieve this for computer name etc using

 

TextBoxXYZ.Text = My.Computer.Info.OSFullName

 

Is there a similar way to show service pack?

 

Thank you in advance

 

Oh probably should mention I am very new to visual basic :)

Posted

vb 6 is different to vb 2008 in a lot of ways besides the obvious of being OOP

 

WMI in vb dot net

 

DevCity.NET :: WMI connections made easy in VB.NET. Page 1

 

Using Win32_OperatingSystem wmi class to querry for service pack level in vbscript ( which will need converting / changing to vb .net which is easy enough to do )

 

WMI and VBScript for Microsoft Operating Systems - Guy's Secrets

 

Once you have done that then you can assign the outcome / results to a text field

Posted

@mac_shinobi

 

That looks a little bit out of my league to be honest mate. I am not a programmer and my knowledge of VB is obviously not great.

 

I was hoping there was a more simple way. Oh well, back t the drawing board :p

Posted
Try this - again may be a bit too involved but it may help

 

Viewing System information - VB.NET

 

That's .NET again and doesn't mention how to get Service Pack info (as far I can see). There is what looks like a good example script here (click link).

 

Specifically for VB6:

Private Sub Form_Load()
   ' Get the OS information.
   ' For more information from this query, see:
   '      http:'msdn.microsoft.com/library/aa394239.aspx
   Dim os_query As String
   Dim os_results As Object
   Dim info As Object

   os_query = "SELECT * FROM Win32_OperatingSystem"
   Set os_results = _
       GetObject("Winmgmts:").ExecQuery(os_query)
   For Each info In os_results
       lblCaption.Caption = info.Caption
       lblVersion.Caption = "Version " & _
           info.Version & _
           " SP " & _
           info.ServicePackMajorVersion & "." & _
           info.ServicePackMinorVersion
   Next info
End Sub

 

This adds the info the the respective labels noted above although obviously you could assign it to anything (text box, variable etc). I haven't checked if this code works as I only have VB6 at home and not in the school.

Posted

@dgssmith Thank you for this it looks more what I am looking for. I intend to put the information into a text box in my program so that we can ask users to look up their service pack over the phone in 1 step.

 

This scrpit is giving me some errors. (if this is being being a noob I am sorry)

 

name 'lblcaption' is not declared

name 'lblversion' is not declared

 

Thanks

Posted

Just realised it is my being a fool.... they are not declared because I need to swap them for the name of my text boxs...

 

Thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...