tailieunhanh - Windows Admin Scripting Little Black Book- P17

Windows Admin Scripting Little Black Book- P17:This book may not be duplicated in any way without the express written consent of the publisher, except in the form of brief excerpts or quotations for the purposes of review. The information contained herein is for the personal use of the reader and may not be incorporated in any commercial programs, other books, databases, or any kind of software without written consent of the publisher. Making copies of this book or any portion for any purpose other than your own is a violation of United States copyright laws | The Win32_CDROMDrive class allows you to query CD-ROM information through WMI. To collect CD-ROM information on a system using WMI proceed as follows 1. Create a new directory to store all files included in this example. 2. Download and install the latest version of Windows Script Host from to the new directory. 3. Select Start Run and enter cscript . Here scriptfile is the full path and file name of a script file that contains the following Set CDSet GetObject winmgmts .InstancesOf Win32 CDROMDrive For each CD in CDSet Name VBlf Drive VBlf Status Next Note The highlighted code above must be placed on one line. Collecting Drive Information The Win32_LogicalDisk class allows you to query disk information through WMI. To inventory disks on a system using WMI proceed as follows 1. Create a new directory to store all files included in this example. 2. Download and install the latest version of Windows Script Host from to the new directory. 3. Select Start Run and enter cscript . Here scriptfile is the full path and file name of a script file that contains the following Set DiskSet GetObject winmgmts .InstancesOf Win32 LogicalDisk For each Disk in DiskSet Select Case Case 0 DType Unknown Case 1 DType No Root Directory Case 2 DType Removable Disk Case 3 DType Local Disk Case 4 DType Network Drive Case 5 DType Compact Disc Case 6 DType RAM Disk End Select Drive VBlf Name VBlf Type DType VBlf File System VBlf Size VBlf Free Space VBlf Compressed Next Note The highlighted code above must be placed on one line. Collecting Memory Information The Win32_LogicalMemoryConfiguration class allows you to query memory information through WMI. To collect memory information on a system using WMI proceed as follows 1. Create a new directory to store all files included