Powershell and command
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
You got to use the select-object cmdlet to select the object that you want. See this
http://technet.microsoft.com/en-us/library/ff730948.aspx
Note the part about getting kilobytes. You can do the same thing, but use 1GB, instead of 1KB, to get your gigabytes.