Solved

operating system info

Posted on 2008-09-29
2
270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Assisted Solution

by:MatthiasVance
MatthiasVance earned 125 total points
ID: 22598756
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
ID: 22614761
Thanks it is working well.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

724 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