Export (0) Print
Expand All
Expand Minimize

Converting the FileSystemObject's SerialNumber Property


Windows PowerShell


Definition: Returns the serial number used to uniquely identify a disk volume.

SerialNumber


Well, it looks like the easiest way to do this is to simply use the FileSystemObject:


$a = New-Object -ComObject Scripting.FileSystemObject
$d = $a.GetDrive("C:\")
$d.SerialNumber


We start by using the New-Object cmdlet to get ahold of the FileSystemObject. Notice that we used the -ComObject parameter. We then call the GetDrive method to retrieve the drive we’re interested in. At that point all we need to do is display the SerialNumber property.


See conversions of other FileSystemObject methods and properties.
Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft