Hi
I think Netname() is not unique. Is there a way to identify a computer ?
Thanks
Regards
ACWoo
FHW1304+bcc582+Harbour
//-----------------------------------------------------------
Static Function SerialProtect()
//-----------------------------------------------------------
local oLoc := CreateObject( "wbemScripting.SwbemLocator" )
local oSrv := oLoc:ConnectServer(,"root\cimv2")
local aDrives := oSrv:ExecQuery( "SELECT * FROM Win32_ComputerSystemProduct" )
local oDrive, cSerial := ""
Local aData := {}
for each oDrive in aDrives
AADD( aData, oDrive:UUID )
Next
For nAt := 1 to Len( aData )
cSerial += Upper( AllTrim( cStr( aData[nAt] ) ) )
Next nAt
Return( cSerial )
FUNCTION MacAddress
LOCAL oLoc
LOCAL oSrv
LOCAL oNics
LOCAL oTemp
LOCAL aMacs := {}
oLoc := CREATEOBJECT( "wbemScripting.SwbemLocator" )
oSrv := oLoc:ConnectServer()
oNics := oSrv:ExecQuery( "SELECT * FROM Win32_NetworkAdapter WHERE ConfigManagerErrorCode = 0" )
FOR EACH oTemp IN oNics
IF !empty( oTemp:MACAddress )
AADD( aMacs, oTemp:MACAddress )
ENDIF
NEXT
RETURN if( !empty( aMacs ), aMacs[ 1 ], transform( HB_Random() * 1000000000000, "99:99:99:99:99:99" ) )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 79 guests