Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 567553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:05:42+00:00 2026-05-13T13:05:42+00:00

My first attempt is to query Win32_OperatingSystem for the caption, and test whether the

  • 0

My first attempt is to query Win32_OperatingSystem for the caption, and test whether the caption “equals” the operating system I am testing for:

Dim objWMIService, strComputer
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")


msgbox getOperatingSystemCaption()
msgbox meetsOperatingSystemRequirement()



Function getOperatingSystemCaption()

     Dim strCaption, colOperatingSystems, objOperatingSystem

     Set colOperatingSystems = objWMIService.ExecQuery _
          ("Select * from Win32_OperatingSystem")

     For Each objOperatingSystem in colOperatingSystems
        strCaption = objOperatingSystem.Caption
        Exit For 
     Next

    getOperatingSystemCaption = strCaption

End Function





Function meetsOperatingSystemRequirement()

    meetsOperatingSystemRequirement = False 

    If getOperatingSystemCaption() = "Microsoft Windows 7 Home Premium" Then 

       meetsOperatingSystemRequirement = True

    End If 


End Function

I suppose I can use InStr, however I still do not understand why the “Caption” and my string are not equal.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:05:43+00:00Added an answer on May 13, 2026 at 1:05 pm

    Are you sure you have “Microsoft Windows XP” and not “Microsoft Windows XP Professional” ?. If you use “=” sign, then you will not catch it because it expects to match exact string. Use instr() would be better if you want partial match. Otherwise, add in “Professional”

    You can put in some debugging after caption is found

    ....
            msgbox strCaption & " " & len(strCaption)
            getOperatingSystemCaption = strCaption
    ....
    

    and try a different way

    .....
        myCaption = getOperatingSystemCaption()
         msgbox myCaption & " " & len(myCaption)
        If myCaption = "Microsoft Windows XP Premium Home" Then 
    ......
    

    check the length as well…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider my first attempt, a simple type in F# like the following: type Test()
I want to ORDER BY the result of a MINUS query. My first attempt
First attempt to use this cool site - after searching for 2 hours: So
First day and first attempt at using Scala - so go easy on me!
This is my first attempt at responsive design, so I'm keeping it simple. I
This is my first attempt to write shorthand if statements however am befuddled by
Because this is my first attempt at an extension method that seems quite useful
this if my first attempt at using streaming for WCF, and I am struggling
Here is my first attempt at validating XML with XSD. The XML file to
This is my first attempt to create a GUI in MATLAB. I haven't been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.