' ******************************************************************************************* ' Version:3.1 ' Adjust the error handling method, the error message output to the logfile file, you can see the reason for the scan failure ' If the RPC server is not available ' error, because the remote host does not boot ' if the "RPC server is not available" error, may be due to a running program caused, please Tell me about this. ' Reboot once again and scan again to exclude non ' RPC server is not available. "Error ' If the scan to the hardware information is empty, should be the driver (or BIOS is not perfect), please resolve the ' version:3.0 ' increase output BIOS release date, and the motherboard information together ' version:2.9 ' fix all GE
Tinfo Process error handling method to avoid the return of the array upper limit does not conform to the output requirements lead to the foot of this newspaper error.
' The reason for this is that the Win32 class failed to retrieve hardware or connect to the Win32 class, ' originally judged whether err was found, ignoring the fact that the hardware was not retrieved (the connection succeeded without err,count to 0) ' The hardware was not retrieved because the driver was not installed. ' version:2.8 ' adds the Getideprotocol process, gets the protocol used by the IDE controller, just adds code, does not call ' plan to increase the process of retrieving other memory controllers ' version:2.7 ' retrieves the hard drive/video card/NIC /sound card process increases the DeviceID attribute (device identifier) ' This property is not output, used for script internal judgment ' version:2.6 ' original output search to the first hard drive ' to output search to the first InterfaceType property for I De hard drive information ' version:2.5 ' adds sort process, sort hardware information ' version:2.4 ' Adjust output information classification, similar information as far as possible using only a comma separated, so as to import XLS in the same column ' query to the hardware information If it is empty or 0, it is possible that the related driver is imperfect or undefined, or that the driver is not installed because the WMI query represents the details of the system knowing the hardware, and the letter is not foundThe system does not know that the system does not know the details of the hardware, representing the performance may be missing, suggest a good driver to install the ' noteworthy is the motherboard driver ' (for easier understanding, this version of the upgrade information has been edited) ' version:2.3 ' canceled 2.2 Version of the output of the hard drive interface type ' because stat also attributed to the IDE interface, which will lead to misunderstanding ' PS: script only output search to the first hard drive ' version:2.2 ' getmemoryinfo process increase memorytype, Form Factor, typedetail three properties ' output increase memory type, package type ' output increase HDD capacity, interface type ' version:2.1 ' getosinfo process increase remove the comma "," in the caption attribute Code ' reason: When detecting 2003 system, read the Caption property, with a comma ', ' this will affect the output, because the output is comma "," "version:2.0 B5 released version of the" Getnetworkinfo process change To use the MACAddress property Non-empty, ' Manufacturer property not ' Microsoft ' to judge the Nic ' version:2.0 Beta4 ' getnetworkinfo process using Netconnectionstatus property to determine that the network adapter ' Netconnectionstatus property indicates a connection state (2000 system does not support this property) ' physical network adapter has this state (including deactivated state) ' version:2.0 Beta3 ' get The networkinfo process adds a judgment that ' ignoring read ipaddress (0) produces the Err type data adapter (vs platform) ' version:2.0 Beta2 ' getosinfo process used previously by name, SERVICEP Ackmajorversion property ' instead of using caption, CSDVersion property ' all GetInfo process to add error handling code to avoid when scanning ' script encounters run-time error causes script to exit ' Version: 2.0 Beta1 ' Increase scan failure record, running the script again reads only the failed record, ignoring the configuration information ' version:1.1 ' getnetworkinfo process add a judgment ' ignore the NetConnectionID property (interface name) is empty adapter ' version:1.0 ' Initial version Option Explicit ' ************************************** ' Author: lz-myst qq:8450919 ' http://hi.baidu.com/l Zmyst ' http://www.clxp.net.cn ' e-mail:lzmyst@163.com ' You can edit, refer to all or part of the code of the script ' paste, all or part of the code that references the script please keep the copyright ' ************** ' ******************************** description begins ************************************* ' Input format: Starting ip-quantity = Username = password; starting computer name-quantity = Username = Password ' multiple configuration items '; ' Separate ' Example: 192.168.0.1-10 indicates that the IP range is 192.168.0.1~192.168.0.10 and supports cross-network segments ' Example: PC001-10 indicates that the range is pc001~pc010 (computer name can contain-number) ' is not the same as the specified format, The default is a single ip[computer name], or you can configure ' hardware information. txt ' in "no scanned computer. txt" to separate hardware information with commas, you need to import your own XLS to organize, streamline the ' not scanned computer, will be the machine number, user name, password saved to "not scanned computer. txt" ' Running the script again will read only the information in the "not scanned computer. txt" (if present and the size is not 0) ' ******************************** description End ********************************* Dim input, infooutfile, LogFile ' Please assign value to input by format ' input = ' pc021=administrator=cylslynetbar ' input = ' pc001-109=administrator=cylslynetbar;pc110-85=administrator=lyjfnetbaradmin "Infooutfile =" hardware information. txt "LogFile =" Computers not scanned. txt "Redim arrconfig (0) Dim WshShell, FSO, intCount1, IntCount2 intCount1 = 0 IntCount2 = 0 Set Wshsh
ell = WScript.CreateObject ("Wscript.Shell") Set FSO = WScript.CreateObject ("Scripting.FileSystemObject") ReadConfig Wshshell.popup "The scanning process will be slow, please be patient and give a hint when you are done," "Scan start" Linkremoteserver arrconfig Dim LenNum1, LenNum2 If intCount1 > in TCount2 Then LenNum1 = 0 LenNum2 = Len (intCount1)-Len (intCount2) Else LenNum1 = Len (intCount2)-Len (intcount 1) LenNum2 = 0 End If Sort infooutfile wshshell.popup "Scan results:" & _ VbCrLf & VbTab & "Scan succeeded:" & Space (LENNUM1) & IntCount1 & "Set" & _ VbCrLf & VbTab & "Scan failed:" & Space (LENNUM2) &A mp IntCount2 & "Taiwan" & _ VbCrLf & "Scan failed computer has been recorded, run script again only scan record in computer", "Scan complete" Function readconfig Dim ob Jmatches, Objmatche,objlogfile,Arrlog, Intubarrconfig If FSO. FileExists (LogFile) Then If FSO. GetFile (LogFile).
Size = 0 Then Set objmatches = Getmatche ("([^;=]+) = ([^;=]+) = ([^;=]+)", Input) for each objmatche in objmatches GetConfig objmatche.submatches (0), objmatche.submatches (1), objmatche.submatches (2) Next If objmatches.count = 0 Then Msgbox "configuration information is not properly formatted, modify the Wscript.Quit end If Else Set objlogfile = FSO. OpenTextFile (LogFile) do Until objlogfile.atendofstream arrlog = Split (objlogfile.readline, "=") intubarrconf IG = ((Ubound (arrconfig) +1) \3+1) *3-1 Redim Preserve arrconfig (intubarrconfig) arrconfig (intUBarrConfig-2) = ARRL
OG (0) arrconfig (intUBarrConfig-1) = Arrlog (1) arrconfig (intUBarrConfig-0) = Arrlog (2) Loop end If Else Set objmatches = Getmatche ([^;=]+) = ([^;=]+) = ([^;=]+), Input) for each objmatche in Objmatches getconfig Objma Tche. Submatches (0), objmatche.submatches (1), objmatche.submatches (2) Next If ObjmaTches. Count = 0 Then Msgbox "configuration information is not properly formatted, modify the Wscript.Quit End If End Function ' ************************** ' Purpose: To connect to a remote host's WMI namespace ' input: Arrarray array containing computer name [IP], username, password ' Call: Linkserver procedure ' If you return an instance of the SWbemLocator object ConnectServer method, call the Outinfo procedure ' If you return the Err information (string type), output the computer name [IP], user name, password, and error message to LOGFI Le file ' outinfo procedure ' If Return ERR information (string type) output computer name [IP], username, password and error message to logfile file ' pass: SWbemLocator object ConnectServer Method instance passed to Outinfo Procedure ' Computer name [IP], namespace, username, password pass to Linkserver procedure ' ***********************************************************************
Function linkremoteserver (arrarray) Dim Objerrlog, E, Objlinkserver, Objconnection, Objwbemlocator, Objerr Set Objwbemlocator = CreateObject ("WbemScripting.SWbemLocator") Set Objerrlog = FSO. CreateTextFile (logfile,true) for E = 0 to Ubound (arrarray) Step 3 Set objlinkserver = Linkserver (Arrconfig (E), "root\c Imv2 ", Arrconfig (e+1), Arrconfig (e+2)) If Err Then Objerrlog.Writeline Arrarray (E) & "=" & Arrarray (e+1) & "=" & Arrarray (e+2) & "=" & _ "Error number:" & CStr (Err.Number) & _ ", Error Reason:" & CStr (Err.Description) & _ ", Error Source:" & CSt R (Err.Source) & "by Linkserver Function" IntCount2 = intCount2 + 1 err.clear Else objerr = outinfo (obj Linkserver) If Vartype (objerr) = 8 Then objerrlog.writeline arrarray (E) & "=" & Arrarray (e+1) & "=" & Amp Arrarray (e+2) & "=" & objerr IntCount2 = intCount2 + 1 End If End If Next Function ' ********* ' Purpose: Output hardware information ' input: an instance of the SWbemLocator object ConnectServer method ' Call: Get hardware information getxxxinfo procedure ' Pass: SWbemLocator object ConnectServer method ' returns: All invoked GetInfo procedure does not return the Err object, return True '
A GetInfo procedure returns the Err object, returns False ' ****************************************************** Function outinfo (objremote) Dim outfile, Arrinfo, Stroutinfo, TMP, A If FSO. FileExists (infooutFile) Then Set outfile = FSO. OpenTextFile (infooutfile,8) Else Set outfile = FSO.
CreateTextFile (infooutfile) outfile.writeline "Computer name, System (initial date), motherboard model (vendor) (release date), CPU model (interface type), FSB, L2 capacity (Speed)," & _ "Total memory, memory speed (location), Memory type (package type), hard disk model (capacity), graphics card model (video memory), network card, Ip/mac" End If "System arrinfo = Getosinfo (objremote) if Vartype (arr Info) = 8 Then outinfo = arrinfo Exit Function end If stroutinfo = Arrinfo (0) & "," & Arrinfo (1) & " ("& Arrinfo (2) &"), "' Motherboard arrinfo = Getboardinfo (objremote) If Vartype (arrinfo) = 8 Then Outinfo = Arrin Fo Exit Function end If stroutinfo = stroutinfo & Arrinfo (0) & "(& Arrinfo (1) &") "BIOS arr Info = Getbiosinfo (objremote) if Vartype (arrinfo) = 8 Then outinfo = arrinfo Exit Function End If Stroutinfo =
Stroutinfo & "(" & Arrinfo (2) & ")," ' CPU arrinfo = Getcpuinfo (objremote) If Vartype (arrinfo) = 8 Then Outinfo = Arrinfo Exit Function end If Stroutinfo = stroutinfo & Arrinfo (1) & ("& Arrinfo (8) &"), "& Arrinfo (4) &", "& _ Arrinfo ( 6) & "(" & Arrinfo (7) & ")," ' Memory Arrinfo = Getmemoryinfo (objremote) If Vartype (arrinfo) = 8 Then Outi
NFO = Arrinfo Exit Function end If tmp = 0 for A = 1 to Ubound (arrinfo) Step 6 TMP = tmp + Cint (Arrinfo (A)) Next stroutinfo = stroutinfo & Arrinfo (0) & "section, Total & tmp &" M, "TMP =" for A = 2 to Ubound (Arrinfo)
Step 6 If A = Ubound (arrinfo)-4 Then TMP = tmp & Arrinfo (A) & ("& Arrinfo (a+1) &"), "Else TMP = tmp & Arrinfo (A) & ("& Arrinfo (a+1) &") "End If Next stroutinfo = stroutinfo & Tm P TMP = "" For A = 4 to Ubound (arrinfo) Step 6 If A = Ubound (arrinfo)-2 Then TMP = tmp & Arrinfo (A) & "(& Arrinfo (a+1) &)," Else TMP = tmp & Arrinfo (A) & "(" & Arrinfo (a+1) & ")" End I F Next stroutinfo =Stroutinfo & tmp ' hard disk TMP = ' Arrinfo = Getdiskinfo (objremote) If Vartype (arrinfo) = 8 Then Outinfo = Arrin FO Exit Function End If in A = 1 to Ubound (arrinfo) Step 5 If arrinfo (a+1) = "IDE" Then Tmp = Arrinfo (a) &A mp "(& Arrinfo (a+2) &" G), "Exit for End If Next if Tmp =" Then stroutinfo = stroutinfo & "Hard disk model Not retrieved, ' Else stroutinfo = stroutinfo & Tmp end If ' Video arrinfo = Getvideoinfo (objremote) if Vartype (arrinfo = 8 Then outinfo = arrinfo Exit Function end If stroutinfo = stroutinfo & Arrinfo (0) & "(" & Arrin FO (1) & "M)," ' Nic Arrinfo = Getnetworkinfo (objremote) If Vartype (arrinfo) = 8 Then outinfo = Arrinfo Exit Function end If Stroutinfo = Stroutinfo & Arrinfo (1) & "," & Arrinfo (2) & Spaces (17-len (Arrinfo (2)) &A mp Arrinfo (3) ' Output outfile.writeline stroutinfo intCount1 = intCount1 + 1 outinfo = True end Function ' ************ ****************' Purpose: To connect to a remote host's WMI namespace ' input: strComputer: Remote host's computer name or IP ' strnamespace: Command space ' strUserName: With Username ' strpassword: password ' return: Connection succeeded, return instance of object after SWbemLocator class connected to remote host ' connection failed, return Error object ' ***************************************** Function linkserver (Strcomputer,strnamespace,strusername,strpassword) Dim objwbemlocator Set Objwbe Mlocator = CreateObject ("WbemScripting.SWbemLocator") Dim objconnection on Error Resume Next Set objconnection = obj Wbemlocator.connectserver _ (StrComputer, strNameSpace, strUserName, strpassword) If Err Then Set Linkse RVer = Err Exit Function end If on Error Goto 0 objconnection.security_. impersonationlevel = 3 Set linkserver = objconnection end Function ' ****************************************** ' Purpose: Positive Then expression ' input: strpatrn: Regular expression pattern ' strstring: string to execute Regular expression ' return: Match object ' ****************************************** Function Getmatche (STRPATRN, strstring) Dim regex Set regex = New RegExp Regex.global = True regex.ignorecase =true regex.pattern = strpatrn Set Getmatche = Regex.execute (strString) End Function ' *************************************** ' Purpose: 2, 8, 16 into 10 import ' input: Strstring:2, 8, 16 ' Intnum: In-System (2|8| 16) ' Return: 10 in number ' *************************************** Function changetodecimal (strstring, intnum) Changetodecimal = 0 If Isnull (strstring) Then changetodecimal = 0:exit Function Dim A, M for A = 1 to Len (strstring) M = LCase (Mi
D (strstring, A, 1)) Select Case m Case "A": M = Ten case "B": m = one case "C": M = one case "D": M = 13 Case "E": M = d "F": M = end Select Changetodecimal = changetodecimal + M * intnum^ (Len (strstring)-A
) Next End Function
current 1/4 page
1 234 Next read the full text