Hello.  I couldn't script my way out of a paperbag so, I'm looking for help if 
anyone on here is decent with Powershell/scripting.


I'm running the following command via a Powershell script.


------

$DEVICE=$args[0]
$BackupStatus = Invoke-Command -Computername $DEVICE -ScriptBlock { 
add-Pssnapin Windows.serverbackup -ErrorAction SilentlyContinue; Get-WBSummary }

echo $LastSuccessfulBackupDate|Select-Object -ExpandProperty 
LastSuccessfulBackupTime

------

That result yields the following, for example, "Friday, December 1st, 2015 
9:00:38 PM"


How can I have Powershell take that result, and have that date Subtracted from 
the Current Date, and the answer be a plain integer?

Something to the affect of 
$DaysSinceLastSuccessfulBackup=($LastSuccessfulBackupDate-%DATE%)

So for example, if on December 3rd, the last successful backup was December 
1st, the $DaysSinceLastSuccessfulBackup would be an integer of 2.


Pardon my obvious ignorance with Powershell and coding.!   Is this easily 
doable?

Thanks.

J





Reply via email to