#include <LocalSecurityAuthority.au3>
Global $feifaruanjian
Global $ipaddress,$Cumputername,$os,$OSLANG,$mac,$feifaruanjian,$admin,$usb,$share,$defaultshare,$autoplay,$cpu,$MEMORY,$Board,$logonname
Local $mdb_data_path=@ScriptDir&"\db.mdb"
Local $tblname="pc_info"
$ipaddress = @IPAddress1
$Cumputername = @ComputerName
$os = @OSVersion&"_"&@OSServicePack
$OSLANG = @OSLang
$logonname = @UserName
;获取MAC地址
$objWMIService = objGet("winmgmts:\" & @ComputerName & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For $objItem in $colItems
If StringLeft($objItem.MACAddress,2) = 00 Then
$mac = $objItem.MACAddress
EndIf
Next
;获取硬件信息
info()
;获取非法软件清单
ckfeifaruanjian()
;获取本机管控状态,Y则表示该项目已管控,N表示未管控
;1.admin清单
$aMember1 = _LsaLocalGroupGetMembers("administrators")
$aMember2 = _LsaLocalGroupGetMembers("POWER USERS")
$adminlist = ""
$powerlist = ""
For $i = 1 To $aMember1[0][0]
$writeline1 = $aMember1[$i][0]
$adminlist =$adminlist&"|"&$writeline1
Next
$admin =$adminlist
;共享判断:
For $j = 1 To $aMember2[0][0]
$powerlist = $aMember2[$j][0]&"(待確認)"&"、"&$powerlist
Next
If $powerlist <> "" Then $share = "N"
If $powerlist = "" Then $share = "Y"
;默认共享判断
$reg = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters","AutoShareWks")
If String($reg) = "0" Then
$defaultshare = "Y"
ElseIf String($reg) = "" Then
$defaultshare = "N"
EndIf
;usb判断
If FileExists(@WindowsDir&"\inf\usbstor.inf") = 1 Or RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR","start") = 00000003 Then
$usb = "N"
ElseIf FileExists(@WindowsDir&"\inf\usbstor.inf") = 0 Then
$usb = "Y"
EndIf
;自动播放判断
If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer","NoDriveTypeAutoRun") <>255 Then
$autoplay = "N"
Else
$autoplay = "Y"
EndIf
;---------------------------------------------------------------------------------------------------------
;数据库操作
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $mdb_data_path & ";Jet Oledb:Database Password= 123456")
$addfld.Execute("insert into pc_info(ip,Cumputername,OS,OSLANG,MAC,MEMORY,cpu,Board,feifaruanjian,usb,share,defaultshare,autoplay,admin,logonname) values('"&$ipaddress&"','"&$Cumputername&"','"&$os&"','"&$OSLANG&"','"&$mac&"','"&$MEMORY&"','"&$cpu&"','"&$Board&"','"&$feifaruanjian&"','"&$usb&"','"&$share&"','"&$defaultshare&"','"&$autoplay&"','"&$admin&"','"&$logonname&"')")
$addfld.close
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;若不用数据库操作代码,用下面的代码保存到TXT档案中,没有问题。
;FileWriteLine(@ScriptDir&"\12.txt",$ipaddress&"|"&$Cumputername&"|"&$os&"|"&$OSLANG&"|"&$mac&"|"&$MEMORY&"|"&$cpu&"|"&$Board&"|"&$feifaruanjian&"|"&$usb&"|"&$share&"|"&$defaultshare&"|"&$autoplay&"|"&$admin&"|"&$logonname)
;常见非法软件清单
Func ckfeifaruanjian()
If FileExists(@ProgramFilesDir &"\WinRAR") Then $feifaruanjian = "WinRAR"
If FileExists(@HomeDrive &"\chenhu2") Then $feifaruanjian = $feifaruanjian&"|"&"陳橋五筆輸入法"
If FileExists(@ProgramFilesDir &"\Kingsoft") Then $feifaruanjian = $feifaruanjian&"|"&"金山公司出品的軟件"
If FileExists(@ProgramFilesDir &"\ACD Systems\ACDSee") Then $feifaruanjian = $feifaruanjian&"|"&"ACDSee系列產品"
If FileExists(@ProgramFilesDir &"\Inventec\Dreye") Then $feifaruanjian = $feifaruanjian&"|"&"翻譯軟件:譯典通"
If FileExists(@ProgramFilesDir &"\Super Rabbit") Then $feifaruanjian = $feifaruanjian&"|"&"魔法兔子"
If FileExists(@ProgramFilesDir &"\Rising") Then $feifaruanjian = $feifaruanjian&"|"&"瑞星公司出品的軟件"
If FileExists(@ProgramFilesDir &"\Wopti") Then $feifaruanjian = $feifaruanjian&"|"&"優化大師"
If $feifaruanjian ="" Then $feifaruanjian = "NULL"
EndFunc
;内存,CPU,主板信息
Func info()
Global $objWMIService,$colBios,$colBoard,$colSettings,$colMemory,$colCPU,$colVideoinfo,$colSound ,$colNIC
Local $object,$objOperatingSystem
$objWMIService = objget("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colBoard = $objWMIService.ExecQuery("SELECT * FROM Win32_BaseBoard")
$colMemory = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
$colCPU = $objWMIService.ExecQuery("Select * from CIM_Processor")
For $object in $colCPU
$cpu = StringStripWS($object.Name,1)
Next
For $object in $colBoard
$Board = $object.Product
Next
for $object in $colMemory
$MEMORY = Int(Int(Number($object.TotalPhysicalMemory) / (1024 * 1024))+1)
Next
EndFunc ;==>Info()