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

  • Agile methodologies give development and test teams the ability to build software at a faster rate than ever before. Combining DevOps with hybrid cloud architectures give teams not just the principles, but also the technology necessary to achieve their goals. By combining hybrid cloud and DevOps: IT departments maintain control, visibility, and security Dev/test teams remain agile and collaborative Organizational barriers are broken down Innovation and automation can thrive Download this white paper to …

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds