Ok, so my task is to
generate random passwords and enable the accounts for 3200 users. The user
accounts and all attributes were first created with ldife, and I am now thinking
about using the dsmod utility to do accomplish the password set and account
enablement. I wish I knew vbs like you guys do, but I dont yet (this years
resolution). So here is what I have for the password generation
part:
Function Password_GenPass( nNoChars, sValidChars )
' nNoChars = length of generated password
' sValidChars = valid characters. If zerolength-string ( "" )then
' default is used: A-Z AND a-z AND 0-9
' nNoChars = length of generated password
' sValidChars = valid characters. If zerolength-string ( "" )then
' default is used: A-Z AND a-z AND 0-9
Const
szDefault =
"abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789"
Dim nCount
Dim sRet
Dim nNumber
Dim nLength
Dim nCount
Dim sRet
Dim nNumber
Dim nLength
Randomize 'init random
If
sValidChars = "" Then
sValidChars = szDefault
End If
nLength = Len( sValidChars )
sValidChars = szDefault
End If
nLength = Len( sValidChars )
For
nCount = 1 To nNoChars
nNumber = Int((nLength * Rnd) + 1)
sRet = sRet & Mid( sValidChars, nNumber, 1 )
Next
Password_GenPass = sRet
End Function
nNumber = Int((nLength * Rnd) + 1)
sRet = sRet & Mid( sValidChars, nNumber, 1 )
Next
Password_GenPass = sRet
End Function
WScript.Echo "Your password: " & Password_GenPass( 10, ""
)
What is my next
move? I am guessing I have to pass this password to a variable, instead of echo,
and then somehow pass that into the dsmod command, but as I already said, I dont
know vb script. Any help is highly appreciated.
