Solved

Display Records Based On Record Timestamp

Posted on 2013-01-22
2
534 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
A procedure for exporting installed hotfix details of remote computers using powershell
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now