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

  • 10 Rules that Make or Break Enterprise App Development Projects In today's app-driven world, application development is a top priority. Even so, 68% of enterprise application delivery projects fail. Designing and building applications that pay for themselves and adapt to future needs is incredibly difficult. Executing one successful project is lucky, but making it a repeatable process and strategic advantage? That's where the money is. With help from our most experienced project leads and software engineers, …

  • The first phase of API management was about realizing the business value of APIs. This next wave of API management enables the hyper-connected enterprise to drive and scale their businesses as API models become more complex and sophisticated. Today, real world product launches begin with an API program and strategy in mind. This API-first approach to development will only continue to increase, driven by an increasingly interconnected web of devices, organizations, and people. To support this rapid growth, …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds