PwExpChk.vbs可以添加公司徽标吗?

时间:2016-07-06 18:53:24

标签: vbscript graphical-logo

我想在我的环境中使用的脚本如下所述,它是一个.vbs脚本。我想知道是否可以在弹出框中添加公司徽标?如果有可能我该怎么办?还添加了脚本结果的图片(屏幕截图)......脚本效果很好,我只需要了解徽标部分。请注意,徽标将是一个简单的.jpg文件,我希望我可以在弹出框上方添加公司徽标而不是嵌入,如:

公司徽标

msgbox

Results of the script

    '==========================================
 ' Check for password expiring notification
 '==========================================
 ' 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

'========================================
 ' Check if password is non-expiring.
 '========================================
 Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
 intUserAccountControl = objUser.Get("userAccountControl")
 If intUserAccountControl And ADS_UF_DONT_EXPIRE_PASSWD Then
     'WScript.Echo "The password does not expire."
 Else

     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 "Password Expires in " & daysLeft & " day(s)" & " at " & whenPasswordExpires & chr(13) & chr(13) & "Once logged in, press CTRL-ALT-DEL and" & chr(13) & "select the 'Change a password' option", 0, " PASSWORD EXPIRATION WARNING!"
     End if

End if

'========================================
 ' Clean up.
 '========================================
 Set oUser = Nothing
 Set maxPwdAge = Nothing
 Set oDomain = Nothing   

1 个答案:

答案 0 :(得分:0)

我的基础是mockmyberet/ChooseFile.vbs

Sub PasswordExpirationDialog(daysLeft, whenPasswordExpires)
    Dim fso, objShell,  HTAFileName, HtaFile
    Const TemporaryFolder = 2
    Const ForReading = 1

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set objTempFolder = fso.GetSpecialFolder(TemporaryFolder)
    HTAFileName = fso.GetSpecialFolder(TemporaryFolder).Path & "\PasswordExpirationDialog.hta"
    Set HtaFile = fso.CreateTextFile(HTAFileName, True)
    With HtaFile
        .writeline("<html><head>")
        .writeline("<title>PASSWORD EXPIRATION WARNING!</title>")
        .writeline("<HTA:APPLICATION ID='PaswordDialog'/></head><script language='VBScript'>")

        .writeline("Sub Window_OnLoad")
        .writeline("window.resizeto 700,400")
        .writeline("End Sub")

        .writeline("</script><body bgcolor='white'>")
        .writeline("<image src='https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/New_Orleans_Saints.svg/1000px-New_Orleans_Saints.svg.png' width='72' height='72' />")
        .writeline("<h1>")
        .writeline("Password Expires in " & daysLeft & " day(s)" & " at " & whenPasswordExpires)
        .writeline("<br><br>Once logged in, press CTRL-ALT-DEL and")
        .writeline("<br>select the 'Change a password' option")

        .writeline("<center><button onclick='Self.Close'>Okay</button></center>")
        .writeline("</h1></body></html>")
        .Close
    End With
    Set HtaFile = Nothing

    Set objShell = CreateObject("WScript.Shell")
    objShell.Run "%windir%\SysWoW64\mshta.exe " & Chr(34) & HTAFileName & Chr(34)

    WScript.Sleep 500
    fso.DeleteFile HTAFileName, True
    Set objShell = Nothing

End Sub

用法

PasswordExpirationDialog 4, Date+ 4

enter image description here

相关问题