Disk Serial Number'�Using the WMI Scripting Library


' Retreives the drive serial number in a Win32 system.
' This is a great example of how to use the WMI scripting library.
'
' The latest version of the library can be downloaded from Microsoft.
'
' The WMI Scripting type library must be referenced to use this routine.
'
' to add the WMI Scripting type library to the project references
'
'   1.Select References from the Project menu.
'
'   2.In the Available References dialog box, select Microsoft WBEM
'     Scripting V1.0 Library or Microsoft WMI Scripting V1.1
'     Library (whichever appears).
'
'   3.If no suitable option appears in the Available References list,
'      add it by using the Browse button in the References dialog
'      box. The Browse button opens an Add Reference dialog box
'      that enables you to locate the WbemScripting type library.
'      The WbemScripting type library resides in the file
'      Wbemdisp.tlb in the Wbem installation directory. on
'      computers with the Windows 98 operating system, this type
'      library is located in the WindowsSystemWbem directory.
'     On computers with the Microsoft. Windows NT./Windows 2000
'      operating system, this type library is located in the
'      WinntSystem32Wbem directory.
'
'   4.Select the file and click Open. Microsoft WBEM Scripting V1.0
'      Library or Microsoft WMI Scripting V1.1 Library appears on
'      the references list.
' Make sure you select the check the box next to this item in the list.
'
'
Sub main()
'
  set objinst = GetObject("WinMgmts::Win32_LogicalDisk='C:'")
  MsgBox (GetObject "WinMgmts::Win32_LogicalDisk='C:'").
          VolumeSerialNumber)
'
End Sub



Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: December 18, 2014 The Internet of Things (IoT) incorporates physical devices into business processes using predictive analytics. While it relies heavily on existing Internet technologies, it differs by including physical devices, specialized protocols, physical analytics, and a unique partner network. To capture the real business value of IoT, the industry must move beyond customized projects to general patterns and platforms. Check out this webcast and join industry experts as …

  • Learn How A Global Entertainment Company Saw a 448% ROI Every business today uses software to manage systems, deliver products, and empower employees to do their jobs. But software inevitably breaks, and when it does, businesses lose money -- in the form of dissatisfied customers, missed SLAs or lost productivity. PagerDuty, an operations performance platform, solves this problem by helping operations engineers and developers more effectively manage and resolve incidents across a company's global operations. …

Most Popular Programming Stories

More for Developers

RSS Feeds