아래 코드 는 windows 에서 쉽게 마 약 을 보고 할 수 있 으 니 안심 하고 사용 하 셔 도 됩 니 다.
'==========================================================================
'
' Date:2009/3/19
' Name:
' Author:Smileruner
' www.overmcse.com
' Win2000 WinNT
'
' 3/19, 。
'==========================================================================
'on error resume Next
const HKEY_LOCAL_MACHINE = &H80000002
const UNINSTALL_ROOT = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
const REG_SZ = 1
'Set wshshell=wscript.createobject("wscript.shell")
' wshshell.run ("%comspec% /c regsvr32 /s scrrun.dll"),0,true
' wshshell.run ("%comspec% /c sc config winmgmt start= auto"),0,true
' wshshell.run ("%comspec% /c net start winmgmt"),0
strComputer = Inputbox(" ",,"")
If strComputer = "" then
Wscript.Echo " , 。"
Wscript.Quit
End If
Set objswbemlocator = createobject("wbemscripting.swbemlocator")
Set objswbemservices = objswbemlocator.connectserver(strComputer, "root\cimv2")
If Err.number <> 0 then
Wscript.Echo " 。 , ,RPC 。"
Err.number.clear
Wscript.Quit
End If
'swbemservices.security_.impersonationleobjvel = 3
Set fso=createobject("scripting.filesystemobject")
FileDate = Replace(date(), "/", "-")
resoultfilepath= strComputer & FileDate & ".html"
Set resultFile= fso.createtextfile(resoultfilepath,,true)
HtmlWriteHead()
'Html
TableHead strComputer," "
'Html
OsWrite()
'
BoardWrite()
'
CpuWrite()
' CPU
MemoryWrite()
'
HarddiskWrite()
'
CdromWrite()
' CDROM
VideoWrite()
'
NetcardWrite()
'
TableEnd()
'Html
TableHead strComputer," "
'Html
Softlist()
'
TableEnd()
'Html
HtmlWriteEnd()
'Html
ResultFile.close
Wscript.Echo " !"
'========= ==========
Function OsWrite()
' ,
Set colOs =objswbemservices.execquery("select * from win32_operatingsystem",,48)
For Each Ositem In colOs
oscaption = Ositem.caption
OsVersion = oscaption & Ositem.version
WriteTable " ",OsVersion
Next
End Function
Function BoardWrite()
' ,
Set colBoard = objswbemservices.execquery("select * from win32_baseboard")
For Each Bditem In colBoard
boardname = Bditem.product
WriteTable " ",boardname
Next
End Function
Function CpuWrite()
' , CPU
Set colCpu =objswbemservices.execquery("select * from win32_processor")
For Each item in colCpu
cpuname = (trim(item.name))
WriteTable " ",cpuname
Next
End Function
Function MemoryWrite()
' ,
mtotal = 0
num = 0
mill = 0
Set colMemory = objswbemservices.execquery("select * from win32_physicalmemory",,48)
For Each objitem In colMemory
mill = objitem.capacity/1048576
WriteTable " ",mill & "M"
mtotal = mtotal+mill
num = num + 1
Next
WriteTable " ",num & " " & " " & mtotal & "M"
End Function
Function HarddiskWrite()
' ,
Set colDisk = objswbemservices.execquery("select * from win32_diskdrive", , 48)
For Each objitem In colDisk
diskname= objitem.caption
disksize= fix(objitem.size/1073741824)
WriteTable " ",diskname & " :" & disksize & "G"
Next
End Function
Function CdromWrite()
' , CDROM
Set colCdrom = objswbemservices.execquery("select * from win32_cdromdrive where scsitargetid=0")
For Each objitem In colCdrom
cdname = objitem.name
WriteTable " ",cdname
Next
End Function
Function videoWrite()
' ,
Set colVideo = objswbemservices.execquery("select * from win32_videocontroller", , 48)
For Each objitem in colVideo
videoname = (trim(objitem.caption) & (objitem.videomodedescription))
WriteTable " ",videoname
Next
End Function
Function netcardWrite()
' ,
Set colNetcards = objswbemservices.execquery("select * from win32_networkadapter")
For Each objNetcard in colNetcards
If Not IsNull(objNetcard.NetConnectionID) Then
NetCardName = objNetcard.productname
WriteTable " ",NetCardName
If objNetcard.NetConnectionStatus = 2 Then
NetCardMac = objNetcard.macaddress
WriteTable " Mac",NetCardMac
strQueryIp ="select * from win32_networkadapterconfiguration" &_
" where IPEnabled = true" &_
" and macaddress = '" & objNetcard.macaddress & "'"
Set colNetcardCfgs = objswbemservices.execquery(strQueryIp)
For Each objNetcardCfg in colNetcardCfgs
For Each CfgAdrress in objNetcardCfg.IPAddress
IpAdrress = CfgAdrress
WriteTable "IP ",IpAdrress
Next
Next
Else
NetCardMac = " 。"
WriteTable " Mac",NetCardMac
IpAdrress = " 。"
WriteTable "IP ",IpAdrress
End If
End if
Next
End Function
Function softlist()
' ,
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = UNINSTALL_ROOT
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each strSubKey In arrSubKeys
If NotHotfix(strSubKey) Then
SoftNameAndVersion = getProgNameAndVersion(oReg,strKeyPath & "\" & strSubKey)
If SoftNameAndVersion<>"0" Then
WriteTable " ",SoftNameAndVersion
End If
End If
Next
End Function
Function NotHotfix(sSubKey)
If Left(sSubkey,2) = "KB" And len(sSubkey) = 8 Then
NotHotfix = 0
Else NotHotfix = 1
End if
End Function
Function getProgNameAndVersion(oReg,sKeyRoot)
Dim sKeyValuesAry, iKeyTypesAry, nCnt, sValue, sDisplayName, sDisplayVersion
oReg.EnumValues HKEY_LOCAL_MACHINE, sKeyRoot, sKeyValuesAry, iKeyTypesAry
If NOT IsArray(sKeyValuesAry) Then
getProgNameAndVersion = 0
Exit Function
End If
For nCnt = 0 To UBound(sKeyValuesAry)
If InStr(1, sKeyValuesAry(nCnt), "DisplayName", vbTextCompare) Then
If iKeyTypesAry(nCnt) = REG_SZ Then
oReg.GetStringValue HKEY_LOCAL_MACHINE, sKeyRoot, sKeyValuesAry(nCnt), sValue
If sValue<>"" Then
sDisplayName = sValue
sDisplayName = Replace(sDisplayName, "[", "(")
sDisplayName = Replace(sDisplayName, "]", ")")
End If
End If
ElseIf InStr(1, sKeyValuesAry(nCnt), "DisplayVersion", vbTextCompare) Then
If iKeyTypesAry(nCnt) = REG_SZ Then
oReg.GetStringValue HKEY_LOCAL_MACHINE, sKeyRoot, sKeyValuesAry(nCnt), sValue
If sValue<>"" Then sDisplayVersion = sValue
End If
End If
If (sDisplayName<>"") AND (sDisplayVersion<>"") Then
getProgNameAndVersion = sDisplayName & " -- : " & sDisplayVersion
Exit Function
Else getProgNameAndVersion = 0
End If
Next
If sDisplayName<>"" Then
getProgNameAndVersion = sDisplayName
Exit Function
End If
End Function
Function WriteTable(caption,value)
' , HTML
resultFile.Writeline "<tr>"
resultFile.Writeline "<td align=""left"" width=""30%"" height=""25"" bgcolor=""#ffffff"" scope=""row""> " & caption & "</td>"
resultFile.Writeline "<td bgcolor=""#ffffff""> " & value & "</td>"
resultFile.Writeline "</tr>"
End Function
Function HtmlWriteHead()
' , THML
resultFile.Writeline "<html>"
resultFile.Writeline "<head>"
resultFile.Writeline "<title> </title>"
resultFile.Writeline "</head>"
resultFile.Writeline "<body>"
End Function
Function HtmlWriteEnd()
' , Html
resultFile.Writeline "</body>"
resultFile.Writeline "</html>"
End Function
Function TableHead(pcname,str)
' , Html
resultFile.Writeline "<h3>" & pcname & str & " -- date:"&now()&" </h3>" & VbCrLf
resultFile.Writeline "<table width=""90%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""1"" bgcolor=""#0000ff"">"
resultFile.Writeline "<tr>"
resultFile.Writeline "<th width=""30%"" height=""25"" bgcolor=""#ffffff"" scope=""col""> </th>"
resultFile.Writeline "<th bgcolor=""#ffffff"" scope=""col""> </th>"
resultFile.Writeline "</tr>"
strstyle = "<th width=""30%"" height=""25"" bgcolor=""#ffffff"" scope=""row"">"
End Function
Function TableEnd()
' ,Html
resultFile.Writeline "</table>"
End Function
vbs 판단 운영 체제
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objItem in colItems
strOSVersion = objItem.Version
Next
wscript.echo strOSversion
select case strOSversion
case "5.2.3790"
wscript.echo "Windows Server 2003"
case "5.0.2195"
wscript.echo "Windows 2000"
case "5.1.2600"
wscript.echo "Windows XP"
case "6.0.6001"
wscript.echo "windows visita"
Case "6.1.7601"
wscript.echo "Windows Server 2008 r2"
case else
wscript.echo "i don't know"
end select
vbs 가 랜 내 컴퓨터 의 소프트웨어 와 하드웨어 목록 목록 을 조회 하 는 것 에 관 한 이 글 은 여기까지 소개 되 었 습 니 다.더 많은 관련 조회 소프트웨어 와 하드웨어 목록 내용 은 우리 의 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 조회 하 시기 바 랍 니 다.앞으로 저희 에 게 많은 지원 을 바 랍 니 다!