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
  • 0 Views
  • 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

OK, having tried my first TDD attempt, it's time to reflect a little and
This is my first attempt to read an Excel 2007 file via ADO.net, and
I have an app that will query a database and attempt to output results
I'm after a simple stored procedure to drop tables. Here's my first attempt: CREATE
I have a class that needs a property set inside a LINQ-to-SQL query. My
I'm developing my first app with JPA/Hibernate and Spring. My first attempt at a
I am trying to attempt my first Google Chrome Extension and have a question.
First of all, thank you very much in advance for any attempt at helping
This is my first attempt at using JSCookMenu and its homepage ( http://jscook.yuanheng.org/JSCookMenu/ )
First, let's get the security considerations out of the way. I'm using simple authentication

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.