If I put this at the top of a script
Then there a bunch of code that goes here.
Can I then add this next part in the middle of the script to bypass this section for the next X number of days
MCITP:EA/SA, MCSE, MCSA, MCDBA, MCTS, MCP+I, MCP
Code:
'RunLogonScriptOnceADay
'==========================================================================
Dim varToday, Verify, LastRunDate
Set WshShell = CreateObject("Wscript.Shell")
varToday = Weekday(Date)
Verify = "HKLM\SOFTWARE\MyInstallsAndFixes\"
'Check if scan has run today and if so exit
On Error Resume Next
LastRunDate = WshShell.RegRead(Verify & "WhatYouWantToCallIT")
If LastRunDate = cstr(Date) Then
WScript.Quit
Else
WshShell.RegWrite Verify & "WhatYouWantToCallIT",Date,"REG_SZ"
End If
Then there a bunch of code that goes here.
Can I then add this next part in the middle of the script to bypass this section for the next X number of days
Code:
'Now Create a registry value so if this is run it wont run again for a Month
'==========================================================================
Dim WshShell, varToday, Verify, LastScanDate, MsgText
Set WshShell = CreateObject("Wscript.Shell")
varToday = (Date)
Verify = "HKLM\SOFTWARE\MyInstallsAndFixes\"
'Check if scan has run today and if so Exit
On Error Resume Next
LastRunDate = WshShell.RegRead(Verify & "WhatYouWantToCallIT")
If DateDiff("d", LastRunDate, varToday) < 30 Then
WScript.Quit
Else
WshShell.RegWrite Verify & "WhatYouWantToCallIT",Date,"REG_SZ"
End If
MCITP:EA/SA, MCSE, MCSA, MCDBA, MCTS, MCP+I, MCP