You can either modify the logic of the script so it looks at the day/time it’s running, or you have two different schedules – one for Sunday and one for every other day.
--
You received this message because you are subscribed to the Google Groups "ntsysadmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ntsysadmin+...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ntsysadmin/b27bfc7b-6305-4554-bc39-4c55c4ac7453n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/bb793bf6887b4134ab9e18db2fd4d562%40smithcons.com.
Then your logic is wrong. Get-Date returns a lot more than just a date:
Date Property
Day Property
DayOfWeek Property
DayOfYear Property
Hour Property
Kind Property
Millisecond Property
Minute Property
Month Property
Second Property
Ticks Property
TimeOfDay Property
Year Property
DateTime ScriptProperty
You probably need to look at DayOfWeek as well as the DateTIme default. Based on your OP, I don’t see any reason to look at the past run-date.
Or you have two different schedules – one for Sunday and one for every other day.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/CAKXd-rDQP8L_57qh%3DW1yCEaje3mGfjeTFq8V3RLsNo6AtjtXZA%40mail.gmail.com.
Hi,
maxcoder1 wrote:
> My question is : I will use if (($LastrunTime) -lt (get-date) ). Is there a better way?
If you’re trying to compare two dates, I would suggest to have a look at the New-TimeSpan cmdlet, that may help.
Sincerely,
--
Xavier Belanger
IT Security Architect | CISSP | Office of Information Security
University of North Carolina Wilmington
--
You received this message because you are subscribed to the Google Groups "ntsysadmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntsysadmin+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/PH7PR06MB90699686F703AD998D7807B6C384A%40PH7PR06MB9069.namprd06.prod.outlook.com.