title: How can I retrieve all data from a given AWS Powershell cmdlets/alias?
body: <p>When running a cmdlet like <em>Get-WKSWorkspaces</em>, it will return a set of properties about your workspaces (e.g. WorkspaceID, Username, SubnetID, BundleID, etc.), but not everything you see in the AWS GUI. I am specifically trying to pull things like Running Mode, Compute Type, and Creation Time as well, but can't seem to find where to pull it. </p>
  
  <p>In my research, I got up to the point where I was using $AWSHistory to try and dig deeper into the data returned from my previous cmdlets, but have definitely hit a wall and can't seem to get around it. </p>
  
  <p>I do have a partial command that is giving me most of the output I need:</p>
  
  <pre><code>$region = Get-DefaultAWSRegion
  $lastuserconnect = Get-WKSWorkspacesConnectionStatus | Select LastKnownUserConnectionTimestamp
  
  Get-WKSWorkspace -ProfileName ITSLayer1-053082227562-Profile | Select WorkspaceID, UserName, BundleID, DirectoryID, 
  @{Name="Region"; Expression={$region.Region}}, 
  @{Name="LastKnownUserConnect"; Expression= 
  {$lastuserconnect.LastKnownUserConnectionTimestamp}}
  </code></pre>
  
  <p>Update for posterity: Actually got something decent to come out here. It's slow, but it renders in a table format pretty well and includes a bit at the start to select your AWS region. </p>
  
  <p>Suggestions for improvement include: </p>
  
  <ol>
  <li>Automatically switching the Region select to get all workspaces from
  the main Regions we use</li>
  <li>Cleaning the lines up so it's easier to
  read</li>
  <li>Getting the region to automatically append the filename so it
  doesn't overwrite your file every time (it's in there but broken at
  the moment...still pops out a file with 'workspace_properties.csv'
  as the name)</li>
  <li><p>Optimizing the script because it's pretty slow</p>
  
  <p>$lastuserconnect = Get-WKSWorkspacesConnectionStatus -ProfileName $profile
  $defaultregion = Get-DefaultAWSRegion
  $showallregions = Get-AWSRegion
  $exportpath = "" + $env:USERPROFILE + "\workspace_properties" + 
  $defaultregion.Region + ".csv"</p>
  
  <p>$showallregions | Format-Table</p>
  
  <p>$setregion = Read-Host -Prompt 'AWS Region'</p>
  
  <p>Clear-DefaultAWSRegion
  Set-DefaultAWSRegion $setregion</p>
  
  <p>Get-WKSWorkspace -ProfileName $profile | Select WorkspaceID, UserName, BundleID, DirectoryID, @{Name="ComputeType"; Expression={$<em>.WorkspaceProperties.ComputeTypeName}}, @{Name="RunningMode"; Expression={$</em>.WorkspaceProperties.RunningMode}}, @{Name="Region"; Expression={$defaultregion.Region}}, @{Name="LastKnownUserConnect"; Expression={$_ | foreach {$lastuserconnect = Get-WKSWorkspacesConnectionStatus -ProfileName $profile -WorkspaceId $_.WorkspaceId; echo $lastuserconnect.LastKnownUserConnectionTimestamp}}} | Export-Csv $exportpath</p></li>
  </ol>