您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > (wmi)获取计算机各类软硬件信息的VBS代码集合
获取计算机各类软硬件信息的VBS代码集合是VBS脚本,按键使用注意哟。。。自己不需要属性就删除吧。。可以读取所有物理硬盘!!strComputer=.SetobjWMIService=GetObject(winmgmts:_&{impersonationLevel=impersonate}!\\&strComputer_&\root\cimv2)SetcolDiskDrives=objWMIService.ExecQuery_(Select*fromWin32_DiskDrive)ForeachobjDiskDriveincolDiskDrivesWscript.EchoBytesPerSector:&vbTab&_objDiskDrive.BytesPerSectorFori=Lbound(objDiskDrive.Capabilities)to_Ubound(objDiskDrive.Capabilities)Wscript.EchoCapabilities:&vbTab&_objDiskDrive.Capabilities(i)NextWscript.EchoCaption:&vbTab&objDiskDrive.CaptionWscript.EchoDeviceID:&vbTab&objDiskDrive.DeviceIDWscript.EchoIndex:&vbTab&objDiskDrive.IndexWscript.EchoInterfaceType:&vbTab&objDiskDrive.InterfaceTypeWscript.EchoManufacturer:&vbTab&objDiskDrive.ManufacturerWscript.EchoMediaLoaded:&vbTab&objDiskDrive.MediaLoadedWscript.EchoMediaType:&vbTab&objDiskDrive.MediaTypeWscript.EchoModel:&vbTab&objDiskDrive.ModelWscript.EchoName:&vbTab&objDiskDrive.NameWscript.EchoPartitions:&vbTab&objDiskDrive.PartitionsWscript.EchoPNPDeviceID:&vbTab&objDiskDrive.PNPDeviceIDWscript.EchoSCSIBus:&vbTab&objDiskDrive.SCSIBusWscript.EchoSCSILogicalUnit:&vbTab&_objDiskDrive.SCSILogicalUnitWscript.EchoSCSIPort:&vbTab&objDiskDrive.SCSIPortWscript.EchoSCSITargetId:&vbTab&objDiskDrive.SCSITargetIdWscript.EchoSectorsPerTrack:&vbTab&_objDiskDrive.SectorsPerTrackWscript.EchoSignature:&vbTab&objDiskDrive.SignatureWscript.EchoSize:&vbTab&objDiskDrive.SizeWscript.EchoStatus:&vbTab&objDiskDrive.StatusWscript.EchoTotalCylinders:&vbTab&_objDiskDrive.TotalCylindersWscript.EchoTotalHeads:&vbTab&objDiskDrive.TotalHeadsWscript.EchoTotalSectors:&vbTab&objDiskDrive.TotalSectorsWscript.EchoTotalTracks:&vbTab&objDiskDrive.TotalTracksWscript.EchoTracksPerCylinder:&vbTab&_objDiskDrive.TracksPerCylinderNext以上代码是读取物理磁盘信息的,非分区信息。。接下来来个读取光驱的。配合限制来计算注册码很方便。呵呵!!OnErrorResumeNextstrComputer=.SetobjWMIService=GetObject(winmgmts:\\&strComputer&\root\cimv2)SetcolItems=objWMIService.ExecQuery(Select*fromWin32_CDROMDrive)ForEachobjItemincolItemsWscript.EchoAvailability:&objItem.AvailabilityForEachstrCapabilityinobjItem.CapabilitiesWscript.EchoCapability:&strCapabilityNextWscript.EchoCaption:&objItem.CaptionWscript.EchoDescription:&objItem.DescriptionWscript.EchoDeviceID:&objItem.DeviceIDWscript.EchoDrive:&objItem.DriveWscript.EchoManufacturer:&objItem.ManufacturerWscript.EchoMediaLoaded:&objItem.MediaLoadedWscript.EchoMediaType:&objItem.MediaTypeWscript.EchoName:&objItem.NameWscript.EchoPNPDeviceID:&objItem.PNPDeviceIDWscript.EchoSCSIBus:&objItem.SCSIBusWscript.EchoSCSILogicalUnit:&objItem.SCSILogicalUnitWscript.EchoSCSIPort:&objItem.SCSIPortWscript.EchoSCSITargetID:&objItem.SCSITargetIdNext接着是能读取显示设备显卡驱动等信息的代码OnErrorResumeNextstrComputer=.SetobjWMIService=GetObject(winmgmts:\\&strComputer&\root\cimv2)SetcolItems=objWMIService.ExecQuery(Select*fromWin32_DisplayConfiguration)ForEachobjItemincolItemsWscript.EchoBitsPerPel:&objItem.BitsPerPelWscript.EchoDeviceName:&objItem.DeviceNameWscript.EchoDisplayFlags:&objItem.DisplayFlagsWscript.EchoDisplayFrequency:&objItem.DisplayFrequencyWscript.EchoDriverVersion:&objItem.DriverVersionWscript.EchoLogPixels:&objItem.LogPixelsWscript.EchoPelsHeight:&objItem.PelsHeightWscript.EchoPelsWidth:&objItem.PelsWidthWscript.EchoSettingID:&objItem.SettingIDWscript.EchoSpecificationVersion:&objItem.SpecificationVersionWscript.EchoNext再来读取内存信息的OnErrorResumeNextstrComputer=.SetobjWMIService=GetObject(winmgmts:\\&strComputer&\root\cimv2)SetcolItems=objWMIService.ExecQuery(Select*fromWin32_MemoryArray)ForEachobjItemincolItemsWscript.EchoDeviceID:&objItem.DeviceIDWscript.EchoEndingAddress:&objItem.EndingAddressWscript.EchoStartingAddress:&objItem.StartingAddressWscript.EchoNext继续上个读取系统信息的代码strComputer=.SetobjWMIService=GetObject(winmgmts:_&{impersonationLevel=impersonate}!\\&strComputer&\root\cimv2)SetcolSettings=objWMIService.ExecQuery_(Select*fromWin32_OperatingSystem)ForEachobjOperatingSystemincolSettingsWscript.EchoOSName:&objOperatingSystem.NameWscript.EchoVersion:&objOperatingSystem.VersionWscript.EchoServicePack:&_objOperatingSystem.ServicePackMajorVersion_&.&objOperatingSystem.ServicePackMinorVersionWscript.EchoOSManufacturer:&objOperatingSystem.ManufacturerWscript.EchoWindowsDirectory:&_objOperatingSystem.WindowsDirectoryWscript.EchoLocale:&objOperatingSystem.LocaleWscript.EchoAvailablePhysicalMemory:&_objOperatingSystem.FreePhysicalMemoryWscript.EchoTotalVirtualMemory:&_objOperatingSystem.TotalVirtualMemorySizeWscript.EchoAvailableVirtualMemory:&_objOperatingSystem.FreeVirtualMemoryWscript.EchoOSName:&objOperatingSystem.SizeStoredInPagingFilesNextSetcolSettings=objWMIService.ExecQuery_(Select*fromWin32_ComputerSystem)ForEachobjComputerincolSettingsWscript.EchoSystemName:&objComputer.NameWscript.EchoSystemManufacturer:&objComputer.ManufacturerWscript.EchoSystemModel:&objComputer.ModelWscript.EchoTimeZone:&objComputer.CurrentTimeZoneWscript.EchoTotalPhysicalMemory:&_objComputer.TotalPhysicalMemoryNextSetcolSettings=objWMIService.ExecQuery_(Select*fromWin32_Processor)ForEachobj
本文标题:(wmi)获取计算机各类软硬件信息的VBS代码集合
链接地址:https://www.777doc.com/doc-6499836 .html