Password expiry VB script not functioning when user is not on domain

We found a script online that pops up a message box saying how many days you have left until your password expires. On first log in, the script imports password expiry information from AD, and writes it to an XML file. Later, if the user is not on the network, the script should use info from the XML since it cannot contact domain for info. However, it doesn't do this, no messageBox pops up.

Set oShell = CreateObject("WScript.Shell")
Set oFso = CreateObject("Scripting.FileSystemObject") 
sRegistryKey="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\PasswordExpiryWarning"
curPath = oShell.Currentdirectory

Here it loads XML file that has the same name as the script, just with the .xml extension:

sConfigFile=GetFilenameWithoutExtension(wscript.ScriptFullName) & ".xml"
warningDays = oShell.RegRead(sRegistryKey)
'WScript.Echo "Password Expiry Warning: " & warningDays & " days"
'warningDays = 500

Set LoginInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & LoginInfo.UserName & "")
if  Err.Number <> 0 then
'computer is NOT on the corporate network   

And from here it should load the info from the XML file, and then later use it in the script. It's like the info is not loaded at all, and the script doesn't do anything:

    If oFso.FileExists(sConfigFile) Then
    'configuration file exists
        '===================================================================
        ' Load configuration data from file.
        '===================================================================
        Set xmlDoc = CreateObject("Microsoft.XMLDOM")
        xmlDoc.async = False 
        xmlDoc.load(sConfigFile)
        Set Node = xmlDoc.documentElement.selectSingleNode("MaximumPasswordAge")
        numDays = Node.Text
        'WScript.Echo numDays
        Set Node = xmlDoc.documentElement.selectSingleNode("PasswordLastChanged")
        PasswordLastChanged = Node.Text
        'WScript.Echo PasswordLastChanged
        Set Node = xmlDoc.documentElement.selectSingleNode("PasswordNeverExpire")
        bPasswordNeverExpire = Node.Text
        'WScript.Echo bPasswordNeverExpire
        if bPasswordNeverExpire = 0 Then WScript.Quit

We tested everything while the user was not on the network, and nothing happened.

Do you maybe have any ideas what might the problem? Very grateful, thanks.

Answers


Need Your Help

How to migrate my Android 2.2 app to Google TV

android android-emulator google-tv

I have an app that was designed for the Google 2.2 api (it includes maps) and I want to make it compatible for Google TV. I've been looking around on what to change to my app (by default it doesn't

How to capture a backspace on the onkeydown event

javascript onkeydown

I have a function that is triggered by the onkeydown event of a textbox. How can I tell if the user has hit either the backspace key or the del key?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.