Password notification script raising “type mismatch” error for remaining number of days

前端 未结 1 983
后悔当初
后悔当初 2021-01-17 04:06

I can get each one to work by themselves but I can not get them to work together, the logon script uses the strArg = to call on the HTA file, the HTA file gener

相关标签:
1条回答
  • 2021-01-17 04:53

    There is your culprit:

    strCMD =  "\\domain\netlogon\PwExpChk\PWReminder.hta" & " -" & intDaysRemaining
    '                                                              ~~~~~~~~~~~~~~~~

    You never define intDaysRemaining anywhere in your code, so the variable is empty, meaning your commandline looks like this:

    \\domain\netlogon\PwExpChk\PWReminder.hta -

    Splitting this commandline at - gives you an array with an empty string in the last field, which in turn raises the error you observed when you try to multiplicate an empty string with 1.

    Demonstration:

    >>> cmdline = "\\domain\netlogon\PwExpChk\PWReminder.hta -"
    >>> a = Split(cmdline, "-")
    >>> v = a(UBound(a))
    >>> WScript.Echo "_" & v & "_"
    __
    >>> i = v * 1
    Type mismatch (0xD)

    You would have spotted this right away had you added Option Explicit to your VBScript, or at least bothered to echo the commandline in your HTA when debugging (MsgBox objPasswordHTA.commandLine).

    0 讨论(0)
提交回复
热议问题