Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Password Complexity Script some part of script getting ignored

Password Complexity Script some part of script getting ignored

Password Complexity Script some part of script getting ignored

Hi guys. I have edited below vbscript from Microsoft MDT to include a password complexity check function. However, it seems to be ignoring the part where it checks the password for alphabets and special characters. Can anyone tell me where I've gone wrong? Thanks!

CODE --> vbs

' // ***************************************************************************
' // 
' // Copyright (c) Microsoft Corporation.  All rights reserved.
' // 
' // Microsoft Deployment Toolkit Solution Accelerator
' //
' // File:      DeployWiz_Validation.vbs
' // 
' // Version:   6.3.8456.1000
' // 
' // Purpose:   Main Client Deployment Wizard Validation routines
' // 
' // ***************************************************************************

Option Explicit

'  Validate Password

Dim Upper,Lower,Number,Special,UpperFound,LowerFound,NumberFound,SpecialFound,PasswordBad

Lower = "abcdefghijklmnopqrstuvwxyz"
Number = "0123456789"
Special = "~!@#$%^&*_-+=`|\(){}[]:;""'<>,.?/"
UpperFound = "NO"
LowerFound = "NO"
NumberFound = "NO"
SpecialFound = "NO"

Function ValidatePassword
	ValidatePassword = ParseAllWarningLabels
	NonMatchPassword.style.display = "none"
	If Password1.Value <> "" then
		If Password1.Value <> Password2.Value then
			ValidatePassword = FALSE
			NonMatchPassword.style.display = "inline"
		End if
	End if
	If len(Password1.Value) < 12 then
		ValidatePassword = FALSE
	End if
	Dim i,char
	for i = 1 to len(Password1.value)
		char = mid(Password1.value,i,1)
		if instr(Upper, char) then
			UpperFound = "YES"
		elseif instr(Lower, char) then
			LowerFound = "YES"
		elseif instr(Number, char) then
			NumberFound = "YES"
		elseif instr(Special, char) then
			SpecialFound = "YES"
		end if
	NonComplexPassword.style.display ="none"
	If UpperFound = "NO" then
		ValidatePassword = FALSE
			NonComplexPassword.style.display ="inline"
	ElseIf LowerFound = "NO" then
		ValidatePassword = FALSE
			NonComplexPassword.style.display ="inline"
	ElseIf NumberFound = "NO" then
		ValidatePassword = FALSE
			NonComplexPassword.style.display ="inline"
	ElseIf SpecialFound = "NO" then
		ValidatePassword = FALSE
			NonComplexPassword.style.display ="inline"
	end if
	ButtonNext.Disabled = not ValidatePassword	

End Function 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close