sthTools.types.ps1xml

<?xml version="1.0" encoding="utf-8" ?>
<Types>
 
  <Type>
    <Name>sth.ComputersByOperatingSystem</Name>
    <Members>
 
      <ScriptProperty>
        <Name>All</Name>
        <GetScriptBlock>
          $This.XP + $This.Seven + $This.Eight + $This.Ten
        </GetScriptBlock>
      </ScriptProperty>
 
      <ScriptProperty>
        <Name>Summary</Name>
        <GetScriptBlock>
          $Result = @"
"@
          $Lines = $This.Xp.count, $This.Seven.count, $This.Eight.count, $This.Ten.count | Sort-Object -Descending | Select-Object -First 1
           
          $LeftTemplate = ""
          if ($This.XP) {$LeftTemplate += "{0,-30}"}
          if ($This.Seven) {$LeftTemplate += "{1,-30}"}
          if ($This.Eight) {$LeftTemplate += "{2,-30}"}
          if ($This.Ten) {$LeftTemplate += "{3,-30}"}
 
          $Result += "$LeftTemplate" -f "Windows XP Computers", "Windows 7 Computers", "Windows 8 Computers", "Windows 10 Computers"
          $Result += "`n$LeftTemplate" -f "--------------------", "-------------------", "-------------------", "--------------------"
           
          for ($i = 0; $i -lt $Lines; $i++)
          {
              $RightTemplate = @()
              if ($This.XP) {$RightTemplate += $This.XP[$i].name} else {$RightTemplate += $Null}
              if ($This.Seven) {$RightTemplate += $This.Seven[$i].name} else {$RightTemplate += $Null}
              if ($This.Eight) {$RightTemplate += $This.Eight[$i].name} else {$RightTemplate += $Null}
              if ($This.Ten) {$RightTemplate += $This.Ten[$i].name} else {$RightTemplate += $Null}
 
              $Result += "`n$LeftTemplate" -f $RightTemplate
          }
 
          return $Result
        </GetScriptBlock>
      </ScriptProperty>
 
    </Members>
  </Type>
 
 
  <Type>
    <Name>sth.Computer</Name>
    <Members>
 
      <ScriptProperty>
        <Name>GUID</Name>
        <GetScriptBlock>
          [guid]$This.objectGUID
        </GetScriptBlock>
      </ScriptProperty>
 
      <ScriptProperty>
        <Name>SID</Name>
        <GetScriptBlock>
 
          $in = $This.objectSID
           
          # Revision and IdentifierAuthority
          $Result = "S-{0}-{1}" -f $in[0], $in[7]
 
          # SubAuthority
          for ($i = 0; $i -lt $in[1]; $i++)
          {
              $off = $i * 4
              $Result = "$Result-{0}" -f $([int64]$in[8 + $off] -bor ([int64]$in[9 + $off] -shl 8) -bor ([int64]$in[10 + $off] -shl 16) -bor ([int64]$in[11 + $off] -shl 24))
          }
          return $Result
 
        </GetScriptBlock>
      </ScriptProperty>
 
    </Members>
  </Type>
 
</Types>