Solved

operating system info

Posted on 2008-09-29
2
253 Views
Last Modified: 2010-07-27
vbs code that check which operating system in running and if running system is windows xp or vista then code ends else eject CD/DVD tray. If not possible in vbs then mention in possible language.
0
Comment
Question by:ankur3020
2 Comments
 
LVL 8

Assisted Solution

by:MatthiasVance
MatthiasVance earned 125 total points
Comment Utility
Hope this will help.

Kind regards,

Matthias Vance
strComputer = "."

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 

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

For Each objOperatingSystem in colOperatingSystems

	version = Left(objOperatingSystem.Version, 3)

	if version <> "6.0" and version <> "5.1" then

		OpenCD()

	end if

Next
 

Public Sub OpenCD()

	Set oWMP = CreateObject("WMPlayer.OCX.7" )

	Set colCDROMs = oWMP.cdromCollection
 

	if colCDROMs.Count >= 1 then

	        For i = 0 to colCDROMs.Count - 1

	                colCDROMs.Item(i).Eject

	        Next

	End If

End Sub

Open in new window

0
 

Accepted Solution

by:
ankur3020 earned 0 total points
Comment Utility
Thanks it is working well.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now