I don't know powershell at all, nor am I a programmer. This is for sosh so I figured I'd ask here.
Every night I pull down a database backup of sosh. I'd like to write a powershell script that will return the hours since the last file appeared in that directory, which I can then pipe into my monitoring system. I've gotten as far as getting the date of the most recent file using this:
^
|---this works perfectly
In my stupid programming mind this is what my logical next step would say (but this obviously does not work)
Every night I pull down a database backup of sosh. I'd like to write a powershell script that will return the hours since the last file appeared in that directory, which I can then pipe into my monitoring system. I've gotten as far as getting the date of the most recent file using this:
Code:
gci e:\backup\sosh\db | sort LastWriteTime | select -last 1 | select LastWriteTime
|---this works perfectly
In my stupid programming mind this is what my logical next step would say (but this obviously does not work)
Code:
$startdate=gci e:\backup\sosh\db | sort LastWriteTime | select -last 1 | select LastWriteTime
$enddate=get-time
$difference=TimeDifference($endate,$startdate)
$what-nip-wants=ToHours($difference)[code]
^
|---this obviously does not work