Solved

Display Records Based On Record Timestamp

Posted on 2013-01-22
2
536 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
2 Comments
 
LVL 39

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 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