RES Workspace Manager and Change Password dialog
2 min read
One of our customers noticed that the balloon that pops up when a password is about to expire isn’t displayed properly while using RES Workspace Manager. I send them an old powershell script that checks Active Directory and sends an email when the password expire date is within 14 days.
This was a good start but the script should be able to run on Windows XP and Windows 7 so a powershell script wasn’t the best choice. One of the admins wrote the following script which runs when logging on. It checks for the password expire data and gives a pop up when it’s within 14 days:
'========================================
' First, get the domain policy.
'========================================
Dim oDomain
Dim oUser
Dim maxPwdAge
Dim numDays
Dim warningDays
warningDays = 14
Set LoginInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & LoginInfo.UserName & "")
strDomainDN = UCase(LoginInfo.DomainDNSName)
strUserDN = LoginInfo.UserName
Set oDomain = GetObject("LDAP://" & strDomainDN)
Set maxPwdAge = oDomain.Get("maxPwdAge")
'========================================
' Calculate the number of days that are
' held in this value.
'========================================
numDays = CCur((maxPwdAge.HighPart * 2 ^ 32) + _
maxPwdAge.LowPart) / CCur(-864000000000)
'WScript.Echo "Maximum Password Age: " & numDays
'========================================
' Determine the last time that the user
' changed his or her password.
'========================================
Set oUser = GetObject("LDAP://" & strUserDN)
'========================================
' Add the number of days to the last time
' the password was set.
'========================================
whenPasswordExpires = DateAdd("d", numDays, oUser.PasswordLastChanged)
fromDate = Date
daysLeft = DateDiff("d",fromDate,whenPasswordExpires)
'WScript.Echo "Password Last Changed: " & oUser.PasswordLastChanged
if (daysLeft < warningDays) and (daysLeft > -1) then
Msgbox "Uw wachtwoord verloopt over " & daysLeft & " dagen" & " op " & whenPasswordExpires & chr(13) & chr(13) & "Druk na het inloggen op CTRL-ALT-DEL en " & chr(13) & "kies voor 'Wachtwoord wijzigen'", 0, "Wachtwoord waarschuwing!"
End if
'========================================
' Clean up.
'========================================
Set oUser = Nothing
Set maxPwdAge = Nothing
Set oDomain = Nothing
In this case I didn’t write the script so I have to thank Niek de Vries for letting me publish this script on my blog.
Kees Baggerman
Latest posts by Kees Baggerman (see all)
- When the Orchard Ships Production Software: AI-Augmented Development in the Real World - May 17, 2026
- Nutanix Documentation Script v5.0: Visual Reports, Brand Templates, and Seven Embedded Diagrams - May 15, 2026
- Nutanix AHV and Citrix MCS: Adding a persistent disk via Powershell – v2 - November 19, 2019
- Recovering a Protection Domain snapshot to a VM - September 13, 2019
- Checking power settings on VMs using powershell - September 11, 2019


I used this script on a Windows Server 2012 server, but get the error:
Line: 24
Char: 5
Error: OVerflow ‘CCur’
Code: 800A0006
Source: Microsoft VBScript runtime error
Any ideas?
I’ve no current ideas, didn’t test this script against WS2012? Maybe you should go for PoSH (or use the Windows Shell)