ETidalgo
8/8/2018 - 6:35 PM

Example of psobject / hash object / dictionary

Powershell custom object

  function NewUsageScorecard{
      param(
          [string]$Name,
          [int]$CountInMainRepo,
          [int]$CountInToolsRepo,
          [int]$CountInAdminTool,
          [string]$AlternateName,
          [int]$AlternateCountInMainRepo,
          [int]$AlternateCountInToolsRepo,
          [int]$AlternateCountInAdminTool
          )
      new-object psobject -property @{
          Name = $Name;
          Count = $CountInMainRepo;
          CountInToolsRepo = $CountInToolsRepo;
          CountInAdminTool = $CountInAdminTool;
          AlternateName = $AlternateName;
          AlternateCount = $AlternateCountInMainRepo;
          AlternateCountInToolsRepo = $AlternateCountInToolsRepo;
          AlternateCountInAdminTool = $AlternateCountInAdminTool;
      }
  }
$eregex = new-object psobject -property @{ CSComments = '^(\+\s*//|\+\+\+)' }