Solved

Display Records Based On Record Timestamp

Posted on 2013-01-22
2
539 Views
Last Modified: 2013-01-22
I want to be able to display records from the last 24 hours.

This returns the last record (based on the -number l1 command), which is displayed below:
$Session = New-PSSession "AO-FS-02"
Invoke-Command -Session $Session {Import-Module AppAssurePowerShellModule}
Invoke-Command -Session $Session {Get-completedjobs -jobtype transfer -number l1 -protectedserver AO-AD-01}

Open in new window



Output (The EndTime is outputted in UTC.):
Output
The following will give me the last 5 records in table format:
$Session = New-PSSession "AO-FS-02"
Invoke-Command -Session $Session {
 Import-Module AppAssurePowerShellModule
 Get-CompletedJobs -JobType Transfer -Number l5 -ProtectedServer AO-AD-01 | 
 Format-Table -wrap `
  @{label="Status"; Width=10; e={$_.Status}},
  @{label="Job Type"; Width=11; e={$_.JobClassName}},
  @{label="End Time"; Width=30; e={$_.EndTime.AddHours(-8)}}
}

Open in new window


Output:
Output
What I would like to do is output the results in table format displaying the results from the last 24 hours.  You can see in the table format that the $_.EndTime.AddHours(-8) reformats the time into my timezone (Pacific).  This would have to be taken into consideration when trying to display the results.  

Is it possible to display records based upon time within then, or does it have to be after the fact?
0
Comment
Question by:jonathanbyers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
footech earned 500 total points
ID: 38807303
I won't be able to test, but you should be able to filter just by adding a Where-Object.
Invoke-Command -Session $Session {Get-completedjobs -jobtype transfer -number l5 -protectedserver AO-AD-01 | Where {($_.EndTime).AddHours(-8) -gt (Get-Date).AddHours(-24)} }

Open in new window

0
 

Author Comment

by:jonathanbyers
ID: 38807545
Perfect, thanks!
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question