Util para criar serial, e obter informações sobre a Maquina.
Não são todas as informações disponÃveis, é so pesquisar.
PROCEDURE WMI_Teste()
set alte to "wmi.log"
set alte on
WMI_LogicalDisk_Teste()
WMI_LogicalDiskToPartition_Teste()
WMI_DiskDrive_Teste()
WMI_DiskDriveToDiskPartition_Teste()
WMI_DiskPartition_Teste()
WMI_PhysicalMedia_Teste()
WMI_DiskDrivePhysicalMedia_Teste()
WMI_OperatingSystem_Teste()
WMI_NetworkAdapter_Teste()
WMI_NetworkAdapterConfiguration_Teste()
WMI_Processor_Teste()
WMI_ComputerSystemProduct_Teste()
set alte off
set alte to
RETURN
PROCEDURE WMI_TesteDisplay( sSelect, aSend, lInkey )
LOCAL aItem, xx, yy
DEFA lInkey TO .F.
aItem := WMI_Array( sSelect )
FOR xx := 1 TO Len(aItem)
cls
IF !lInkey
?
?
ENDIF
?? sSelect, StrTrim(xx) + '/' + StrTrim(Len(aItem)), "Items: " + StrTrim(Len(aSend))
?
FOR yy := 1 TO Len(aSend)
IF lInkey .and. yy % 24 = 0
Inkey(0, INKEY_KEYBOARD)
cls
?? sSelect, StrTrim(xx) + '/' + StrTrim(Len(aItem)), "Items: " + StrTrim(Len(aSend))
?
ENDIF
? StrTrim(yy), aSend[yy], "=", __objSendMsg( aItem[xx], aSend[yy] )
NEXT
IF lInkey .and. (yy -1 ) % 24 <> 0
Inkey(0, INKEY_KEYBOARD)
ENDIF
NEXT
RETURN
FUNCTION WMI_Object()
LOCAL oWMI, oErr
BEGIN SEQUENCE WITH {| e | Break( e ) }
oWMI := CreateObject( "wbemScripting.SwbemLocator" ) // OleCria( "wbemScripting.SwbemLocator" )
RECOVER USING oErr
oWMI := NIL
END
RETURN oWMI
FUNCTION WMI_Connect(oWMI)
LOCAL oSrv, oErr
BEGIN SEQUENCE WITH {| e | Break( e ) }
DEFA oWMI TO WMI_Object()
oSrv := oWMI:ConnectServer()
RECOVER USING oErr
oSrv := NIL
END SEQUENCE
RETURN oSrv
FUNCTION WMI_Exec(sExec, oWmi, oSrv)
LOCAL oRet, oErr
BEGIN SEQUENCE WITH {| e | Break( e ) }
DEFA oWMI TO WMI_Object()
DEFA oSrv TO oWMI:ConnectServer()
oRet := oSrv:ExecQuery( sExec )
RECOVER USING oErr
oRet := NIL
END SEQUENCE
RETURN oRet
FUNCTION WMI_Array( sSelect, sWhere )
LOCAL aItem, oItem, oSelect
DEFA sWhere TO ""
aItem := {}
oSelect := WMI_Exec("select * from " + sSelect + Trim(sWhere))
FOR EACH oItem in oSelect
AAdd(aItem, oItem)
NEXT
RETURN aItem
PROCEDURE WMI_LogicalDisk_Teste()
LOCAL aSend
aSend := { ;
"Access", "Availability", "BlockSize", "Caption", "Compressed", ;
"ConfigManagerErrorCode", "ConfigManagerUserConfig", "CreationClassName", "Description", "DeviceID", ;
"DriveType", "ErrorCleared", "ErrorDescription", "ErrorMethodology", "FileSystem", ;
"FreeSpace", "InstallDate", "LastErrorCode", "MaximumComponentLength", "MediaType", ;
"Name", "NumberOfBlocks", "PNPDeviceID", "PowerManagementCapabilities", "PowerManagementSupported", ;
"ProviderName", "Purpose", "QuotasDisabled", "QuotasIncomplete", "QuotasRebuilding", ;
"Size", "Status", "StatusInfo", "SupportsDiskQuotas", "SupportsFileBasedCompression", ;
"SystemCreationClassName", "SystemName", "VolumeDirty", "VolumeName", "VolumeSerialNumber" ;
}
WMI_TesteDisplay( "Win32_LogicalDisk", aSend )
RETURN
PROCEDURE WMI_LogicalDiskToPartition_Teste()
LOCAL aSend
aSend := { "EndingAddress", "StartingAddress", "Antecedent", "Dependent" }
WMI_TesteDisplay( "Win32_LogicalDiskToPartition", aSend )
RETURN
PROCEDURE WMI_DiskDrive_Teste()
LOCAL aSend
aSend := { ;
"Availability", "BytesPerSector", "Capabilities", "CapabilityDescriptions", "Caption", ;
"CompressionMethod", "ConfigManagerErrorCode", "ConfigManagerUserConfig", "CreationClassName", "DefaultBlockSize", ;
"Description", "DeviceID", "ErrorCleared", "ErrorDescription", "ErrorMethodology", ;
"FirmwareRevision", "Index", "InstallDate", "InterfaceType", "LastErrorCode", ;
"Manufacturer", "MaxBlockSize", "MaxMediaSize", "MediaLoaded", "MediaType", ;
"MinBlockSize", "Model", "Name", "NeedsCleaning", "NumberOfMediaSupported", ;
"Partitions", "PNPDeviceID", "PowerManagementCapabilities", "PowerManagementSupported", ;
"SCSIBus", "SCSILogicalUnit", "SCSIPort", "SCSITargetId", "SectorsPerTrack", ;
"SerialNumber", "Signature", "Size", "Status", "StatusInfo", ;
"SystemCreationClassName", "SystemName", "TotalCylinders", "TotalHeads", "TotalSectors", ;
"TotalTracks", "TracksPerCylinder" ;
}
WMI_TesteDisplay( "Win32_DiskDrive", aSend )
RETURN
PROCEDURE WMI_DiskDriveToDiskPartition_Teste()
LOCAL aSend
aSend := { "Antecedent", "Dependent" }
WMI_TesteDisplay( "Win32_DiskDriveToDiskPartition", aSend )
RETURN
PROCEDURE WMI_DiskPartition_Teste()
LOCAL aSend
//"AdditionalAvailability
//"IdentifyingDescriptions
//"MaxQuiesceTime
//"OtherIdentifyingInfo
//"PowerOnHours
//"TotalPowerOnHours
aSend := { ;
"Availability", "PowerManagementCapabilities", "StatusInfo", "Access", "BlockSize", ;
"Bootable", "BootPartition", "Caption", "ConfigManagerErrorCode", "ConfigManagerUserConfig", ;
"CreationClassName", "Description", "DeviceID", "DiskIndex", "ErrorCleared", ;
"ErrorDescription", "ErrorMethodology", "HiddenSectors", "Index", "InstallDate", ;
"LastErrorCode", "Name", "NumberOfBlocks", "PNPDeviceID", "PowerManagementSupported", ;
"PrimaryPartition", "Purpose", "RewritePartition", "Size", "StartingOffset", ;
"Status", "SystemCreationClassName", "SystemName", "Type" ;
}
WMI_TesteDisplay( "Win32_DiskPartition", aSend )
RETURN
PROCEDURE WMI_PhysicalMedia_Teste()
LOCAL aSend
aSend := { ;
"Caption", "Description", "InstallDate", "Name", "Status", ;
"CreationClassName", "Manufacturer", "Model", "SKU", "SerialNumber", ;
"Tag", "Version", "PartNumber", "OtherIdentifyingInfo", "PoweredOn", ;
"Removable", "Replaceable", "HotSwappable", "Capacity", "MediaType", ;
"MediaDescription", "WriteProtectOn", "CleanerMedia" ;
}
WMI_TesteDisplay( "Win32_PhysicalMedia", aSend )
RETURN
PROCEDURE WMI_DiskDrivePhysicalMedia_Teste()
LOCAL aSend
aSend := { "Antecedent", "Dependent" }
WMI_TesteDisplay( "Win32_DiskDrivePhysicalMedia", aSend )
RETURN
PROCEDURE WMI_OperatingSystem_Teste()
LOCAL aSend
aSend := { "SerialNumber" }
WMI_TesteDisplay( "Win32_OperatingSystem", aSend )
RETURN
PROCEDURE WMI_NetworkAdapter_Teste()
LOCAL aSend
aSend := { ;
"AdapterType", "AdapterTypeID", "AutoSense", "Availability", "Caption", ;
"ConfigManagerErrorCode", "ConfigManagerUserConfig", "CreationClassName", "Description", "DeviceID", ;
"ErrorCleared", "ErrorDescription", "GUID", "Index", "InstallDate", ;
"Installed", "InterfaceIndex", "LastErrorCode", "MACAddress", "Manufacturer", ;
"MaxNumberControlled", "MaxSpeed", "Name", "NetConnectionID", "NetConnectionStatus", ;
"NetEnabled", "NetworkAddresses", "PermanentAddress", "PhysicalAdapter", "PNPDeviceID", ;
"PowerManagementCapabilities", "PowerManagementSupported", "ProductName", "ServiceName", "Speed", ;
"Status", "StatusInfo", "SystemCreationClassName", "SystemName", "TimeOfLastReset" ;
}
WMI_TesteDisplay( "Win32_NetworkAdapter", aSend )
RETURN
PROCEDURE WMI_NetworkAdapterConfiguration_Teste()
LOCAL aSend
aSend := { ;
"Caption", "Description", "SettingID", "ArpAlwaysSourceRoute", "ArpUseEtherSNAP", ;
"DatabasePath", "DeadGWDetectEnabled", "DefaultIPGateway", "DefaultTOS", "DefaultTTL", ;
"DHCPEnabled", "DHCPLeaseExpires", "DHCPLeaseObtained", "DHCPServer", "DNSDomain", ;
"DNSDomainSuffixSearchOrder", "DNSEnabledForWINSResolution", "DNSHostName", "DNSServerSearchOrder", "DomainDNSRegistrationEnabled", ;
"ForwardBufferMemory", "FullDNSRegistrationEnabled", "GatewayCostMetric", "IGMPLevel", "Index", ;
"InterfaceIndex", "IPAddress", "IPConnectionMetric", "IPEnabled", "IPFilterSecurityEnabled", ;
"IPPortSecurityEnabled", "IPSecPermitIPProtocols", "IPSecPermitTCPPorts", "IPSecPermitUDPPorts", "IPSubnet", ;
"IPUseZeroBroadcast", "IPXAddress", "IPXEnabled", "IPXFrameType", "IPXMediaType", ;
"IPXNetworkNumber", "IPXVirtualNetNumber", "KeepAliveInterval", "KeepAliveTime", "MACAddress", ;
"MTU", "NumForwardPackets", "PMTUBHDetectEnabled", "PMTUDiscoveryEnabled", "ServiceName", ;
"TcpipNetbiosOptions", "TcpMaxConnectRetransmissions", "TcpMaxDataRetransmissions", "TcpNumConnections", "TcpUseRFC1122UrgentPointer", ;
"TcpWindowSize", "WINSEnableLMHostsLookup", "WINSHostLookupFile", "WINSPrimaryServer", "WINSScopeID", ;
"WINSSecondaryServer" ;
}
WMI_TesteDisplay( "Win32_NetworkAdapterConfiguration", aSend )
RETURN
PROCEDURE WMI_Processor_Teste()
LOCAL aSend
aSend := { ;
"AddressWidth", "Architecture", "AssetTag", "Availability", "Caption", ;
"Characteristics", "ConfigManagerErrorCode", "ConfigManagerUserConfig", "CpuStatus", "CreationClassName", ;
"CurrentClockSpeed", "CurrentVoltage", "DataWidth", "Description", "DeviceID", ;
"ErrorCleared", "ErrorDescription", "ExtClock", "Family", "InstallDate", ;
"L2CacheSize", "L2CacheSpeed", "L3CacheSize", "L3CacheSpeed", "LastErrorCode", ;
"Level", "LoadPercentage", "Manufacturer", "MaxClockSpeed", "Name", ;
"NumberOfCores", "NumberOfEnabledCore", "NumberOfLogicalProcessors", "OtherFamilyDescription", "PartNumber", ;
"PNPDeviceID", "PowerManagementCapabilities", "PowerManagementSupported", "ProcessorId", "ProcessorType", ;
"Revision", "Role", "SecondLevelAddressTranslationExtensions", "SerialNumber", "SocketDesignation", ;
"Status", "StatusInfo", "Stepping", "SystemCreationClassName", "SystemName", ;
"ThreadCount", "UniqueId", "UpgradeMethod", "Version", "VirtualizationFirmwareEnabled", ;
"VMMonitorModeExtensions", "VoltageCaps" ;
}
WMI_TesteDisplay( "Win32_Processor", aSend )
RETURN
PROCEDURE WMI_ComputerSystemProduct_Teste()
LOCAL aSend
aSend := { ;
"Caption", "Description", "IdentifyingNumber", "Name", "SKUNumber", ;
"Vendor", "Version", "UUID" ;
}
WMI_TesteDisplay( "Win32_ComputerSystemProduct", aSend )
RETURN
FUNCTION WMI_Service()
RETURN WMI_Array("Win32_Service")