Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: CD CDROM media
This code checks if there is media loaded into the CDROM
objLocator = ObjectCreate("WbemScripting.SWbemLocator") objService = objLocator.ConnectServer(".","root/cimv2","","") objSecurity = objService.Security_ objSecurity.ImpersonationLevel = 3 class = "Win32_CDROMDrive" ; query instances query = "SELECT * FROM Win32_CDROMDrive" colInstances = objService.ExecQuery(query) ; loop once for each instance ForEach objInstance In colInstances ;Check if Object is EMPTY type = ObjectTypeGet(objInstance) If type=="EMPTY" Then Break ; obtain properties DRIVE = objInstance.Drive mediaType = objInstance.MediaType mediaLoaded = objInstance.mediaLoaded If mediaLoaded == -1 mediaLoadedstr = "Media Loaded" Else mediaLoadedstr = "Media NOT Loaded" EndIf Message("CD INFO", "Drive: " : DRIVE : @CRLF :"mediaType: " : mediaType : @CRLF :"mediaLoaded: " : mediaLoadedstr) Next ; close object handles colInstances = 0 objSecurity = 0 objService = 0 objLocator = 0
Article ID: W16908
File Created: 2007:07:03:14:26:58
Last Updated: 2007:07:03:14:26:58