β08-13-2013 02:33 PM
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
Solved! Go to Solution.
β08-14-2013 06:51 PM
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.
β08-13-2013 06:03 PM
1) Have you tried running these commands on the media server itself and see whether there is any result?
2) Without exporting to the CSV file, do you get any results?
*EDIT*
3) you might need to include the full path when you are importing the BEMCLI module.
import-module "\program files\symantec\backup exec\modules\bemcli\bemcli"
*END EDIT*
β08-14-2013 07:02 AM
β08-14-2013 06:51 PM
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.