Login | |
|
 |
RE: run once a month - 1/12/2007 12:06:34 AM
|
|
 |
|
| |
TNO
Posts: 1397
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
I suggest doing something like this: Dim Current Current = Month(Now) If(Current <> LastRunDate) Then 'Run or do whatever 'Update registry to hold the new LastRunDate which equals Month(Now) Else 'Do Nothing or whatever End If
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: run once a month - 1/12/2007 12:20:08 AM
|
|
 |
|
| |
mbouchard
Posts: 1923
Score: 16
Joined: 5/15/2003
From: USA
Status: online
|
I would use somesort of tag file of reg entry to help determine the lat run time for the script. This way, if the PC is off on the day it should have run, it can run after it logs on.
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
 |
RE: run once a month - 1/12/2007 1:35:01 AM
|
|
 |
|
| |
gdewrance
Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
|
I have created scripts that run once and if value exists will never run again run on specific days of the week run every day once a day but this month thing has me snookered
|
|
| |
|
|
|
 |
RE: run once a month - 1/14/2007 6:07:25 PM
|
|
 |
|
| |
gdewrance
Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
|
Thanks to all dm_4ever yours was close but did not work, but I managed to get it working. Option Explicit Dim WshShell : Set WSHShell = CreateObject("WScript.Shell") Dim Inventory, varToday, Verify, LastRunDate 'Now Create a registry value so if this is run it wont run again for a Month varToday = (Date) Verify = "HKLM\SOFTWARE\MyInstallsAndFixes\" 'Check if scan has run today and if so Exit On Error Resume Next LastRunDate = WshShell.RegRead(Verify & "Inventory") On error goto 0 If DateDiff("d", LastRunDate, varToday) < 30 Then WScript.Quit Else WshShell.RegWrite Verify & "Inventory",Date,"REG_SZ" End If
|
|
| |
|
|
|
|
|