title: Returning an object from PowerShell cmdlet
body: <p>I'm trying to create my own set of cmdlets for a PowerShell snapin. The problem I'm having is that I've created my own object that I create and populate within the ProcessRecord method but I'm not able to change the return type to allow me to return the object that I created. </p>
  
  <pre><code> protected override void ProcessRecord()
   {
      ReportFileSettings rptFileSettings = new ReportFileSettings();
      rptFileSettings.Enabled = string.Equals((reader.GetAttribute("Enabled").ToString().ToLower()), "yes");
      rptFileSettings.FileLocation = reader.GetAttribute("FileLocation").ToString();
      rptFileSettings.OverwriteExisting = string.Equals(reader.GetAttribute("OverwriteExistingFile").ToString().ToLower(), "yes");
      rptFileSettings.NoOfDaysToKeep = int.Parse(reader.GetAttribute("NumberOfDaysToKeep").ToString());
      rptFileSettings.ArchiveFileLocation = reader.GetAttribute("ArchiveFileLocation").ToString();
  
      return rptFileSettings;
   }
  </code></pre>
  
  <p>This is my ProcessRecord method but as it's overriding the one from PSCmdlet I cannot change the return type from void.</p>
  
  <p>Can anyone help with the best way to return the <strong>rptFileSettings</strong> object so as I can then use it with its values in other cmdlets?</p>