PoshCode Logo PowerShell Code Repository

Audit Script by Durgesh Gupta 6 days ago (modification of post by alanrenouf view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/6853"></script>download | new post

Audit script by Alan Renouf, Usage: Audit.ps1 ‘path’ path needs to be in single quotes. The file needs to be a plain text list of computers to be audited one on each line. Output will be a htm file for each server with detailed system information. Any comments please contact me.

  1. #####################################################
  2. #    Audit script by Alan Renouf - Virtu-Al         #
  3. #    Blog: http://teckinfo.blogspot.com/            #
  4. #                                                   #
  5. #    Usage: Audit.ps1 'path'                        #
  6. #                                                   #
  7. #    The file needs to be a plain text list of      #
  8. #    computers to be audited one on each line       #
  9. #                                                   #
  10. #####################################################
  11.  
  12. param( [string] $auditlist)
  13.  
  14.  
  15. if ($auditlist -eq ""){
  16.         Write-Host "No list specified, using Localhost"
  17.         $targets = "localhost"
  18. }
  19. else
  20. {
  21.         if ((Test-Path $auditlist) -eq $false)
  22.         {
  23.                 Write-Host "Invalid audit path specified: $auditlist"
  24.                 exit
  25.         }
  26.         else
  27.         {
  28.                 Write-Host "Using Audit list: $auditlist"
  29.                 $Targets = Get-Content $auditlist
  30.         }
  31. }
  32.  
  33. $Date = Get-Date
  34.  
  35. Foreach ($Target in $Targets)
  36. {
  37.         $Filename = ".\" + $Target + "_" + $date.Hour + $date.Minute + "_" + $Date.Day + "-" + $Date.Month + "-" + $Date.Year + ".htm"
  38.  
  39.         # =====================================================================================================================
  40.         #       CREATE HTML OUTPUT
  41.         # =====================================================================================================================
  42.        
  43.         Write-Output " "| out-file -Append -encoding ASCII -filepath $Filename
  44.         Write-Output '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'| out-file -Append -encoding ASCII -filepath $Filename
  45.         Write-Output '<html ES_auditInitialized='false'><head><title>Audit</title>'| out-file -Append -encoding ASCII -filepath $Filename
  46.         Write-Output "<META http-equiv=Content-Type content='text/html; charset=windows-1252'>"| out-file -Append -encoding ASCII -filepath $Filename
  47.        
  48.         # ---------- Start of Style Definition Section ------------------------------------------------------------------------
  49.        
  50.         Write-Output "<STYLE type=text/css>"| out-file -Append -encoding ASCII -filepath $Filename
  51.                
  52.         Write-Output "  DIV .expando {DISPLAY: block; FONT-WEIGHT: normal; FONT-SIZE: 8pt; RIGHT: 10px; COLOR: #ffffff; FONT-FAMILY: Tahoma; POSITION: absolute; TEXT-DECORATION: underline}"| out-file -Append -encoding ASCII -filepath $Filename
  53.         Write-Output "  TABLE {TABLE-LAYOUT: fixed; FONT-SIZE: 100%; WIDTH: 100%}"| out-file -Append -encoding ASCII -filepath $Filename
  54.         Write-Output "  #objshowhide {PADDING-RIGHT: 10px; FONT-WEIGHT: bold; FONT-SIZE: 8pt; Z-INDEX: 2; CURSOR: hand; COLOR: #000000; MARGIN-RIGHT: 0px; FONT-FAMILY: Tahoma; TEXT-ALIGN: right; TEXT-DECORATION: underline; WORD-WRAP: normal}"| out-file -Append -encoding ASCII -filepath $Filename
  55.         Write-Output "  .heading0_expanded {BORDER-RIGHT: #bbbbbb 1px solid; PADDING-RIGHT: 5em; BORDER-TOP: #bbbbbb 1px solid; DISPLAY: block; PADDING-LEFT: 8px; FONT-WEIGHT: bold; FONT-SIZE: 8pt; MARGIN-BOTTOM: -1px; MARGIN-LEFT: 0px; BORDER-LEFT: #bbbbbb 1px solid; WIDTH: 100%; CURSOR: hand; COLOR: #FFFFFF; MARGIN-RIGHT: 0px; PADDING-TOP: 4px; BORDER-BOTTOM: #bbbbbb 1px solid; FONT-FAMILY: Tahoma; POSITION: relative; HEIGHT: 2.25em; BACKGROUND-COLOR: #cc0000}"| out-file -Append -encoding ASCII -filepath $Filename
  56.         Write-Output "  .heading1 {BORDER-RIGHT: #bbbbbb 1px solid; PADDING-RIGHT: 5em; BORDER-TOP: #bbbbbb 1px solid; DISPLAY: block; PADDING-LEFT: 16px; FONT-WEIGHT: bold; FONT-SIZE: 8pt; MARGIN-BOTTOM: -1px; MARGIN-LEFT: 5px; BORDER-LEFT: #bbbbbb 1px solid; WIDTH: 100%; CURSOR: hand; COLOR: #ffffff; MARGIN-RIGHT: 0px; PADDING-TOP: 4px; BORDER-BOTTOM: #bbbbbb 1px solid; FONT-FAMILY: Tahoma; POSITION: relative; HEIGHT: 2.25em; BACKGROUND-COLOR: #7BA7C7}"| out-file -Append -encoding ASCII -filepath $Filename
  57.         Write-Output "  .heading2 {BORDER-RIGHT: #bbbbbb 1px solid; PADDING-RIGHT: 5em; BORDER-TOP: #bbbbbb 1px solid; DISPLAY: block; PADDING-LEFT: 16px; FONT-WEIGHT: bold; FONT-SIZE: 8pt; MARGIN-BOTTOM: -1px; MARGIN-LEFT: 5px; BORDER-LEFT: #bbbbbb 1px solid; WIDTH: 100%; CURSOR: hand; COLOR: #ffffff; MARGIN-RIGHT: 0px; PADDING-TOP: 4px; BORDER-BOTTOM: #bbbbbb 1px solid; FONT-FAMILY: Tahoma; POSITION: relative; HEIGHT: 2.25em; BACKGROUND-COLOR: #A5A5A5}"| out-file -Append -encoding ASCII -filepath $Filename
  58.         Write-Output "  .tableDetail {BORDER-RIGHT: #bbbbbb 1px solid; BORDER-TOP: #bbbbbb 1px solid; DISPLAY: block; PADDING-LEFT: 16px; FONT-SIZE: 8pt;MARGIN-BOTTOM: -1px; PADDING-BOTTOM: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #bbbbbb 1px solid; WIDTH: 100%; COLOR: #000000; MARGIN-RIGHT: 0px; PADDING-TOP: 4px; BORDER-BOTTOM: #bbbbbb 1px solid; FONT-FAMILY: Tahoma; POSITION: relative; BACKGROUND-COLOR: #f9f9f9}"| out-file -Append -encoding ASCII -filepath $Filename
  59.         Write-Output "  .filler {BORDER-RIGHT: medium none; BORDER-TOP: medium none; DISPLAY: block; BACKGROUND: none transparent scroll repeat 0% 0%; MARGIN-BOTTOM: -1px; FONT: 100%/8px Tahoma; MARGIN-LEFT: 43px; BORDER-LEFT: medium none; COLOR: #ffffff; MARGIN-RIGHT: 0px; PADDING-TOP: 4px; BORDER-BOTTOM: medium none; POSITION: relative}"| out-file -Append -encoding ASCII -filepath $Filename
  60.         Write-Output "  .Solidfiller {BORDER-RIGHT: medium none; BORDER-TOP: medium none; DISPLAY: block; BACKGROUND: none transparent scroll repeat 0% 0%; MARGIN-BOTTOM: -1px; FONT: 100%/8px Tahoma; MARGIN-LEFT: 0px; BORDER-LEFT: medium none; COLOR: #000000; MARGIN-RIGHT: 0px; PADDING-TOP: 4px; BORDER-BOTTOM: medium none; POSITION: relative; BACKGROUND-COLOR: #000000}"| out-file -Append -encoding ASCII -filepath $Filename
  61.         Write-Output "  td {VERTICAL-ALIGN: TOP; FONT-FAMILY: Tahoma}"| out-file -Append -encoding ASCII -filepath $Filename
  62.         Write-Output "  th {VERTICAL-ALIGN: TOP; COLOR: #cc0000; TEXT-ALIGN: left}"| out-file -Append -encoding ASCII -filepath $Filename
  63.        
  64.         Write-Output "</STYLE>"| out-file -Append -encoding ASCII -filepath $Filename
  65.        
  66.         # ---------- End of Style Definition Section --------------------------------------------------------------------------
  67.         # ---------- Start of Control Script Section --------------------------------------------------------------------------
  68.        
  69.         Write-Output "<SCRIPT language=vbscript>"| out-file -Append -encoding ASCII -filepath $Filename
  70.        
  71.         # ---------- Declare Global Variables for Routines --------------------------------------------------------------------
  72.        
  73.         Write-Output "  strShowHide = 1"| out-file -Append -encoding ASCII -filepath $Filename
  74.         Write-Output '  strShow = "show"'| out-file -Append -encoding ASCII -filepath $Filename
  75.         Write-Output '  strHide = "hide"'| out-file -Append -encoding ASCII -filepath $Filename
  76.         Write-Output '  strShowAll = "show all"'| out-file -Append -encoding ASCII -filepath $Filename
  77.         Write-Output '  strHideAll = "hide all"'| out-file -Append -encoding ASCII -filepath $Filename
  78.        
  79.         Write-Output "Function window_onload()"| out-file -Append -encoding ASCII -filepath $Filename
  80.         Write-Output '  If UCase(document.documentElement.getAttribute("ES_auditInitialized")) <> "TRUE" Then'| out-file -Append -encoding ASCII -filepath $Filename
  81.         Write-Output "          Set objBody = document.body.all"| out-file -Append -encoding ASCII -filepath $Filename
  82.         Write-Output "          For Each obji in objBody"| out-file -Append -encoding ASCII -filepath $Filename
  83.         Write-Output "                  If IsSectionHeader(obji) Then"| out-file -Append -encoding ASCII -filepath $Filename
  84.         Write-Output "                          If IsSectionExpandedByDefault(obji) Then"| out-file -Append -encoding ASCII -filepath $Filename
  85.         Write-Output "                                  ShowSection obji"| out-file -Append -encoding ASCII -filepath $Filename
  86.         Write-Output "                          Else"| out-file -Append -encoding ASCII -filepath $Filename
  87.         Write-Output "                                  HideSection obji"| out-file -Append -encoding ASCII -filepath $Filename
  88.         Write-Output "                          End If"| out-file -Append -encoding ASCII -filepath $Filename
  89.         Write-Output "                  End If"| out-file -Append -encoding ASCII -filepath $Filename
  90.         Write-Output "          Next"| out-file -Append -encoding ASCII -filepath $Filename
  91.         Write-Output "          objshowhide.innerText = strShowAll"| out-file -Append -encoding ASCII -filepath $Filename
  92.         Write-Output '          document.documentElement.setAttribute "ES_auditInitialized", "true"'| out-file -Append -encoding ASCII -filepath $Filename
  93.         Write-Output "  End If"| out-file -Append -encoding ASCII -filepath $Filename
  94.         Write-Output "End Function"| out-file -Append -encoding ASCII -filepath $Filename
  95.        
  96.         Write-Output "Function IsSectionExpandedByDefault(objHeader)"| out-file -Append -encoding ASCII -filepath $Filename
  97.         Write-Output '  IsSectionExpandedByDefault = (Right(objHeader.className, Len("_expanded")) = "_expanded")'| out-file -Append -encoding ASCII -filepath $Filename
  98.         Write-Output "End Function"| out-file -Append -encoding ASCII -filepath $Filename
  99.        
  100.         Write-Output "Function document_onclick()"| out-file -Append -encoding ASCII -filepath $Filename
  101.         Write-Output "  Set strsrc = window.event.srcElement"| out-file -Append -encoding ASCII -filepath $Filename
  102.         Write-Output '  While (strsrc.className = "sectionTitle" or strsrc.className = "expando")'| out-file -Append -encoding ASCII -filepath $Filename
  103.         Write-Output "          Set strsrc = strsrc.parentElement"| out-file -Append -encoding ASCII -filepath $Filename
  104.         Write-Output "  Wend"| out-file -Append -encoding ASCII -filepath $Filename
  105.         Write-Output "  If Not IsSectionHeader(strsrc) Then Exit Function"| out-file -Append -encoding ASCII -filepath $Filename
  106.         Write-Output "  ToggleSection strsrc"| out-file -Append -encoding ASCII -filepath $Filename
  107.         Write-Output "  window.event.returnValue = False"| out-file -Append -encoding ASCII -filepath $Filename
  108.         Write-Output "End Function"| out-file -Append -encoding ASCII -filepath $Filename
  109.        
  110.         Write-Output "Sub ToggleSection(objHeader)"| out-file -Append -encoding ASCII -filepath $Filename
  111.         Write-Output '  SetSectionState objHeader, "toggle"'| out-file -Append -encoding ASCII -filepath $Filename
  112.         Write-Output "End Sub"| out-file -Append -encoding ASCII -filepath $Filename
  113.        
  114.         Write-Output "Sub SetSectionState(objHeader, strState)"| out-file -Append -encoding ASCII -filepath $Filename
  115.         Write-Output "  i = objHeader.sourceIndex"| out-file -Append -encoding ASCII -filepath $Filename
  116.         Write-Output "  Set all = objHeader.parentElement.document.all"| out-file -Append -encoding ASCII -filepath $Filename
  117.         Write-Output '  While (all(i).className <> "container")'| out-file -Append -encoding ASCII -filepath $Filename
  118.         Write-Output "          i = i + 1"| out-file -Append -encoding ASCII -filepath $Filename
  119.         Write-Output "  Wend"| out-file -Append -encoding ASCII -filepath $Filename
  120.         Write-Output "  Set objContainer = all(i)"| out-file -Append -encoding ASCII -filepath $Filename
  121.         Write-Output '  If strState = "toggle" Then'| out-file -Append -encoding ASCII -filepath $Filename
  122.         Write-Output '          If objContainer.style.display = "none" Then'| out-file -Append -encoding ASCII -filepath $Filename
  123.         Write-Output '                  SetSectionState objHeader, "show" '| out-file -Append -encoding ASCII -filepath $Filename
  124.         Write-Output "          Else"| out-file -Append -encoding ASCII -filepath $Filename
  125.         Write-Output '                  SetSectionState objHeader, "hide" '| out-file -Append -encoding ASCII -filepath $Filename
  126.         Write-Output "          End If"| out-file -Append -encoding ASCII -filepath $Filename
  127.         Write-Output "  Else"| out-file -Append -encoding ASCII -filepath $Filename
  128.         Write-Output "          Set objExpando = objHeader.children.item(1)"| out-file -Append -encoding ASCII -filepath $Filename
  129.         Write-Output '          If strState = "show" Then'| out-file -Append -encoding ASCII -filepath $Filename
  130.         Write-Output '                  objContainer.style.display = "block" '| out-file -Append -encoding ASCII -filepath $Filename
  131.         Write-Output "                  objExpando.innerText = strHide"| out-file -Append -encoding ASCII -filepath $Filename
  132.        
  133.         Write-Output '          ElseIf strState = "hide" Then'| out-file -Append -encoding ASCII -filepath $Filename
  134.         Write-Output '                  objContainer.style.display = "none" '| out-file -Append -encoding ASCII -filepath $Filename
  135.         Write-Output "                  objExpando.innerText = strShow"| out-file -Append -encoding ASCII -filepath $Filename
  136.         Write-Output "          End If"| out-file -Append -encoding ASCII -filepath $Filename
  137.         Write-Output "  End If"| out-file -Append -encoding ASCII -filepath $Filename
  138.         Write-Output "End Sub"| out-file -Append -encoding ASCII -filepath $Filename
  139.        
  140.         Write-Output "Function objshowhide_onClick()"| out-file -Append -encoding ASCII -filepath $Filename
  141.         Write-Output "  Set objBody = document.body.all"| out-file -Append -encoding ASCII -filepath $Filename
  142.         Write-Output "  Select Case strShowHide"| out-file -Append -encoding ASCII -filepath $Filename
  143.         Write-Output "          Case 0"| out-file -Append -encoding ASCII -filepath $Filename
  144.         Write-Output "                  strShowHide = 1"| out-file -Append -encoding ASCII -filepath $Filename
  145.         Write-Output "                  objshowhide.innerText = strShowAll"| out-file -Append -encoding ASCII -filepath $Filename
  146.         Write-Output "                  For Each obji In objBody"| out-file -Append -encoding ASCII -filepath $Filename
  147.         Write-Output "                          If IsSectionHeader(obji) Then"| out-file -Append -encoding ASCII -filepath $Filename
  148.         Write-Output "                                  HideSection obji"| out-file -Append -encoding ASCII -filepath $Filename
  149.         Write-Output "                          End If"| out-file -Append -encoding ASCII -filepath $Filename
  150.         Write-Output "                  Next"| out-file -Append -encoding ASCII -filepath $Filename
  151.         Write-Output "          Case 1"| out-file -Append -encoding ASCII -filepath $Filename
  152.         Write-Output "                  strShowHide = 0"| out-file -Append -encoding ASCII -filepath $Filename
  153.         Write-Output "                  objshowhide.innerText = strHideAll"| out-file -Append -encoding ASCII -filepath $Filename
  154.         Write-Output "                  For Each obji In objBody"| out-file -Append -encoding ASCII -filepath $Filename
  155.         Write-Output "                          If IsSectionHeader(obji) Then"| out-file -Append -encoding ASCII -filepath $Filename
  156.         Write-Output "                                  ShowSection obji"| out-file -Append -encoding ASCII -filepath $Filename
  157.         Write-Output "                          End If"| out-file -Append -encoding ASCII -filepath $Filename
  158.         Write-Output "                  Next"| out-file -Append -encoding ASCII -filepath $Filename
  159.         Write-Output "  End Select"| out-file -Append -encoding ASCII -filepath $Filename
  160.         Write-Output "End Function"| out-file -Append -encoding ASCII -filepath $Filename
  161.        
  162.         Write-Output 'Function IsSectionHeader(obj) : IsSectionHeader = (obj.className = "heading0_expanded") Or (obj.className = "heading1_expanded") Or (obj.className = "heading1") Or (obj.className = "heading2"): End Function'| out-file -Append -encoding ASCII -filepath $Filename
  163.         Write-Output 'Sub HideSection(objHeader) : SetSectionState objHeader, "hide" : End Sub'| out-file -Append -encoding ASCII -filepath $Filename
  164.         Write-Output 'Sub ShowSection(objHeader) : SetSectionState objHeader, "show": End Sub'| out-file -Append -encoding ASCII -filepath $Filename
  165.        
  166.         Write-Output "</SCRIPT>"| out-file -Append -encoding ASCII -filepath $Filename
  167.        
  168.         # ---------- End of Control Script Section ----------------------------------------------------------------------------
  169.        
  170.         Write-Output "  </HEAD>"| out-file -Append -encoding ASCII -filepath $Filename
  171.        
  172.         # ---------- End of Head Section --------------------------------------------------------------------------------------
  173.        
  174.         # ---------- Start of Body Section ------------------------------------------------------------------------------------
  175.        
  176.        
  177.         Write-Output "<BODY>"| out-file -Append -encoding ASCII -filepath $Filename
  178.         Write-Output '  <p><b><font face="Arial" size="5">'$Target' Audit<hr size="8" color="#CC0000"></font></b>'| out-file -Append -encoding ASCII -filepath $Filename
  179.         Write-Output '  <font face="Arial" size="1"><b><i>Version 1.0 by Alan Renouf (Virtu-Al)</i></b></font><br>'| out-file -Append -encoding ASCII -filepath $Filename
  180.         Write-Output '  <font face="Arial" size="1">Report generated on ' (Get-Date) '</font></p>'| out-file -Append -encoding ASCII -filepath $Filename
  181.        
  182.         Write-Output "<TABLE cellSpacing=0 cellPadding=0>"| out-file -Append -encoding ASCII -filepath $Filename
  183.         Write-Output "  <TBODY>"| out-file -Append -encoding ASCII -filepath $Filename
  184.         Write-Output "          <TR>"| out-file -Append -encoding ASCII -filepath $Filename
  185.         Write-Output "                  <TD>"| out-file -Append -encoding ASCII -filepath $Filename
  186.         Write-Output "                          <DIV id=objshowhide tabIndex=0><FONT face=Arial></FONT></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  187.         Write-Output "                  </TD>"| out-file -Append -encoding ASCII -filepath $Filename
  188.         Write-Output "          </TR>"| out-file -Append -encoding ASCII -filepath $Filename
  189.         Write-Output "  </TBODY>"| out-file -Append -encoding ASCII -filepath $Filename
  190.         Write-Output "</TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  191.  
  192.         write-output "Writing Detail for $Target"
  193.         $ComputerSystem = Get-WmiObject -computername $Target Win32_ComputerSystem
  194.         switch ($ComputerSystem.DomainRole)
  195.         {
  196.                 0 { $ComputerRole = "Standalone Workstation" }
  197.                 1 { $ComputerRole = "Member Workstation" }
  198.                 2 { $ComputerRole = "Standalone Server" }
  199.                 3 { $ComputerRole = "Member Server" }
  200.                 4 { $ComputerRole = "Domain Controller" }
  201.                 5 { $ComputerRole = "Domain Controller" }
  202.                 default { $ComputerRole = "Information not available" }
  203.         }
  204.        
  205.         $OperatingSystems = Get-WmiObject -computername $Target Win32_OperatingSystem
  206.         $TimeZone = Get-WmiObject -computername $Target Win32_Timezone
  207.         $Keyboards = Get-WmiObject -computername $Target Win32_Keyboard
  208.         $SchedTasks = Get-WmiObject -computername $Target Win32_ScheduledJob
  209.        
  210.         $BootINI = $OperatingSystems.SystemDrive + "boot.ini"
  211.        
  212.         $RecoveryOptions = Get-WmiObject -computername $Target Win32_OSRecoveryConfiguration
  213.        
  214.         # ---------- Start of COMPUTER DETAILS Section HTML Code --------------------------------------------------------------
  215.        
  216.         Write-Output "<DIV class=heading0_expanded>"| out-file -Append -encoding ASCII -filepath $Filename
  217.         Write-Output "  <SPAN class=sectionTitle tabIndex=0>$target Details</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  218.         Write-Output "  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  219.         Write-Output "</DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  220.         Write-Output "<DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  221.        
  222.         # ---------- Start of COMPUTER DETAILS - GENERAL Sub Section HTML Code ------------------------------------------------
  223.         write-output "..Computer Details"
  224.        
  225.         Write-Output "<DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  226.         Write-Output "  <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  227.         Write-Output "          <SPAN class=sectionTitle tabIndex=0>General</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  228.         Write-Output "          <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  229.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  230.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  231.         Write-Output "          <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  232.         Write-Output "                  <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  233.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  234.         Write-Output "                                  <th width='25%'><b>Computer Name</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  235.         Write-Output "                                  <td width='75%'> " $ComputerSystem.Name "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  236.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  237.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  238.         Write-Output "                                  <th width='25%'><b>Computer Role</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  239.         Write-Output "                                  <td width='75%'> $ComputerRole </font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  240.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  241.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  242.        
  243.         switch ($ComputerRole)
  244.         {
  245.                 "Member Workstation" { Write-Output "                                   <th width='25%'><b>Computer Domain</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename       }
  246.                 "Domain Controller" { Write-Output "                                    <th width='25%'><b>Computer Domain</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename        }
  247.                 "Member Server" { Write-Output "                                        <th width='25%'><b>Computer Domain</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename        }
  248.                 default { Write-Output "                                        <th width='25%'><b>Computer Workgroup</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename}
  249.         }
  250.        
  251.         Write-Output "                                  <td width='75%'>" $ComputerSystem.Domain "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  252.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  253.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  254.         Write-Output "                                  <th width='25%'><b>Operating System</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  255.         Write-Output "                                  <td width='75%'>" $OperatingSystems.Caption "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  256.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  257.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  258.         Write-Output "                                  <th width='25%'><b>Service Pack</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  259.         Write-Output "                                  <td width='75%'>" $OperatingSystems.CSDVersion "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  260.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  261.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  262.         Write-Output "                                  <th width='25%'><b>System Root</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  263.         Write-Output "                                  <td width='75%'>" $OperatingSystems.SystemDrive "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  264.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  265.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  266.         Write-Output "                                  <th width='25%'><b>Manufacturer</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  267.         Write-Output "                                  <td width='75%'>" $ComputerSystem.Manufacturer "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  268.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  269.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  270.         Write-Output "                                  <th width='25%'><b>Model</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  271.         Write-Output "                                  <td width='75%'>" $ComputerSystem.Model "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  272.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  273.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  274.         Write-Output "                                  <th width='25%'><b>Number of Processors</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  275.         Write-Output "                                  <td width='75%'>" $ComputerSystem.NumberOfProcessors "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  276.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  277.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  278.         Write-Output "                                  <th width='25%'><b>Memory</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  279.         Write-Output "                                  <td width='75%'>" $ComputerSystem.TotalPhysicalMemory "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  280.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  281.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  282.         Write-Output "                                  <th width='25%'><b>Registered User</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  283.         Write-Output "                                  <td width='75%'>" $ComputerSystem.PrimaryOwnerName "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  284.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  285.         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  286.         Write-Output "                                  <th width='25%'><b>Registered Organisation</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  287.         Write-Output "                                  <td width='75%'>" $OperatingSystems.Organization "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  288.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  289.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  290.         Write-Output "                                  <th width='25%'><b>Last System Boot</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  291.         $LBTime=$OperatingSystems.ConvertToDateTime($OperatingSystems.Lastbootuptime)
  292.         Write-Output "                                  <td width='75%'>" $LBTime "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  293.         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  294.         Write-Output "                  </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  295.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  296.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  297.         Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  298.        
  299.         #---------- End of COMPUTER DETAILS - GENERAL Sub-section HTML Code --------------------------------------------------
  300.        
  301.         # ---------- Start of COMPUTER DETAILS - HOFIXES Sub-section HTML Code ------------------------------------------------
  302.        
  303.         write-output "..Hotfix Information"
  304.        
  305.         $colQuickFixes = Get-WmiObject Win32_QuickFixEngineering
  306.        
  307.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  308.         Write-Output "          <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  309.         Write-Output "                  <SPAN class=sectionTitle tabIndex=0>HotFixes</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  310.         Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  311.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  312.         Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  313.         Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  314.         Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  315.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  316.         Write-Output "                                                  <th width='25%'><b>HotFix Number</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  317.         Write-Output "                                                  <th width='75%'><b>Description</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  318.         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  319.        
  320.         ForEach ($objQuickFix in $colQuickFixes)
  321.         {
  322.                 if ($objQuickFix.HotFixID -ne "File 1")
  323.                 {
  324.                         Write-Output "                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  325.                         Write-Output "                                  <td width='25%'>" $objQuickFix.HotFixID "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  326.                         Write-Output "                                  <td width='75%'>" $objQuickFix.Description "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  327.                         Write-Output "                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  328.                 }
  329.         }
  330.         Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  331.         Write-Output "                  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  332.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  333.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  334.         Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  335.        
  336.         #---------- End of COMPUTER DETAILS - HOFIXES Sub-section HTML Code --------------------------------------------------
  337.        
  338.         #---------- Start of COMPUTER DETAILS - LOGICAL DISK CONFIGURATION Sub-section HTML Code -----------------------------
  339.        
  340.         write-output "..Logical Disks"
  341.        
  342.         $colDisks = Get-WmiObject -ComputerName $Target Win32_LogicalDisk
  343.        
  344.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  345.         Write-Output "          <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  346.         Write-Output "                  <SPAN class=sectionTitle tabIndex=0>Logical Disk Configuration</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  347.         Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  348.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  349.         Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  350.         Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  351.         Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  352.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  353.         Write-Output "                                                  <th width='15%'><b>Drive Letter</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  354.         Write-Output "                                                  <th width='20%'><b>Label</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  355.         Write-Output "                                                  <th width='20%'><b>File System</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  356.         Write-Output "                                                  <th width='15%'><b>Disk Size</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  357.         Write-Output "                                                  <th width='15%'><b>Disk Free Space</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  358.         Write-Output "                                                  <th width='15%'><b>% Free Space</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  359.         Write-Output "                                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  360.        
  361.         Foreach ($objDisk in $colDisks)
  362.         {
  363.                 if ($objDisk.DriveType -eq 3)
  364.                 {
  365.                         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  366.                         Write-Output "                                          <td width='15%'>"$objDisk.DeviceID"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  367.                         Write-Output "                                          <td width='20%'>"$objDisk.VolumeName"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  368.                         Write-Output "                                          <td width='20%'>"$objDisk.FileSystem"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  369.                         $disksize = [math]::round(($objDisk.size / 1048576))
  370.                         Write-Output "                                          <td width='15%'>"$disksize" MB</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  371.                         $freespace = [math]::round(($objDisk.FreeSpace / 1048576))
  372.                         Write-Output "                                          <td width='15%'>"$Freespace" MB</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  373.                         $percFreespace=[math]::round(((($objDisk.FreeSpace / 1048576)/($objDisk.Size / 1048676)) * 100),0)
  374.                         Write-Output "                                          <td width='15%'>"$percFreespace" %</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  375.                         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  376.                 }
  377.         }
  378.        
  379.         Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  380.         Write-Output "                  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  381.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  382.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  383.         Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  384.        
  385.         # ---------- End of COMPUTER DETAILS - LOGICAL DISK CONFIGURATION Sub-section HTML Code -------------------------------
  386.         # ---------- Start of COMPUTER DETAILS - NIC CONFIGURATION Sub-section HTML Code --------------------------------------
  387.        
  388.         write-output "..Network Configuration"
  389.        
  390.         $NICCount = 0
  391.         $colAdapters = Get-WmiObject -ComputerName $Target Win32_NetworkAdapterConfiguration
  392.        
  393.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  394.         Write-Output "          <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  395.         Write-Output "                  <SPAN class=sectionTitle tabIndex=0>NIC Configuration</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  396.         Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  397.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  398.         Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  399.         Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  400.         Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  401.        
  402.         $NICCount = 0
  403.         Foreach ($objAdapter in $colAdapters)
  404.         {
  405.                 if ($objAdapter.IPEnabled -eq "True")
  406.                 {
  407.                         $NICCount = $NICCount + 1
  408.                         If ($NICCount -gt 1)
  409.                         {
  410.                                 Write-Output "                  </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  411.                                 Write-Output "                          <DIV class=Solidfiller></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  412.                                 Write-Output "                  <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  413.                         }
  414.                 Write-Output "                                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  415.                 Write-Output "                                          <th width='25%'><b>Description</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  416.                 Write-Output "                                          <td width='75%'>" $objAdapter.Description "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  417.                 Write-Output "                                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  418.                 Write-Output "                                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  419.                 Write-Output "                                          <th width='25%'><b>Physical address</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  420.                 Write-Output "                                          <td width='75%'>" $objAdapter.MACaddress "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  421.                 Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  422.                 If ($objAdapter.IPAddress -ne $Null)
  423.                 {
  424.                         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  425.                         Write-Output "                                          <th width='25%'><b>IP Address / Subnet Mask</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  426.                         Write-Output "                                          <td width='75%'>" $objAdapter.IPAddress " / " $objAdapter.IPSubnet "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  427.                         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  428.                         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  429.                         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  430.                         Write-Output "                                          <th width='25%'><b>Default Gateway</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  431.                         Write-Output "                                          <td width='75%'>" $objAdapter.DefaultIPGateway "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  432.                         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  433.                
  434.                 }
  435.                 Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  436.                 Write-Output "                                          <th width='25%'><b>DHCP enabled</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  437.                 If ($objAdapter.DHCPEnabled -eq "True")
  438.                 {
  439.                         Write-Output "                                          <td width='75%'>Yes</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  440.                 }
  441.                 Else
  442.                 {
  443.                         Write-Output "                                          <td width='75%'>No</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  444.                 }
  445.                 Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  446.                 Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  447.                 Write-Output "                                                  <th width='25%'><b>DNS Servers</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  448.                 Write-Output "                                                  <td width='75%'>"| out-file -Append -encoding ASCII -filepath $Filename
  449.                 If ($objAdapter.DNSServerSearchOrder -ne $Null)
  450.                 {
  451.                         Write-Output $objAdapter.DNSServerSearchOrder | out-file -Append -encoding ASCII -filepath $Filename
  452.                 }
  453.                 Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  454.                 Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  455.                 Write-Output "                                          <th width='25%'><b>Primary WINS Server</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  456.                 Write-Output "                                          <td width='75%'>" $objAdapter.WINSPrimaryServer "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  457.                 Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  458.                 Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  459.                 Write-Output "                                          <th width='25%'><b>Secondary WINS Server</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  460.                 Write-Output "                                          <td width='75%'>" $objAdapter.WINSSecondaryServer "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  461.                 Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  462.                 $NICCount = $NICCount + 1
  463.                 }
  464.         }
  465.         Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  466.         Write-Output "                  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  467.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  468.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  469.         Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  470.        
  471.         #---------- End of COMPUTER DETAILS - NIC CONFIGURATION Sub-section HTML Code ----------------------------------------
  472.        
  473.         #---------- Start of COMPUTER DETAILS - Software Sub-section HTML Code -------------------------------------------
  474.        
  475.         if ((get-wmiobject -namespace "root/cimv2" -list) | ? {$_.name -match "Win32_Product"})
  476.         {
  477.                 write-output "..Installed Software"
  478.        
  479.                 $colShares = get-wmiobject -ComputerName $Target Win32_Product | select Name,Version,Vendor,InstallDate
  480.                
  481.                 Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  482.                 Write-Output "          <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  483.                 Write-Output "                  <SPAN class=sectionTitle tabIndex=0>Software</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  484.                 Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  485.                 Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  486.                 Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  487.                 Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  488.                 Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  489.                 Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  490.                 Write-Output "                                                  <th width='25%'><b>Name</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  491.                 Write-Output "                                                  <th width='25%'><b>Version</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  492.                 Write-Output "                                                  <th width='25%'><b>Vendor</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  493.                 Write-Output "                                                  <th width='25%'><b>Install Date</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  494.                 Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  495.                
  496.                 Foreach ($objShare in $colShares)
  497.                 {
  498.                         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  499.                         Write-Output "                                          <td width='50%'>" $objShare.Name "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  500.                         Write-Output "                                          <td width='20%'>" $objShare.Version "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  501.                         Write-Output "                                          <td width='15%'>" $objShare.Vendor "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  502.                         Write-Output "                                          <td width='15%'>" $objShare.InstallDate "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  503.                         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  504.                 }
  505.                 Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  506.                 Write-Output "                  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  507.                 Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  508.                 Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  509.                 Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  510.                
  511.         }
  512.         # ---------- End of COMPUTER DETAILS - Software Sub-section HTML Code ---------------------------------------------
  513.        
  514.         #---------- Start of COMPUTER DETAILS - LOCAL SHARES Sub-section HTML Code -------------------------------------------
  515.        
  516.         write-output "..Local Shares"
  517.        
  518.         $colShares = Get-wmiobject -ComputerName $Target Win32_Share
  519.        
  520.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  521.         Write-Output "          <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  522.         Write-Output "                  <SPAN class=sectionTitle tabIndex=0>Local Shares</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  523.         Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  524.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  525.         Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  526.         Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  527.         Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  528.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  529.         Write-Output "                                                  <th width='25%'><b>Share</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  530.         Write-Output "                                                  <th width='25%'><b>Path</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  531.         Write-Output "                                                  <th width='50%'><b>Comment</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  532.         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  533.        
  534.         Foreach ($objShare in $colShares)
  535.         {
  536.                 Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  537.                 Write-Output "                                          <td width='25%'>" $objShare.Name "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  538.                 Write-Output "                                          <td width='25%'>" $objShare.Path "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  539.                 Write-Output "                                          <td width='50%'>" $objShare.Caption "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  540.                 Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  541.         }
  542.         Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  543.         Write-Output "                  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  544.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  545.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  546.         Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  547.        
  548.         #---------- End of COMPUTER DETAILS - LOCAL SHARES Sub-section HTML Code ---------------------------------------------
  549.        
  550.         #---------- Start of COMPUTER DETAILS - PRINTERS Sub-section HTML Code -----------------------------------------------
  551.        
  552.         Write-output "..Printers"
  553.        
  554.         $colInstalledPrinters =  Get-WmiObject -ComputerName $Target Win32_Printer
  555.        
  556.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  557.         Write-Output "          <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  558.         Write-Output "                  <SPAN class=sectionTitle tabIndex=0>Printers</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  559.         Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  560.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  561.         Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  562.         Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  563.         Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  564.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  565.         Write-Output "                                          <th width='25%'><b>Printer</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  566.         Write-Output "                                          <th width='25%'><b>Location</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  567.         Write-Output "                                          <th width='25%'><b>Default Printer</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  568.         Write-Output "                                          <th width='25%'><b>Portname</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  569.         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  570.        
  571.         Foreach ($objPrinter in $colInstalledPrinters)
  572.         {
  573.                 If ($objPrinter.Name -eq "")
  574.                 {
  575.                         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  576.                         Write-Output "                                          <td width='100%'>No Printers Installed</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  577.                 }
  578.                 Else
  579.                 {
  580.                         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  581.                         Write-Output "                                          <td width='25%'>" $objPrinter.Name "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  582.                         Write-Output "                                          <td width='25%'>" $objPrinter.Location "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  583.                         if ($objPrinter.Default -eq "True")
  584.                         {
  585.                                 Write-Output "                                          <td width='25%'>Yes</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  586.                         }
  587.                         Else
  588.                         {
  589.                                 Write-Output "                                          <td width='25%'>No</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  590.                         }
  591.                         Write-Output "                                          <td width='25%'>"$objPrinter.Portname"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  592.                 }
  593.                 Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  594.         }
  595.         Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  596.         Write-Output "                  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  597.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  598.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  599.         Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  600.        
  601.         #---------- End of COMPUTER DETAILS - PRINTERS Sub-section HTML Code -------------------------------------------------
  602.        
  603.         #---------- Start of COMPUTER DETAILS - SERVICES Sub-section HTML Code -----------------------------------------------
  604.        
  605.         Write-Output "..Services"
  606.        
  607.         $colListOfServices = Get-WmiObject -ComputerName $Target Win32_Service
  608.        
  609.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  610.         Write-Output "          <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  611.         Write-Output "                  <SPAN class=sectionTitle tabIndex=0>Services</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  612.         Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  613.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  614.         Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  615.         Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  616.         Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  617.         Write-Output "                                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  618.         Write-Output "                                          <th width='20%'><b>Name</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  619.         Write-Output "                                          <th width='20%'><b>Account</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  620.         Write-Output "                                          <th width='20%'><b>Start Mode</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  621.         Write-Output "                                          <th width='20%'><b>State</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  622.         Write-Output "                                          <th width='20%'><b>Expected State</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  623.         Write-Output "                                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  624.        
  625.         Foreach ($objService in $colListOfServices)
  626.         {
  627.                 Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  628.                 Write-Output "                                          <td width='20%'>"$objService.Caption"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  629.                 Write-Output "                                          <td width='20%'>"$objService.Startname"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  630.                 Write-Output "                                          <td width='20%'>"$objService.StartMode"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  631.                 If ($objService.StartMode -eq "Auto")
  632.                 {
  633.                         if ($objService.State -eq "Stopped")
  634.                         {
  635.                                 Write-Output "                                          <td width='20%'><font color='#FF0000'>"$objService.State"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  636.                                 Write-Output "                                          <td width='25%'><font face='Wingdings'color='#FF0000'></font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  637.                         }
  638.                 }
  639.                 If ($objService.StartMode -eq "Auto")
  640.                 {
  641.                         if ($objService.State -eq "Running")
  642.                         {
  643.                                 Write-Output "                                          <td width='20%'><font color='#009900'>"$objService.State"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  644.                                 Write-Output "                                          <td width='20%'><font face='Wingdings'color='#009900'></font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  645.                         }
  646.                 }
  647.                 If ($objService.StartMode -eq "Disabled")
  648.                 {
  649.                         If ($objService.State -eq "Running")
  650.                         {
  651.                                 Write-Output "                                          <td width='20%'><font color='#FF0000'>"$objService.State"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  652.                                 Write-Output "                                          <td width='25%'><font face='Wingdings'color='#FF0000'></font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  653.                         }
  654.                 }
  655.                 If ($objService.StartMode -eq "Disabled")
  656.                 {
  657.                         if ($objService.State -eq "Stopped")
  658.                         {
  659.                                 Write-Output "                                          <td width='20%'><font color='#009900'>"$objService.State"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  660.                                 Write-Output "                                          <td width='20%'><font face='Wingdings'color='#009900'></font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  661.                         }
  662.                 }
  663.                 If ($objService.StartMode -eq "Manual")
  664.                 {
  665.                         Write-Output "                                          <td width='20%'><font color='#009900'>"$objService.State"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  666.                         Write-Output "                                          <td width='20%'><font face='Wingdings'color='#009900'></font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  667.                 }
  668.                 If ($objService.State -eq "Paused")
  669.                 {
  670.                         Write-Output "                                          <td width='20%'><font color='#FF9933'>"$objService.State"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  671.                         Write-Output "                                          <td width='20%'><font face='Wingdings'color='#009900'></font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  672.                 }
  673.                 Write-Output "                                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  674.         }
  675.         Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  676.         Write-Output "                  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  677.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  678.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  679.         Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  680.        
  681.         #---------- End of COMPUTER DETAILS - SERVICES Sub-section HTML Code -------------------------------------------------
  682.        
  683.         #---------- Start of COMPUTER DETAILS - REGIONAL SETTINGS Sub-section HTML Code --------------------------------------
  684.        
  685.         Write-Output "..Regional Options"
  686.        
  687.         $ObjKeyboards = Get-WmiObject -ComputerName $Target Win32_Keyboard
  688.        
  689.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  690.         Write-Output "          <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  691.         Write-Output "                  <SPAN class=sectionTitle tabIndex=0>Regional Settings</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  692.         Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  693.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  694.         Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  695.         Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  696.         Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  697.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  698.         Write-Output "                                          <th width='25%'><b>Time Zone</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  699.         Write-Output "                                          <td width='75%'>" $TimeZone.Description "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  700.         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  701.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  702.         Write-Output "                                          <th width='25%'><b>Country Code</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  703.         Write-Output "                                          <td width='75%'>" $OperatingSystems.Countrycode "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  704.         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  705.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  706.         Write-Output "                                          <th width='25%'><b>Locale</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  707.         Write-Output "                                          <td width='75%'>" $OperatingSystems.Locale"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  708.         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  709.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  710.         Write-Output "                                          <th width='25%'><b>Operating System Language</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  711.         Write-Output "                                          <td width='75%'>" $OperatingSystems.OSLanguage"</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  712.         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  713.         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  714.        
  715.         switch ($ObjKeyboards.Layout)
  716.         {
  717.                 "00000402"{ $keyb = "BG" }
  718.                 "00000404"{ $keyb = "CH" }
  719.                 "00000405"{ $keyb = "CZ" }
  720.                 "00000406"{ $keyb = "DK" }
  721.                 "00000407"{ $keyb = "GR" }
  722.                 "00000408"{ $keyb = "GK" }
  723.                 "00000409"{ $keyb = "US" }
  724.                 "0000040A"{ $keyb = "SP" }
  725.                 "0000040B"{ $keyb = "SU" }
  726.                 "0000040C"{ $keyb = "FR" }
  727.                 "0000040E"{ $keyb = "HU" }
  728.                 "0000040F"{ $keyb = "IS" }
  729.                 "00000410"{ $keyb = "IT" }
  730.                 "00000411"{ $keyb = "JP" }
  731.                 "00000412"{ $keyb = "KO" }
  732.                 "00000413"{ $keyb = "NL" }
  733.                 "00000414"{ $keyb = "NO" }
  734.                 "00000415"{ $keyb = "PL" }
  735.                 "00000416"{ $keyb = "BR" }
  736.                 "00000418"{ $keyb = "RO" }
  737.                 "00000419"{ $keyb = "RU" }
  738.                 "0000041A"{ $keyb = "YU" }
  739.                 "0000041B"{ $keyb = "SL" }
  740.                 "0000041C"{ $keyb = "US" }
  741.                 "0000041D"{ $keyb = "SV" }
  742.                 "0000041F"{ $keyb = "TR" }
  743.                 "00000422"{ $keyb = "US" }
  744.                 "00000423"{ $keyb = "US" }
  745.                 "00000424"{ $keyb = "YU" }
  746.                 "00000425"{ $keyb = "ET" }
  747.                 "00000426"{ $keyb = "US" }
  748.                 "00000427"{ $keyb = "US" }
  749.                 "00000804"{ $keyb = "CH" }
  750.                 "00000809"{ $keyb = "UK" }
  751.                 "0000080A"{ $keyb = "LA" }
  752.                 "0000080C"{ $keyb = "BE" }
  753.                 "00000813"{ $keyb = "BE" }
  754.                 "00000816"{ $keyb = "PO" }
  755.                 "00000C0C"{ $keyb = "CF" }
  756.                 "00000C1A"{ $keyb = "US" }
  757.                 "00001009"{ $keyb = "US" }
  758.                 "0000100C"{ $keyb = "SF" }
  759.                 "00001809"{ $keyb = "US" }
  760.                 "00010402"{ $keyb = "US" }
  761.                 "00010405"{ $keyb = "CZ" }
  762.                 "00010407"{ $keyb = "GR" }
  763.                 "00010408"{ $keyb = "GK" }
  764.                 "00010409"{ $keyb = "DV" }
  765.                 "0001040A"{ $keyb = "SP" }
  766.                 "0001040E"{ $keyb = "HU" }
  767.                 "00010410"{ $keyb = "IT" }
  768.                 "00010415"{ $keyb = "PL" }
  769.                 "00010419"{ $keyb = "RU" }
  770.                 "0001041B"{ $keyb = "SL" }
  771.                 "0001041F"{ $keyb = "TR" }
  772.                 "00010426"{ $keyb = "US" }
  773.                 "00010C0C"{ $keyb = "CF" }
  774.                 "00010C1A"{ $keyb = "US" }
  775.                 "00020408"{ $keyb = "GK" }
  776.                 "00020409"{ $keyb = "US" }
  777.                 "00030409"{ $keyb = "USL" }
  778.                 "00040409"{ $keyb = "USR" }
  779.                 "00050408"{ $keyb = "GK" }
  780.                 default { $keyb = "Unknown" }
  781.         }
  782.  
  783.  
  784.         Write-Output "                                          <th width='25%'><b>Keyboard Layout</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  785.         Write-Output "                                          <td width='75%'>" $keyb "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  786.         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  787.         Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  788.         Write-Output "                  </div>"| out-file -Append -encoding ASCII -filepath $Filename
  789.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  790.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  791.         Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  792.        
  793.         #---------- End of COMPUTER DETAILS - REGIONAL SETTINGS Sub-section HTML Code ----------------------------------------
  794.         #---------- Start of COMPUTER DETAILS - EVENT LOGS Sub-section HTML Code ---------------------------------------------
  795.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  796.         Write-Output "          <DIV class=heading1>"| out-file -Append -encoding ASCII -filepath $Filename
  797.         Write-Output "                  <SPAN class=sectionTitle tabIndex=0>Event Logs</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  798.         Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  799.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  800.         Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  801.         Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  802.        
  803.         #---------- Start of COMPUTER DETAILS - EVENT LOGS - EVENT LOG SETTINGS Sub-section HTML Code ------------------------
  804.        
  805.         Write-Output "..Event Log Settings"
  806.        
  807.         $colLogFiles = Get-WmiObject -ComputerName $Target Win32_NTEventLogFile
  808.        
  809.         Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  810.         Write-Output "          <DIV class=heading2>"| out-file -Append -encoding ASCII -filepath $Filename
  811.         Write-Output "                  <SPAN class=sectionTitle tabIndex=0>Event Log Settings</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  812.         Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  813.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  814.         Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  815.         Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  816.         Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  817.         Write-Output "                                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  818.         Write-Output "                                          <th width='25%'><b>Log Name</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  819.         Write-Output "                                          <th width='25%'><b>Overwrite Outdated Records</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  820.         Write-Output "                                                  <th width='25%'><b>Maximum Size</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  821.         Write-Output "                                          <th width='25%'><b>Current Size</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  822.         Write-Output "                                  </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  823.         ForEach ($objLogFile in $colLogfiles)
  824.         {
  825.                 Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  826.                 Write-Output "                                          <td width='25%'>" $objLogFile.LogFileName "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  827.                 If ($objLogfile.OverWriteOutdated -lt 0)
  828.                 {
  829.                         Write-Output "                                          <td width='25%'>Never</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  830.                 }
  831.                 if ($objLogFile.OverWriteOutdated -eq 0)
  832.                 {
  833.                         Write-Output "                                          <td width='25%'>As needed</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  834.                 }
  835.                 Else
  836.                 {
  837.                         Write-Output "                                          <td width='25%'>After " $objLogFile.OverWriteOutdated " days</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  838.                 }
  839.                 Write-Output "                                          <td width='25%'>" (($objLogfile.MaxFileSize)/1024) " KB</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  840.                 Write-Output "                                          <td width='25%'>" (($objLogfile.FileSize)/1024) " KB</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  841.                 Write-Output "                                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  842.         }
  843.         Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  844.         Write-Output "                  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  845.         Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  846.         Write-Output "  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  847.         Write-Output "  <DIV class=filler></DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  848.        
  849.         #---------- End of COMPUTER DETAILS - EVENT LOGS - EVENT LOG SETTINGS Sub-section HTML Code --------------------------
  850.         # ---------- Start of COMPUTER DETAILS - EVENT LOGS - ERROR ENTRIES Sub-section HTML Code -----------------------------
  851.        
  852.                 write-output "..Event Log Errors"
  853.                
  854.                 $WmidtQueryDT = [System.Management.ManagementDateTimeConverter]::ToDmtfDateTime([DateTime]::Now.AddDays(-14))
  855.                 $colLoggedEvents = Get-WmiObject -computer "Localhost" -query ("Select * from Win32_NTLogEvent Where Type='Error' and TimeWritten >='" + $WmidtQueryDT + "'")
  856.        
  857.                 Write-Output "  <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  858.                 Write-Output "          <DIV class=heading2>"| out-file -Append -encoding ASCII -filepath $Filename
  859.                 Write-Output "                  <SPAN class=sectionTitle tabIndex=0>ERROR Entries</SPAN>"| out-file -Append -encoding ASCII -filepath $Filename
  860.                 Write-Output "                  <A class=expando href='#'></A>"| out-file -Append -encoding ASCII -filepath $Filename
  861.                 Write-Output "          </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  862.                 Write-Output "          <DIV class=container>"| out-file -Append -encoding ASCII -filepath $Filename
  863.                 Write-Output "                  <DIV class=tableDetail>"| out-file -Append -encoding ASCII -filepath $Filename
  864.                 Write-Output "                          <TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  865.                 Write-Output "                                          <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  866.                 Write-Output "                                          <th width='10%'><b>Event Code</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  867.                 Write-Output "                                          <th width='10%'><b>Source Name</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  868.                 Write-Output "                                          <th width='15%'><b>Time</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  869.                 Write-Output "                                          <th width='10%'><b>Log</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  870.                 Write-Output "                                          <th width='55%'><b>Message</b></font></th>"| out-file -Append -encoding ASCII -filepath $Filename
  871.                 Write-Output "                                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  872.                 ForEach ($objEvent in $colLoggedEvents)
  873.                 {
  874.                         $dtmEventDate = $ObjEvent.ConvertToDateTime($objEvent.TimeWritten)
  875.                         Write-Output "                                  <tr>"| out-file -Append -encoding ASCII -filepath $Filename
  876.                         Write-Output "                                          <td width='10%'>" $objEvent.EventCode "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  877.                         Write-Output "                                          <td width='10%'>" $objEvent.SourceName "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  878.                         Write-Output "                                          <td width='15%'>" $dtmEventDate "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  879.                         Write-Output "                                          <td width='10%'>" $objEvent.LogFile "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  880.                         Write-Output "                                          <td width='55%'>" $objEvent.Message "</font></td>"| out-file -Append -encoding ASCII -filepath $Filename
  881.                         Write-Output "                                          </tr>"| out-file -Append -encoding ASCII -filepath $Filename
  882.                 }
  883.                 Write-Output "                          </TABLE>"| out-file -Append -encoding ASCII -filepath $Filename
  884.                 Write-Output "                  </DIV>"| out-file -Append -encoding ASCII -filepath $Filename
  885.                 Write-Output "          </DI

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me