[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

operating system info

Posted on 2008-09-29
2
Medium Priority
?
285 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 500 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Suggested Courses

872 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