My goal is to run a script in Powershell that will return the jobtype of backup of the datasize, and I only want the results for th elast 1 day.
If I run this command below I get the results from everday in the job history including alot of unwanted extra data.
$session = New-PSSession -computerName "Server1"
Invoke-Command -Session $session {Import-Module BEMCLI}
Invoke-Command -Session $session {Get-BEJobHistory -jobtype backup}
If I run this command, it "seems" to run successfully since it takes time then just finishes and I'm back at the command prompt and it also creates the CSV fiel but there is no data in it. What could be the problem? Thanks!
$session = New-PSSession -computerName "Server1"
Invoke-Command -Session $session {Import-Module BEMCLI}
Invoke-Command -Session $session {Get-BEJobHistory -jobtype backup} | where-object {($_.startime -gt (get-date).adddays(-1))} | Export-Csv C:\scripts\reports.csv -NoTypeInformation