Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display Records Based On Record Timestamp

Posted on 2013-01-22
2
Medium Priority
?
540 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 41

Accepted Solution

by:
footech earned 2000 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
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…

670 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