Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

gatherNetworkInfo.vbs

By: hackoo on May 8th, 2012  |  syntax: VisualBasic  |  size: 39.60 KB  |  views: 450  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Dim FSO, shell, xslProcessor
  2.  
  3. Sub RunCmd(CommandString, OutputFile)
  4.         cmd = "cmd /c " + CommandString + " >> " + OutputFile
  5.         shell.Run cmd, 0, True
  6. End Sub
  7.  
  8. Sub GetOSInfo(outputFileName)
  9.     On Error Resume Next
  10.     strComputer = "."
  11.     HKEY_LOCAL_MACHINE = &H80000002
  12.  
  13.     Dim objReg, outputFile
  14.     Dim buildDetailNames, buildDetailRegValNames
  15.  
  16.     buildDetailNames = Array("Product Name", "Version", "Build Lab", "Type")
  17.     buildDetailRegValNames = Array("ProductName", "CurrentVersion", "BuildLabEx", "CurrentType")
  18.  
  19.     Set outputFile = FSO.OpenTextFile(outputFileName, 2, True)
  20.  
  21.     Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
  22.                      strComputer & "\root\default:StdRegProv")
  23.  
  24.     outputFile.WriteLine("[Architecture/Processor Information]")
  25.     outputFile.WriteLine()
  26.     outputFile.Close
  27.     cmd = "cmd /c set processor >> " & outputFileName
  28.     shell.Run cmd, 0, True
  29.  
  30.     Set outputFile = FSO.OpenTextFile(outputFileName, 8, True)
  31.  
  32.     outputFile.WriteLine()
  33.     outputFile.WriteLine("[Operating System Information]")
  34.     outputFile.WriteLine()
  35.  
  36.     strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
  37.     for I = 0 to UBound(buildDetailNames)
  38.         objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, buildDetailRegValNames(I), info
  39.         outputFile.WriteLine(buildDetailNames(I) + " = " + info)
  40.     Next
  41.  
  42.     outputFile.WriteLine()
  43.     strKeyPath = "SYSTEM\SETUP"
  44.     objReg.GetDWordValue HKEY_LOCAL_MACHINE, strKeyPath, "Upgrade", upgradeInfo
  45.     if IsNull(upgradeInfo) Then
  46.         outputFile.WriteLine("This is a clean installed system")
  47.     Else
  48.         outputFile.WriteLine("This is an upgraded system")
  49.     End If
  50.  
  51.     outputFile.WriteLine(buildDetailNames(I) + " = " + info)
  52.  
  53.     outputFile.WriteLine()
  54.     outputFile.WriteLine("[File versions]")
  55.     outputFile.WriteLine()
  56.  
  57.     Set shell = WScript.CreateObject( "WScript.Shell" )
  58.     windir = shell.ExpandEnvironmentStrings("%windir%\system32\")
  59.  
  60.     Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  61.  
  62.     Dim FileSet
  63.     FileSet = Array("onex.dll", "l2nacp.dll", "wlanapi.dll", "wlancfg.dll", "wlanconn.dll", "wlandlg.dll", "wlanext.exe", "wlangpui.dll", "wlanhc.dll", "wlanhlp.dll", "wlaninst.dll", "wlanmm.dll", "wlanmmhc.dll", "wlanmsm.dll", "wlanpref.dll", "wlansec.dll", "wlansvc.dll", "wlanui.dll")
  64.  
  65.     For Each file in FileSet
  66.         filename = windir + file
  67.         strQuery = "Select * from CIM_Datafile Where Name = '" + Replace(filename, "\", "\\") + "'"
  68.         Set fileProp = objWMIService.ExecQuery _
  69.             (strQuery)
  70.  
  71.         For Each objFile in fileProp
  72.             outputFile.WriteLine(file + "    " + objFile.Version)
  73.         Next
  74.     Next
  75.  
  76.     Dim Dot3FileSet
  77.     Dot3FileSet = Array("onex.dll", "dot3api.dll", "dot3cfg.dll", "dot3dlg.dll", "dot3gpclnt.dll", "dot3gpui.dll", "dot3msm.dll", "dot3svc.dll", "dot3ui.dll")
  78.  
  79.     For Each file in Dot3FileSet
  80.         filename = windir + file
  81.         strQuery = "Select * from CIM_Datafile Where Name = '" + Replace(filename, "\", "\\") + "'"
  82.         Set fileProp = objWMIService.ExecQuery _
  83.             (strQuery)
  84.  
  85.         For Each objFile in fileProp
  86.             outputFile.WriteLine(file + "    " + objFile.Version)
  87.         Next
  88.     Next
  89.  
  90.     call GetBatteryInfo(outputFile)
  91.     outputFile.Close
  92.  
  93.     Set outputFile = FSO.OpenTextFile(outputFileName, 8, True)
  94.     outputFile.WriteLine("")
  95.     outputFile.WriteLine("[System Information]")
  96.     outputFile.WriteLine("")
  97.     outputFile.Close
  98.  
  99.     'Comments: Dumping System Information using "systeminfo" command
  100.  
  101.     cmd = "cmd /c systeminfo >> " & outputFileName
  102.     shell.Run cmd, 0, True
  103.  
  104.     Set outputFile = FSO.OpenTextFile(outputFileName, 8, True)
  105.     outputFile.WriteLine("")
  106.     outputFile.WriteLine("[User Information]")
  107.     outputFile.WriteLine("")
  108.     outputFile.Close
  109.  
  110.     cmd = "cmd /c set u >> " & outputFileName
  111.     shell.Run cmd, 0, True
  112.  
  113. End Sub
  114.  
  115. Sub GetBatteryInfo(outputFile)
  116.     On Error Resume Next
  117.     strComputer = "."
  118.     outputFile.WriteLine()
  119.     outputFile.WriteLine("[Power Information]")
  120.     outputFile.WriteLine()
  121.     Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  122.     Set colItems = objWMIService.ExecQuery("Select * from Win32_Battery")
  123.     if colItems.Count = 0 Then
  124.         outputFile.WriteLine("It is a Desktop running on AC")
  125.     Else
  126.     For Each objItem in colItems
  127.         if objItem.Availability = 2 Then
  128.             outputFile.WriteLine("Machine is running on AC Adapter")
  129.         Else
  130.             if objitem.Availability = 3 Then
  131.                 outputFile.WriteLine("Machine is running on Battery")
  132.             End If
  133.         End If
  134.     Next
  135.     End If
  136. End Sub
  137.  
  138.  
  139.  
  140. Sub GetWcnInfo(outputFileName)
  141.     On Error Resume Next
  142.     Dim WcnInfoFile
  143.  
  144.     Set WcnInfoFile= FSO.OpenTextFile(outputFileName, 8, True)
  145.     WcnInfoFile.WriteLine("-------------------------------------")
  146.     WcnInfoFile.WriteLine("---------+ WCN Information +---------")    
  147.     WcnInfoFile.WriteLine("-------------------------------------")    
  148.     WcnInfoFile.WriteLine("")
  149.     WcnInfoFile.WriteLine("")
  150.     WcnInfoFile.WriteLine("-----------------")
  151.     WcnInfoFile.WriteLine("+ Services Status")
  152.     WcnInfoFile.WriteLine("-----------------")
  153.     WcnInfoFile.WriteLine("")
  154.     WcnInfoFile.Close
  155.  
  156.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  157.  
  158.     cmd = "cmd /c sc query wcncsvc  >> " & outputFileName
  159.     objShell.Run cmd, 0, True
  160.  
  161.     cmd = "cmd /c sc query wlansvc  >> " & outputFileName
  162.     objShell.Run cmd, 0, True
  163.  
  164.     cmd = "cmd /c sc query eaphost  >> " & outputFileName
  165.     objShell.Run cmd, 0, True
  166.  
  167.     cmd = "cmd /c sc query fdrespub  >> " & outputFileName
  168.     objShell.Run cmd, 0, True
  169.  
  170.     cmd = "cmd /c sc query upnphost   >> " & outputFileName
  171.     objShell.Run cmd, 0, True
  172.  
  173.     cmd = "cmd /c sc query eaphost  >> " & outputFileName
  174.     objShell.Run cmd, 0, True
  175.  
  176.  
  177.     Set WcnInfoFile= FSO.OpenTextFile(outputFileName, 8, True)
  178.     WcnInfoFile.WriteLine("")
  179.     WcnInfoFile.WriteLine("")
  180.     WcnInfoFile.WriteLine("-----------------------")
  181.     WcnInfoFile.WriteLine("+ WCN Files Information ")
  182.     WcnInfoFile.WriteLine("-----------------------")
  183.     WcnInfoFile.WriteLine("")
  184.  
  185.     strComputer = "."
  186.  
  187.     Set shell = WScript.CreateObject( "WScript.Shell" )
  188.     windir = shell.ExpandEnvironmentStrings("%windir%\system32\")
  189.  
  190.     Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  191.  
  192.     Dim FileSet
  193.     FileSet = Array("wcncsvc.dll", "wcnapi.dll", "fdwcn.dll", "wcneapauthproxy.dll", "wcneappeerproxy.dll", "wcnwiz.dll", "wcnnetsh.dll", "wczdlg.dll")
  194.  
  195.     For Each file in FileSet
  196.         filename = windir + file
  197.         strQuery = "Select * from CIM_Datafile Where Name = '" + Replace(filename, "\", "\\") + "'"
  198.         Set fileProp = objWMIService.ExecQuery _
  199.             (strQuery)
  200.  
  201.         For Each objFile in fileProp
  202.                 WcnInfoFile.WriteLine("")
  203.                 WcnInfoFile.WriteLine("---------------------")
  204.                 WcnInfoFile.WriteLine(file)
  205.                 WcnInfoFile.WriteLine("---------------------")
  206.                 WcnInfoFile.WriteLine(" - Version               :       " + objFile.Version )
  207.                 WcnInfoFile.WriteLine(" - Creation Date         :       " + objFile.CreationDate  )
  208.                 WcnInfoFile.WriteLine(" - Description           :       " + objFile.Description  )
  209.                 WcnInfoFile.WriteLine(" - Installation Date     :       " +  objFile.InstallDate )
  210.                 WcnInfoFile.WriteLine(" - In Use Count          :       " + objFile.InUseCount   )
  211.                 WcnInfoFile.WriteLine(" - Last Accessed         :       " + objFile.LastAccessed  )
  212.                 WcnInfoFile.WriteLine(" - Last Modified         :       " + objFile.LastModified  )
  213.                 WcnInfoFile.WriteLine(" - Status                :       " + objFile.Status  )
  214.         Next
  215.     Next
  216.  
  217.  
  218.  
  219.  
  220.     WcnInfoFile.WriteLine("")
  221.     WcnInfoFile.WriteLine("")
  222.     WcnInfoFile.WriteLine("-------------------------------")
  223.     WcnInfoFile.WriteLine("+ Network Adapters Information ")
  224.     WcnInfoFile.WriteLine("-------------------------------")
  225.     WcnInfoFile.WriteLine("")
  226.  
  227.     strQuery = "Select * from Win32_NetworkAdapter "
  228.    
  229.     Set AdapterProp = objWMIService.ExecQuery _
  230.             (strQuery)
  231.  
  232.  
  233.     For Each objFile in AdapterProp
  234.         WcnInfoFile.WriteLine("")
  235.         WcnInfoFile.WriteLine("---------------------")
  236.         WcnInfoFile.WriteLine("DeviceID  :  " + objFile.DeviceID   )
  237.         WcnInfoFile.WriteLine("---------------------")
  238.         WcnInfoFile.WriteLine(" - Adapter Type          :       " + objFile.AdapterType  )
  239.         WcnInfoFile.WriteLine(" - Auto Sense                    :       " + objFile.AutoSense )
  240.         WcnInfoFile.WriteLine(" - Description           :       " + objFile.Description   )
  241.         WcnInfoFile.WriteLine(" - NetConnectionID       :       " + objFile.NetConnectionID   )
  242.         WcnInfoFile.WriteLine(" - GUID                  :       " + objFile.GUID )
  243.         WcnInfoFile.WriteLine(" - MACAddress            :       " + objFile.MACAddress  )
  244.         WcnInfoFile.WriteLine(" - Manufacturer          :       " + objFile.Manufacturer   )
  245.         WcnInfoFile.WriteLine(" - MaxSpeed      :       " + objFile.MaxSpeed    )
  246.         WcnInfoFile.WriteLine(" - Speed                 :       " +  objFile.Speed    )
  247.         WcnInfoFile.WriteLine(" - Name                  :       " + objFile.Name     )
  248.        
  249.         Select Case objFile.NetConnectionStatus
  250.                 Case 0    strAvail= "Disconnected"                     
  251.                 Case 1    strAvail= "Connecting"
  252.                 Case 2  strAvail= "Connected"
  253.                 Case 3  strAvail= "Disconnecting"
  254.                 Case 4  strAvail= "Hardware not present"
  255.                 Case 5  strAvail= "Hardware disabled"
  256.                 Case 6  strAvail= "Hardware malfunction"                       
  257.                 Case 7  strAvail= "Media disconnected"
  258.                 Case 8  strAvail= "Authenticating"
  259.                 Case 9  strAvail= "Authentication succeeded"
  260.                 Case 10         strAvail= "Authentication failed"
  261.                 Case 11         strAvail= "Invalid address"                    
  262.                 Case 12 strAvail= "Credentials required"
  263.         End Select
  264.  
  265.  
  266.         WcnInfoFile.WriteLine(" - NetConnectionStatus   :       " + strAvail )
  267.         WcnInfoFile.WriteLine(" - NetEnabled    :       " +  objFile.NetEnabled  )
  268.         WcnInfoFile.WriteLine(" - NetworkAddresses      :       " +  objFile.NetworkAddresses  )
  269.         WcnInfoFile.WriteLine(" - PermanentAddress      :       " +  objFile.PermanentAddress   )
  270.         WcnInfoFile.WriteLine(" - PhysicalAdapter       :       " +  objFile.PhysicalAdapter   )
  271.         WcnInfoFile.WriteLine(" - PNPDeviceID           :       " +  objFile.PNPDeviceID    )
  272.         WcnInfoFile.WriteLine(" - ProductName           :       " +  objFile.ProductName     )
  273.         WcnInfoFile.WriteLine(" - ServiceName           :       " +  objFile.ServiceName      )
  274.  
  275.         WcnInfoFile.WriteLine(" - SystemName            :       " + objFile.SystemName       )
  276.         WcnInfoFile.WriteLine(" - TimeOfLastReset       :       " + objFile.TimeOfLastReset )
  277.         WcnInfoFile.WriteLine(" - Status        :       " + objFile.Status      )
  278.  
  279.         Select Case objFile.StatusInfo  
  280.                 Case 1    strAvail= "Other"
  281.                 Case 2  strAvail= "Unknown"
  282.                 Case 3  strAvail= "Enabled"
  283.                 Case 4  strAvail= "Disabled"
  284.                 Case 5  strAvail= "Not Applicable"
  285.         End Select
  286.                
  287.         WcnInfoFile.WriteLine(" - StatusInfo            :       " + strAvail )
  288.                
  289.        Select Case objFile.Availability
  290.                 Case 1    strAvail= "Other"
  291.                 Case 2  strAvail= "Unknown"
  292.                 Case 3  strAvail= "Running or Full Power"
  293.                 Case 4  strAvail= "Warning"
  294.                 Case 5  strAvail= "In test"
  295.                 Case 6  strAvail= "Not Applicable"
  296.                 Case 7  strAvail= "Power Off"
  297.                 Case 8  strAvail= "Off Line"
  298.                 Case 9  strAvail= "Off Duty"
  299.                 Case 10         strAvail= "Degraded"
  300.                 Case 11         strAvail= "Not Installed"
  301.                 Case 12 strAvail= "Install Error"
  302.                 Case 13         strAvail= "Power Save - Unknown"
  303.                 Case 14         strAvail= "Power Save - Low Power Mode"
  304.                 Case 15         strAvail= "Power Save - Standby"
  305.                 Case 16         strAvail= "Power Cycle"
  306.                 Case 17         strAvail= "Power Save - Warning"
  307.         End Select
  308.  
  309.         WcnInfoFile.WriteLine(" - Availability          :       " + strAvail ) 
  310.         WcnInfoFile.WriteLine(" - Caption               :       " +  objFile.Caption ) 
  311.  
  312.        Select Case objFile.ConfigManagerErrorCode
  313.                 Case 0    strAvail= "Device is working properly"
  314.                 Case 1  strAvail= "Device is not configured correctly"
  315.                 Case 2  strAvail= "Windows cannot load the driver for this device"
  316.                 Case 3  strAvail= "Driver for this device might be corrupted, or the system may be low on memory or other resources"           
  317.                 Case 4  strAvail= "Device is not working properly. One of its drivers or the registry might be corrupted."
  318.                 Case 5  strAvail= "Driver for the device requires a resource that Windows cannot manage."
  319.                 Case 6  strAvail= "Boot configuration for the device conflicts with other devices"
  320.                 Case 7  strAvail= "Cannot filter"
  321.                 Case 8  strAvail= "Driver loader for the device is missing"
  322.                 Case 9  strAvail= "Device is not working properly. The controlling firmware is incorrectly reporting the resources for the device"
  323.                 Case 10         strAvail= "Device cannot start"
  324.                 Case 11  strAvail= "Device failed"
  325.                 Case 12 strAvail= "Device cannot find enough free resources to use"
  326.                 Case 13 strAvail= "Windows cannot verify the device's resources"
  327.                 Case 14 strAvail= "Device cannot work properly until the computer is restarted"
  328.                 Case 15 strAvail= "Device is not working properly due to a possible re-enumeration problem"
  329.                 Case 16 strAvail= "Windows cannot identify all of the resources that the device uses"
  330.                 Case 17 strAvail= "Device is requesting an unknown resource type."
  331.                 Case 18 strAvail= "Device drivers must be reinstalled"
  332.                 Case 19 strAvail= "Failure using the VxD loader"
  333.                 Case 20 strAvail= "Registry might be corrupted."
  334.                 Case 21 strAvail= "System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device"
  335.                 Case 22 strAvail= "Device is disabled"
  336.                 Case 23 strAvail= "System failure. If changing the device driver is ineffective, see the hardware documentation"
  337.                 Case 24 strAvail= "Device is not present, not working properly, or does not have all of its drivers installed."
  338.                 Case 25 strAvail= "Windows is still setting up the device"
  339.                 Case 27 strAvail= "Device does not have valid log configuration."
  340.                 Case 28 strAvail= "Device drivers are not installed."
  341.                 Case 29 strAvail= "Device is disabled. The device firmware did not provide the required resources."
  342.                 Case 30 strAvail= "Device is using an IRQ resource that another device is using."
  343.                 Case 31 strAvail= "Device is not working properly. Windows cannot load the required device drivers."                   
  344.         End Select
  345.  
  346.         WcnInfoFile.WriteLine(" - ConfigManagerErrorCode:       " + strAvail )
  347.         WcnInfoFile.WriteLine(" - Error Cleared         :       " + objFile.ErrorCleared )
  348.         WcnInfoFile.WriteLine(" - Error Description     :       " + objFile.ErrorDescription)
  349.         WcnInfoFile.WriteLine(" - LastErrorCode         :       " + objFile.LastErrorCode)
  350.         WcnInfoFile.WriteLine(" - Index                 :       " + objFile.Index)
  351.         WcnInfoFile.WriteLine(" - Installed     :       " + objFile.Installed  )
  352.         WcnInfoFile.WriteLine(" - Install Date          :       " + objFile.InstallDate   )                            
  353.         WcnInfoFile.WriteLine(" - InterfaceIndex        :       " + objFile.InterfaceIndex )   
  354.     Next
  355.     WcnInfoFile.Close
  356.  
  357.  
  358.  
  359.  
  360.  
  361.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  362.     WcnInfoFile.WriteLine("")
  363.     WcnInfoFile.WriteLine("-----------------------")
  364.     WcnInfoFile.WriteLine("+ ipconfig information")
  365.     WcnInfoFile.WriteLine("-----------------------")
  366.     WcnInfoFile.WriteLine("")
  367.     WcnInfoFile.Close
  368.  
  369.  
  370.     cmd = "cmd /c ipconfig /all >> " & outputFileName
  371.     objShell.Run cmd, 0, True
  372.  
  373.  
  374.  
  375.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  376.     WcnInfoFile.WriteLine("")    
  377.     WcnInfoFile.WriteLine("----------------------")
  378.     WcnInfoFile.WriteLine("+ Softap Capabilities ")
  379.     WcnInfoFile.WriteLine("----------------------")
  380.     WcnInfoFile.WriteLine("")
  381.     WcnInfoFile.Close
  382.  
  383.     cmd = "cmd /c netsh wlan show device >> " & outputFileName
  384.     objShell.Run cmd, 0, True
  385.  
  386.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  387.     WcnInfoFile.WriteLine("")    
  388.     WcnInfoFile.WriteLine("----------------------")
  389.     WcnInfoFile.WriteLine("+ Dump wcncsvc RegKey ")
  390.     WcnInfoFile.WriteLine("----------------------")
  391.     WcnInfoFile.WriteLine("")
  392.     WcnInfoFile.Close
  393.  
  394.     cmd = "cmd /c reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wcncsvc\Parameters >> " & outputFileName
  395.     objShell.Run cmd, 0, True
  396.  
  397.  
  398.  
  399. '    Set shell = WScript.CreateObject( "WScript.Shell" )
  400. '    windir = shell.ExpandEnvironmentStrings("%windir%\system32\")
  401. '    filename = windir + "wcnwiz.dll"
  402. '    commandname = windir + "rundll32.exe"
  403.  
  404. '    cmd = "cmd /c "& commandname &" "& filename &" , RunDumpWcnCache >> " & outputFileName
  405. '    objShell.Run cmd, 0, True
  406.  
  407.  
  408.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  409.     WcnInfoFile.WriteLine("")    
  410.     WcnInfoFile.WriteLine("--------------------------------")
  411.     WcnInfoFile.WriteLine("+ Network Discovery Information.")
  412.     WcnInfoFile.WriteLine("--------------------------------")
  413.     WcnInfoFile.WriteLine("")
  414.     WcnInfoFile.WriteLine("")
  415.     WcnInfoFile.WriteLine("------------------------------")    
  416.     WcnInfoFile.WriteLine("- Current Profile information")
  417.     WcnInfoFile.WriteLine("------------------------------")    
  418.     WcnInfoFile.WriteLine("")
  419.  
  420.     ' Profile Type
  421.    Const NET_FW_PROFILE2_DOMAIN = 1
  422.     Const NET_FW_PROFILE2_PRIVATE = 2
  423.     Const NET_FW_PROFILE2_PUBLIC = 4
  424.  
  425.     ' Direction  
  426.    Const NET_FW_RULE_DIR_IN = 1
  427.     Const NET_FW_RULE_DIR_OUT = 2
  428.  
  429.  
  430.     ' Create the FwPolicy2 object.
  431.    Dim fwPolicy2    
  432.     Dim ProfileType
  433.     ProfileType = Array("Domain", "Private", "Public")
  434.  
  435.     Set fwPolicy2 = CreateObject("HNetCfg.FwPolicy2")
  436.  
  437.     CurrentProfile = fwPolicy2.CurrentProfileTypes
  438.  
  439.     WcnInfoFile.WriteLine ("Current firewall profile is: ")
  440.  
  441.     '// The returned 'CurrentProfiles' bitmask can have more than 1 bit set if multiple profiles
  442.    '//   are active or current at the same time
  443.  
  444.     if ( CurrentProfile AND NET_FW_PROFILE2_DOMAIN ) then
  445.         WcnInfoFile.WriteLine(ProfileType(0))
  446.     end if
  447.  
  448.     if ( CurrentProfile AND NET_FW_PROFILE2_PRIVATE ) then
  449.         WcnInfoFile.WriteLine(ProfileType(1))
  450.     end if
  451.  
  452.     if ( CurrentProfile AND NET_FW_PROFILE2_PUBLIC ) then
  453.         WcnInfoFile.WriteLine(ProfileType(2))
  454.     end if
  455.     WcnInfoFile.Close
  456.  
  457.  
  458.     cmd = "cmd /c netsh advfirewall show currentprofile >> " & outputFileName
  459.     objShell.Run cmd, 0, True
  460.  
  461.  
  462.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  463.     WcnInfoFile.WriteLine("")
  464.     WcnInfoFile.WriteLine("----------------------------------------------")    
  465.     WcnInfoFile.WriteLine("- Network discovery status for current profile")
  466.     WcnInfoFile.WriteLine("----------------------------------------------")    
  467.     WcnInfoFile.WriteLine("")              
  468.  
  469.     Dim rule
  470.     ' Get the Rules object
  471.    Dim RulesObject
  472.     Set RulesObject = fwPolicy2.Rules
  473.  
  474.    
  475.     For Each rule In Rulesobject
  476.         if rule.Grouping = "@FirewallAPI.dll,-32752" then
  477.                 WcnInfoFile.WriteLine("")
  478.                 WcnInfoFile.WriteLine("  Rule Name:          " & rule.Name)
  479.                 WcnInfoFile.WriteLine("   ----------------------------------------------")
  480.                 WcnInfoFile.WriteLine("  Enabled:            " & rule.Enabled)
  481.                 WcnInfoFile.WriteLine("  Description:        " & rule.Description)
  482.                 WcnInfoFile.WriteLine("  Application Name:   " & rule.ApplicationName)
  483.                 WcnInfoFile.WriteLine("  Service Name:       " & rule.ServiceName)
  484.  
  485.         Select Case rule.Direction
  486.                     Case NET_FW_RULE_DIR_IN  WcnInfoFile.WriteLine("  Direction:          In")
  487.              Case NET_FW_RULE_DIR_OUT WcnInfoFile.WriteLine("  Direction:          Out")
  488.                 End Select
  489.        
  490.         end if
  491.     Next
  492.  
  493.     WcnInfoFile.Close
  494.  
  495.    
  496.    
  497. End Sub
  498.  
  499.  
  500.  
  501. Sub GetWirelessAdapterInfo(outputFile)
  502.     On Error Resume Next
  503.     Dim adapters, objReg
  504.     Dim adapterDetailNames, adapterDetailRegValNames
  505.  
  506.     adapterDetailNames = Array("Driver Description", "Adapter Guid", "Hardware ID", "Driver Date", "Driver Version", "Driver Provider")
  507.     adapterDetailRegValNames = Array("DriverDesc", "NetCfgInstanceId", "MatchingDeviceId", "DriverDate", "DriverVersion", "ProviderName")
  508.  
  509.     IHVDetailNames = Array("ExtensibilityDLL", "UIExtensibilityCLSID", "GroupName", "DiagnosticsID")
  510.     IHVDetailRegValNames = Array("ExtensibilityDLL", "UIExtensibilityCLSID", "GroupName", "DiagnosticsID")
  511.  
  512.     HKEY_LOCAL_MACHINE = &H80000002
  513.     strComputer = "."
  514.  
  515.     Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
  516.                      strComputer & "\root\default:StdRegProv")
  517.  
  518.  
  519.     strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
  520.  
  521.     objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, adapterSet
  522.  
  523.     For Each adapter In adapterSet
  524.         If StrComp("Properties", adapter) Then
  525.             fullstrKeyPath = strKeyPath + adapter
  526.             objReg.GetDWORDValue HKEY_LOCAL_MACHINE, fullstrKeyPath, "*IfType", ifType
  527.             If ifType = 71 Then
  528.                 for I = 0 to UBound(adapterDetailNames)
  529.                     objReg.GetStringValue HKEY_LOCAL_MACHINE, fullstrKeyPath, adapterDetailRegValNames(I), info
  530.                     outputFile.WriteLine(adapterDetailNames(I) + " = " + info)
  531.                 Next
  532.  
  533.                 ihvKeyPath = fullstrKeyPath + "\Ndi\IHVExtensions"
  534.                 For J = 0 to UBound(IHVDetailNames)
  535.                     objReg.GetStringValue HKEY_LOCAL_MACHINE, ihvKeyPath, IHVDetailRegValNames(J), ihvInfo
  536.                     outputFile.WriteLine(IHVDetailNames(J) + " = " + ihvInfo)
  537.                 Next
  538.                     objReg.GetDWordValue HKEY_LOCAL_MACHINE, ihvKeyPath, "AdapterOUI", ihvInfo
  539.                     outputFile.WriteLine("AdapterOUI = " + CSTR(ihvInfo))
  540.                 outputFile.WriteLine()
  541.             End If
  542.         End If
  543.     Next
  544.  
  545.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  546.  
  547.     tempFile = "tempfile.txt"
  548.     cmd = "cmd /c tasklist > " & tempFile
  549.     objShell.Run cmd, 0, True
  550.  
  551.     Set objTextFile = FSO.OpenTextFile(tempFile, 1)
  552.     strIHVOutput = objTextFile.ReadAll()
  553.  
  554.     Set regEx = New RegExp
  555.     regEx.Pattern = "^wlanext.exe[\s|a-z|A-Z|\d]*"
  556.     regEx.Multiline = True
  557.     regEx.IgnoreCase = True
  558.     regEx.Global = True
  559.  
  560.     Set Matches = regEx.Execute(strIHVOutput)
  561.  
  562.     For Each match in Matches
  563.         outputFile.WriteLine(match.Value)
  564.     Next
  565.  
  566. End Sub
  567.  
  568. Sub GetWirelessAutoconfigLog(logFileName)
  569.     On Error Resume Next
  570.  
  571.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  572.  
  573.     'Export the operational log
  574.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-WLAN-AutoConfig/Operational"" " & logFileName
  575.     objShell.Run cmd, 0, True  
  576.  
  577.     'Archive the log so that it can be read on different machines
  578.    cmd = "cmd /c wevtutil al " & logFileName
  579.     objShell.Run cmd, 0, True  
  580. End Sub
  581.  
  582. Sub GetWiredAdapterInfo(outputFile)
  583.     On Error Resume Next
  584.     Dim adapters, objReg
  585.     Dim adapterDetailNames, adapterDetailRegValNames
  586.  
  587.     adapterDetailNames = Array("Driver Description", "Adapter Guid", "Hardware ID", "Driver Date", "Driver Version", "Driver Provider")
  588.     adapterDetailRegValNames = Array("DriverDesc", "NetCfgInstanceId", "MatchingDeviceId", "DriverDate", "DriverVersion", "ProviderName")
  589.  
  590.  
  591.     HKEY_LOCAL_MACHINE = &H80000002
  592.     strComputer = "."
  593.  
  594.     Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
  595.                      strComputer & "\root\default:StdRegProv")
  596.  
  597.  
  598.     strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
  599.  
  600.     objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, adapterSet
  601.  
  602.     For Each adapter In adapterSet
  603.         If StrComp("Properties", adapter) Then
  604.             fullstrKeyPath = strKeyPath + adapter
  605.             objReg.GetDWORDValue HKEY_LOCAL_MACHINE, fullstrKeyPath, "*IfType", ifType
  606.             If ifType = 6 Then
  607.                 for I = 0 to UBound(adapterDetailNames)
  608.                     objReg.GetStringValue HKEY_LOCAL_MACHINE, fullstrKeyPath, adapterDetailRegValNames(I), info
  609.                     outputFile.WriteLine(adapterDetailNames(I) + " = " + info)
  610.                 Next
  611.                 outputFile.WriteLine()
  612.             End If
  613.         End If
  614.     Next
  615. End Sub
  616.  
  617.  
  618. Sub GetEnvironmentInfo(outputFileName)
  619.     On Error Resume Next
  620.     Dim envInfoFile
  621.  
  622.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  623.  
  624.     cmd = "cmd /c netsh wlan show all > " & outputFileName
  625.     objShell.Run cmd, 0, True
  626.  
  627.     cmd = "cmd /c netsh lan show interfaces >> " & outputFileName
  628.     objShell.Run cmd, 0, True
  629.  
  630.     cmd = "cmd /c netsh lan show settings >> " & outputFileName
  631.     objShell.Run cmd, 0, True
  632.  
  633.     cmd = "cmd /c netsh lan show profiles >> " & outputFileName
  634.     objShell.Run cmd, 0, True
  635.  
  636.     cmd = "cmd /c ipconfig /all >> " & outputFileName
  637.     objShell.Run cmd, 0, True
  638.  
  639.     RunCmd "echo.", outputFileName
  640.     RunCmd "echo ROUTE PRINT:", outputFileName
  641.     RunCmd "route print", outputFileName
  642.    
  643.     Set envInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  644.     envInfoFile.WriteLine("")
  645.     envInfoFile.WriteLine("Machine certificates...")
  646.     envInfoFile.WriteLine("")
  647.     envInfoFile.Close
  648.  
  649.     cmd = "cmd /c certutil -v -store -silent My >> " & outputFileName
  650.     objShell.Run cmd, 0, True
  651.  
  652.     Set envInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  653.     envInfoFile.WriteLine("")
  654.     envInfoFile.WriteLine("User certificates...")
  655.     envInfoFile.WriteLine("")
  656.     envInfoFile.Close
  657.  
  658.     cmd = "cmd /c certutil -v -store -silent -user My >> " & outputFileName
  659.     objShell.Run cmd, 0, True
  660. End Sub
  661.  
  662. 'Comments: Function to dump a tree under a registry path into a file
  663. Sub DumpRegKey(outputFileName,regpath)
  664.     On Error Resume Next
  665.     Dim cmd
  666.  
  667.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  668.  
  669.     cmd = "cmd /c reg export " & regpath & "  " & outputFileName & " /y"
  670.     objShell.Run cmd, 0, True
  671.  
  672. End Sub
  673.  
  674. Sub DumpAllKeys
  675.     On Error Resume Next
  676.     Dim NotifRegFile, RegFolder, Key
  677.  
  678.     RegFolder = "Reg"
  679.  
  680.     if Not FSO.FolderExists(RegFolder) Then
  681.        FSO.CreateFolder RegFolder
  682.     End If
  683.  
  684.         ' Dump WLAN registry keys
  685.    AllCredRegFile = RegFolder + "\AllCred.reg.txt"
  686.     AllCredFilterFile = RegFolder + "\AllCredFilter.reg.txt"
  687.     CredRegFileA = RegFolder + "\{07AA0886-CC8D-4e19-A410-1C75AF686E62}.reg.txt"
  688.     CredRegFileB = RegFolder + "\{33c86cd6-705f-4ba1-9adb-67070b837775}.reg.txt"
  689.     CredRegFileC = RegFolder + "\{edd749de-2ef1-4a80-98d1-81f20e6df58e}.reg.txt"
  690.     APIPermRegFile = RegFolder + "\APIPerm.reg.txt"
  691.     NotifRegFile = RegFolder + "\Notif.reg.txt"
  692.     GPTRegFile = RegFolder + "\GPT.reg.txt"
  693.     CUWlanSvcRegFile = RegFolder + "\HKCUWlanSvc.reg.txt"
  694.     LMWlanSvcRegFile = RegFolder + "\HKLMWlanSvc.reg.txt"
  695.     NidRegFile = RegFolder + "\NetworkProfiles.reg.txt"
  696.  
  697.     call DumpRegKey(NotifRegFile ,"""HKLM\SYSTEM\CurrentControlSet\Control\Winlogon\Notifications""")
  698.     call DumpRegKey(AllCredRegFile ,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers""")
  699.     call DumpRegKey(AllCredFilterFile,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters""")
  700.     call DumpRegKey(CredRegFileA ,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{07AA0886-CC8D-4e19-A410-1C75AF686E62}""")
  701.     call DumpRegKey(CredRegFileB ,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{33c86cd6-705f-4ba1-9adb-67070b837775}""")
  702.     call DumpRegKey(CredRegFileC ,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters\{edd749de-2ef1-4a80-98d1-81f20e6df58e}""")
  703.     call DumpRegKey(APIPermRegFile ,"""HKLM\SYSTEM\CurrentControlSet\Services\Wlansvc\Parameters\WlanAPIPermissions""")
  704.  
  705.     call DumpRegKey(GPTRegFile , """HKLM\SOFTWARE\Policies\Microsoft\Windows\Wireless\GPTWirelessPolicy""")
  706.     call DumpRegKey(CUWlanSvcRegFile ,"""HKCU\SOFTWARE\Microsoft\Wlansvc""")
  707.     call DumpRegKey(LMWlanSvcRegFile ,"""HKLM\SOFTWARE\Microsoft\Wlansvc""")
  708.  
  709.         ' Dump Dot3 registry keys
  710.    LMDot3SvcRegFile = RegFolder + "\HKLMDot3Svc.reg.txt"
  711.     CUDot3SvcRegFile = RegFolder + "\HKCUDot3Svc.reg.txt"
  712.     LGPPolicyFile  = RegFolder + "\L2GP.reg.txt"
  713.  
  714.     call DumpRegKey(LMDot3SvcRegFile ,"""HKLM\SOFTWARE\Microsoft\dot3svc""")
  715.     call DumpRegKey(CUDot3SvcRegFile ,"""HKCU\SOFTWARE\Microsoft\dot3svc""")
  716.     call DumpRegKey(LGPPolicyFile  ,"""HKLM\SOFTWARE\Policies\Microsoft\Windows\WiredL2\GP_Policy""")
  717.  
  718.     call DumpRegKey(NidRegFile  ,"""HKLM\SOFTWARE\MICROSOFT\Windows NT\CurrentVersion\NetworkList""")
  719.    
  720. End Sub
  721.  
  722. ' Dump Winsock LSP catalog
  723. Sub DumpWinsockCatalog(outputFileName)
  724.     On Error Resume Next
  725.     Dim envInfoFile
  726.  
  727.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  728.  
  729.     cmd = "cmd /c netsh winsock show catalog > " & outputFileName
  730.     objShell.Run cmd, 0, True
  731. End Sub
  732.  
  733. ' Dump the Windows Firewall Configuration
  734. Sub GetWindowsFirewallInfo(configFileName, logFileName, effectiveRulesFileName, consecLogFileName, logFileNameVerbose, consecLogFileNameVerbose)
  735.     On Error Resume Next
  736.     Dim envInfoFile
  737.  
  738.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  739.  
  740.     cmd = "cmd /c echo Current Profiles: > " & configFileName
  741.     objShell.Run cmd, 0, True
  742.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  743.     objShell.Run cmd, 0, True
  744.  
  745.     'Dump the current profiles 
  746.    cmd = "cmd /c netsh advfirewall monitor show currentprofile >> " & configFileName
  747.     objShell.Run cmd, 0, True
  748.  
  749.     cmd = "cmd /c echo Firewall Configuration: >> " & configFileName
  750.     objShell.Run cmd, 0, True
  751.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  752.     objShell.Run cmd, 0, True  
  753.  
  754.     ' Dump the firewall configuration
  755.    cmd = "cmd /c netsh advfirewall monitor show firewall >> " & configFileName
  756.     objShell.Run cmd, 0, True
  757.  
  758.     cmd = "cmd /c echo Connection Security  Configuration: >> " & configFileName
  759.     objShell.Run cmd, 0, True
  760.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  761.     objShell.Run cmd, 0, True          
  762.  
  763.     'Dump the connection security configuration
  764.    cmd = "cmd /c netsh advfirewall monitor show consec >> " & configFileName
  765.     objShell.Run cmd, 0, True
  766.  
  767.     cmd = "cmd /c echo Firewall Rules : >> " & configFileName
  768.     objShell.Run cmd, 0, True
  769.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  770.     objShell.Run cmd, 0, True          
  771.  
  772.     'Dump the firewall rules
  773.    cmd = "cmd /c netsh advfirewall firewall show rule name=all verbose >> " & configFileName
  774.     objShell.Run cmd, 0, True
  775.  
  776.     cmd = "cmd /c echo Connection Security  Rules : >> " & configFileName
  777.     objShell.Run cmd, 0, True
  778.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  779.     objShell.Run cmd, 0, True          
  780.    
  781.     'Dump the connection security rules
  782.    cmd = "cmd /c netsh advfirewall consec show rule name=all verbose >> " & configFileName
  783.     objShell.Run cmd, 0, True  
  784.    
  785.     'Dump the firewall rules from Dynamic Store
  786.    
  787.     cmd = "cmd /c echo Firewall Rules currently enforced : > " & effectiveRulesFileName
  788.     objShell.Run cmd, 0, True
  789.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & effectiveRulesFileName
  790.     objShell.Run cmd, 0, True          
  791.    
  792.     cmd = "cmd /c netsh advfirewall monitor show firewall rule name=all >> " & effectiveRulesFileName
  793.     objShell.Run cmd, 0, True
  794.    
  795.     'Dump the connection security rules from Dynamic Store
  796.    
  797.     cmd = "cmd /c echo Connection Security Rules currently enforced : >> " & effectiveRulesFileName
  798.     objShell.Run cmd, 0, True
  799.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & effectiveRulesFileName
  800.     objShell.Run cmd, 0, True          
  801.    
  802.     cmd = "cmd /c netsh advfirewall monitor show consec rule name=all >> " & effectiveRulesFileName
  803.     objShell.Run cmd, 0, True  
  804.  
  805.    
  806.  
  807.     'Export the operational log
  808.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-Windows Firewall With Advanced Security/Firewall"" " & logFileName
  809.     objShell.Run cmd, 0, True  
  810.  
  811.     'Archive the log so that it could be read on different machines
  812.    cmd = "cmd /c wevtutil al " & logFileName
  813.     objShell.Run cmd, 0, True  
  814.    
  815.       'Export the operational log
  816.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-Windows Firewall With Advanced Security/ConnectionSecurity"" " & consecLogFileName
  817.     objShell.Run cmd, 0, True  
  818.  
  819.     'Archive the log so that it could be read on different machines
  820.    cmd = "cmd /c wevtutil al " & consecLogFileName
  821.     objShell.Run cmd, 0, True  
  822.  
  823.    
  824.     'Export the operational log
  825.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-Windows Firewall With Advanced Security/FirewallVerbose"" " & logFileNameVerbose
  826.     objShell.Run cmd, 0, True  
  827.  
  828.     'Archive the log so that it could be read on different machines
  829.    cmd = "cmd /c wevtutil al " & logFileNameVerbose
  830.     objShell.Run cmd, 0, True  
  831.    
  832.       'Export the operational log
  833.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-Windows Firewall With Advanced Security/ConnectionSecurityVerbose"" " & consecLogFileNameVerbose
  834.     objShell.Run cmd, 0, True  
  835.  
  836.     'Archive the log so that it could be read on different machines
  837.    cmd = "cmd /c wevtutil al " & consecLogFileNameVerbose
  838.     objShell.Run cmd, 0, True  
  839.    
  840. End Sub
  841.  
  842. Sub GetWfpInfo(outputFileName, logFileName)
  843.     On Error Resume Next
  844.  
  845.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  846.  
  847.     cmd = "cmd /c netsh wfp show filters file=" & outputFileName & " > " & logFileName
  848.     objShell.Run cmd, 0, True
  849.  
  850. End Sub
  851.  
  852. ' Dump Netio State
  853. Sub GetNetioInfo(outputFileName)
  854.     On Error Resume Next
  855.  
  856.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  857.  
  858.     cmd = "cmd /c netsh interface teredo show state > " & outputFileName
  859.     objShell.Run cmd, 0, True
  860.  
  861.     cmd = "cmd /c netsh interface httpstunnel show interface >> " & outputFileName
  862.     objShell.Run cmd, 0, True
  863.  
  864.     cmd = "cmd /c netsh interface httpstunnel show statistics >> " & outputFileName
  865.     objShell.Run cmd, 0, True
  866.  
  867. End Sub
  868.  
  869. Sub GetDnsInfo(logFileName)
  870.     On Error Resume Next
  871.  
  872.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  873.  
  874.         RunCmd "echo IPCONFIG /DISPLAYDNS: ", logFileName      
  875.     RunCmd "ipconfig /displaydns", logFileName
  876.  
  877.     RunCmd "echo. ", logFileName
  878.     RunCmd "echo NETSH NAMESPACE SHOW EFFECTIVE:", logFileName
  879.     RunCmd "netsh namespace show effective", logFileName
  880.    
  881.     RunCmd "echo.", logFileName
  882.     RunCmd "echo NETSH NAMESPACE SHOW POLICY:", logFileName
  883.     RunCmd "netsh namespace show policy", logFileName
  884.  
  885. End Sub
  886.  
  887. Sub GetNeighborInfo(logFileName)
  888.     On Error Resume Next
  889.  
  890.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  891.  
  892.         RunCmd "echo ARP -A:", logFileName
  893.     RunCmd "arp -a", logFileName
  894.  
  895.         RunCmd "echo.", logFileName
  896.         RunCmd "echo NETSH INT IPV6 SHOW NEIGHBORS:", logFileName
  897.     RunCmd "netsh int ipv6 show neigh", logFileName
  898.  
  899. End Sub
  900.  
  901. Sub GetFileSharingInfo(logFileName)
  902.     On Error Resume Next
  903.  
  904.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  905.  
  906.         RunCmd "echo NBTSTAT -N:", logFileName
  907.     RunCmd "nbtstat -n", logFileName
  908.  
  909.         RunCmd "echo.", logFileName
  910.         RunCmd "echo NBTSTAT -C:", logFileName
  911.     RunCmd "nbtstat -c", logFileName
  912.  
  913.         RunCmd "echo.", logFileName
  914.         RunCmd "echo NET CONFIG RDR:", logFileName
  915.     RunCmd "net config rdr", logFileName
  916.  
  917.         RunCmd "echo.", logFileName
  918.         RunCmd "echo NET CONFIG SRV:", logFileName
  919.     RunCmd "net config srv", logFileName
  920.  
  921.         RunCmd "echo.", logFileName
  922.         RunCmd "echo NET SHARE:", logFileName
  923.     RunCmd "net share", logFileName
  924.  
  925. End Sub
  926.  
  927. Sub GetGPResultInfo(logFileName)
  928.     On Error Resume Next
  929.  
  930.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  931.  
  932.     cmd = "cmd /c gpresult /scope:computer /v 1> " & logFileName & " 2>&1"
  933.     objShell.Run cmd, 0, True
  934.  
  935. End Sub
  936.  
  937. Sub GetNetEventsInfo(outputFileName, logFileName)
  938.     On Error Resume Next
  939.  
  940.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  941.  
  942.     cmd = "cmd /c netsh wfp show netevents file=" & outputFileName & " 1> " & logFileName & " 2>&1"
  943.     objShell.Run cmd, 0, True
  944.  
  945. End Sub
  946.  
  947. Sub GetShowStateInfo(outputFileName, logFileName)
  948.     On Error Resume Next
  949.  
  950.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  951.  
  952.     cmd = "cmd /c netsh wfp show state file=" & outputFileName & " 1> " & logFileName & " 2>&1"
  953.     objShell.Run cmd, 0, True
  954.  
  955. End Sub
  956.  
  957. Sub GetSysPortsInfo(outputFileName, logFileName)
  958.     On Error Resume Next
  959.  
  960.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  961.  
  962.     cmd = "cmd /c netsh wfp show sysports file=" & outputFileName & " 1> " & logFileName & " 2>&1"
  963.     objShell.Run cmd, 0, True
  964.  
  965. End Sub
  966.  
  967.  
  968. On Error Resume Next
  969.  
  970. Dim adapterInfoFile, netInfoFile, WcnInfoFile
  971.  
  972. Set FSO = CreateObject("Scripting.FileSystemObject")
  973. Set shell = WScript.CreateObject( "WScript.Shell" )
  974. sysdrive = shell.ExpandEnvironmentStrings("%SystemDrive%\")
  975.  
  976. configFolder = "config"
  977. osinfoFileName = configFolder + "\osinfo.txt"
  978. adapterinfoFileName = configFolder + "\adapterinfo.txt"
  979. envinfoFileName = configFolder + "\envinfo.txt"
  980. wirelessAutoconfigLogFileName = configFolder + "\WLANAutoConfigLog.evtx"
  981. wscatFileName = configFolder + "\WinsockCatalog.txt"
  982. wcnFileName = configFolder + "\WcnInfo.txt"
  983. wcncachedumpFile= sysdrive + "\wcncachedump.txt"
  984. windowsFirewallConfigFileName = configFolder + "\WindowsFirewallConfig.txt"
  985. windowsFirewallEffectiveRulesFileName = configFolder + "\WindowsFirewallEffectiveRules.txt"
  986. windowsFirewallLogFileName = configFolder + "\WindowsFirewallLog.evtx"
  987. windowsFirewallConsecLogFileName = configFolder + "\WindowsFirewallConsecLog.evtx"
  988. windowsFirewallVerboseLogFileName = configFolder + "\WindowsFirewallLogVerbose.evtx"
  989. windowsFirewallConsecVerboseLogFileName = configFolder + "\WindowsFirewallConsecLogVerbose.evtx"
  990. wfpfiltersfilename=configFolder + "\wfpfilters.xml"
  991. wfplogfilename=configFolder + "\wfplog.log"
  992. netioStateFilename=configFolder + "\netiostate.txt"
  993. dnsInfoFileName = configFolder + "\Dns.txt"
  994. neighborsFileName = configFolder + "\Neighbors.txt"
  995. filesharingFileName = configFolder + "\FileSharing.txt"
  996. gpresultFileName = configFolder + "\gpresult.txt"
  997. neteventsFileName = configFolder + "\netevents.xml"
  998. neteventsFileLog = configFolder + "\neteventslog.txt"
  999. showstateFileName = configFolder + "\wfpstate.xml"
  1000. showstateFileLog = configFolder + "\wfpstatelog.txt"
  1001. sysportsFileName = configFolder + "\sysports.xml"
  1002. sysportsFileLog = configFolder + "\sysportslog.txt"
  1003.  
  1004.  
  1005. if Not FSO.FolderExists(configFolder) Then
  1006.     FSO.CreateFolder configFolder
  1007. End If
  1008.  
  1009. call DumpAllKeys
  1010.  
  1011. call GetOSInfo(osinfoFileName)
  1012.  
  1013. Set adapterInfoFile = FSO.OpenTextFile(adapterInfoFileName, 2, True)
  1014.  
  1015. call GetWirelessAdapterInfo(adapterInfoFile)
  1016. call GetWiredAdapterInfo(adapterInfoFile)
  1017.  
  1018. adapterInfoFile.Close
  1019.  
  1020. call GetWirelessAutoconfigLog(wirelessAutoConfigLogFileName)
  1021.  
  1022. call GetEnvironmentInfo(envinfoFileName)
  1023.  
  1024. call DumpWinsockCatalog(wscatFileName)
  1025.  
  1026. call  GetWindowsFirewallInfo(windowsFirewallConfigFileName, windowsFirewallLogFileName, windowsFirewallEffectiveRulesFileName,windowsFirewallConsecLogFileName, windowsFirewallVerboseLogFileName, windowsFirewallConsecVerboseLogFileName)
  1027.  
  1028. call GetWcnInfo(wcnFileName)
  1029.  
  1030. call GetWfpInfo(wfpfiltersfilename, wfplogfilename)
  1031.  
  1032. call GetNetioInfo(netioStateFilename)
  1033.  
  1034. call GetDnsInfo(dnsInfoFileName)
  1035.  
  1036. call GetNeighborInfo(neighborsFileName)
  1037.  
  1038. call GetFileSharingInfo(filesharingFileName)
  1039.  
  1040. call GetGPResultInfo(gpresultFileName)
  1041.  
  1042. call GetNetEventsInfo(neteventsFileName, neteventsFileLog)
  1043.  
  1044. call GetShowStateInfo(showstateFileName, showstateFileLog)
  1045.  
  1046. call GetSysPortsInfo(sysportsFileName, sysportsFileLog)