Helly Guys,
I Have This Script:
and this Script:Code:Option Explicit Dim objOU, objUser, objRootDSE Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("DefaultNamingContext") strContainer = "OU=Development - Secretary,OU=Development,OU=Regular - User's ," intAccValue = 544 strContainer = strContainer & strDNSDomain set objOU =GetObject("LDAP://" & strContainer ) intCounter = 0 For each objUser in objOU If objUser.class="user" then objUser.SetPassword "p@$$w0rd" objUser.SetInfo objUser.Put "userAccountControl", intAccValue objUser.SetInfo intCounter = intCounter +1 strLastUser = objUser.Get ("name") objuser.Put "pwdLastSet", CLng(0) objuser.SetInfo End if next WScript.Echo intCounter & " Users change pwd next logon. Value " _ & intAccValue WScript.Quit
How Can i Combine this 2 scripts to 1?Code:Option Explicit Dim objOU, objUser, objRootDSE Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("DefaultNamingContext") strContainer = "OU=Development - Manager,OU=Development,OU=Regular - User's ," intAccValue = 544 strContainer = strContainer & strDNSDomain set objOU =GetObject("LDAP://" & strContainer ) intCounter = 0 For each objUser in objOU If objUser.class="user" then objUser.SetPassword "p@$$w0rd" objUser.SetInfo objUser.Put "userAccountControl", intAccValue objUser.SetInfo intCounter = intCounter +1 strLastUser = objUser.Get ("name") objuser.Put "pwdLastSet", CLng(0) objuser.SetInfo End if next WScript.Echo intCounter & " Users change pwd next logon. Value " _ & intAccValue WScript.Quit
The only line that im changing is this:
in the first Script:
and in the second script:Code:strContainer = "OU=Development - Secretary,OU=Development,OU=Regular - User's ,"
Can i Write this 2 line's in the same 1 script?Code:strContainer = "OU=Development - Manager,OU=Development,OU=Regular - User's ,"
thank you very much Guys![]()




Reply With Quote