*-- Serial of HD 0 of local machine using current user's permissions: ? GetHDSerial() *-- Serial of HD 1 of remote machine "RMachine1" ? GetHDSerial(1, 'RMachine1', 'AdminUser', 'AdminPassword') * Password must be Domain Admin password, or the password of an admin of the remote machine * and WMI permissions must be set *__________________________________________________ Function GetHDSerial(tnDevice, tcComputer, tcUser, tcPassword) Local lcComputer, loWMIService, loWBEMLocator, loNetWork, lcDomain Local loLocator, lcUser, lcPassword, lcDomain, loNetWork, lnDevice Local loDrives, loDrive, lnCurrDevice, lcSerial lcDomain = getenv("UserDomain") lcUser = Iif(Vartype(tcUser) = 'C', tcUser, '') lcPassword = Iif(Vartype(tcPassword) = 'C', tcPassword, '') lcComputer = Iif(Vartype(tcComputer) = 'C', tcComputer, '') lnDevice = Iif(Vartype(tnDevice) = 'N', tnDevice, 0) lcSerial = 'Unknown' Try loWBEMLocator = Createobject("wbemScripting.SwbemLocator") loWMIService = loWBEMLocator.ConnectServer(lcComputer, '\root\cimv2', lcDomain + "\" + lcUser, lcPassword) Catch loWMIService = Null Endtry If Not Isnull(loWMIService) loDrives = loWMIService.ExecQuery('Select SerialNumber from Win32_PhysicalMedia') lnCurrDevice = 0 For Each loDrive In loDrives If lnCurrDevice = lnDevice lcSerial = loDrive.SerialNumber Exit Endif lnCurrDevice = lnCurrDevice + 1 Endfor Endif Return Alltrim(lcSerial) Endfunc