|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CSVDE Password Limitations - [WP]
I am importing users into AD from CSV file and ran into password assigning
limitations. For now I would like to assign a generic password for all the users. I am importing these users in a OU and they will be disabled when imported. How can I assign password to these users so they could change them at logon? CSVDE does not let me do this? How can I assign password to these users? I am trying to avoid VB or other complex scripts. Advise Please. Thanks,
Show quote
"WILDPACKET" <WILDPAC***@discussions.microsoft.com> wrote in message The csvde utility cannot assign passwords. Since you already have the csv news:F5C41503-810B-4050-ADE7-3762DE936B5C@microsoft.com... > > I am importing users into AD from CSV file and ran into password assigning > limitations. For now I would like to assign a generic password for all > the > users. > > I am importing these users in a OU and they will be disabled when > imported. > How can I assign password to these users so they could change them at > logon? > > CSVDE does not let me do this? How can I assign password to these users? > I > am trying to avoid VB or other complex scripts. file with user Distinguished Names, this can be used with either a command line utility or a script to assign the passwords, assuming you intend to assign the same password to all of the new users. A VBScript example could be: ============== Const ForReading = 1 ' Specify the csv file. strFilePath = "c:\MyFolder\NewUsers.csv" ' Open the file for read access. Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile(strFilePath, ForReading) ' Specify the new password. strPassword = "zyx$321" ' Read each line of the file. Do Until objFile.AtEndOfStream strLine = Trim(objFile.ReadLine) ' Skip blank lines. If (strUserDN <> "") Then ' Parse the line into fields ' delimited by a quote followed by a comma. arrFields = Split(strLine, """,") ' User DN is the first field with the leading ' quote stripped off. strUserDN = Mid(arrFields(0), 2) ' Bind to the user object. Set objUser = GetObject("LDAP://" & strUserDN) ' Set the password. objUser.SetPassword strPassword End If Loop ' Clean up. objFile.Close ========== The hard part is parsing the csv file. We know that the user DN is the first field and that it must be enclosed with quotes, because we know it has embedded commas. We do not know if any of the other fields are enclosed with quotes, but that's OK. If we use the Split function to break up the line into fields delimited by a quote followed by a comma, we know the first field (index 0 since arrays are zero based) will be the user DN with a leading quote, but with the trailing quote stripped off. The Mid function strips off the leading quote by taking all of the first field starting with the second character. I also have a few example VBScript programs to reset passwords linked on this page: http://www.rlmueller.net/freecode4.htm The first three programs are for setting passwords in bulk, the first two from text files, the third from a spreadsheet. These would be useful if you want to assign a different password for each user (and communicate the password to each user individually). Your csv file can be easily converted to a spreadsheet, where you could insert a column (the second column) for the password. If you want to stay away from scripts, I believe Joe Richards' free ADMod command line utility can do this. You'll have to check his documentation: http://www.joeware.net/freetools/tools/admod/index.htm Thank you Richard for your assistance.
I was able to find a VB with which I can enable all the accounts which are imported from the CSV and now from here on I will check into the script which you mentioned to assign a password. Yes, I intend to assign a generic password for all these users. Show quote "Richard Mueller [MVP]" wrote: > > "WILDPACKET" <WILDPAC***@discussions.microsoft.com> wrote in message > news:F5C41503-810B-4050-ADE7-3762DE936B5C@microsoft.com... > > > > I am importing users into AD from CSV file and ran into password assigning > > limitations. For now I would like to assign a generic password for all > > the > > users. > > > > I am importing these users in a OU and they will be disabled when > > imported. > > How can I assign password to these users so they could change them at > > logon? > > > > CSVDE does not let me do this? How can I assign password to these users? > > I > > am trying to avoid VB or other complex scripts. > > The csvde utility cannot assign passwords. Since you already have the csv > file with user Distinguished Names, this can be used with either a command > line utility or a script to assign the passwords, assuming you intend to > assign the same password to all of the new users. A VBScript example could > be: > ============== > Const ForReading = 1 > > ' Specify the csv file. > strFilePath = "c:\MyFolder\NewUsers.csv" > > ' Open the file for read access. > Set objFSO = CreateObject("Scripting.FileSystemObject") > Set objFile = objFSO.OpenTextFile(strFilePath, ForReading) > > ' Specify the new password. > strPassword = "zyx$321" > > ' Read each line of the file. > Do Until objFile.AtEndOfStream > strLine = Trim(objFile.ReadLine) > ' Skip blank lines. > If (strUserDN <> "") Then > ' Parse the line into fields > ' delimited by a quote followed by a comma. > arrFields = Split(strLine, """,") > ' User DN is the first field with the leading > ' quote stripped off. > strUserDN = Mid(arrFields(0), 2) > ' Bind to the user object. > Set objUser = GetObject("LDAP://" & strUserDN) > ' Set the password. > objUser.SetPassword strPassword > End If > Loop > > ' Clean up. > objFile.Close > ========== > The hard part is parsing the csv file. We know that the user DN is the first > field and that it must be enclosed with quotes, because we know it has > embedded commas. We do not know if any of the other fields are enclosed with > quotes, but that's OK. If we use the Split function to break up the line > into fields delimited by a quote followed by a comma, we know the first > field (index 0 since arrays are zero based) will be the user DN with a > leading quote, but with the trailing quote stripped off. The Mid function > strips off the leading quote by taking all of the first field starting with > the second character. > > I also have a few example VBScript programs to reset passwords linked on > this page: > > http://www.rlmueller.net/freecode4.htm > > The first three programs are for setting passwords in bulk, the first two > from text files, the third from a spreadsheet. These would be useful if you > want to assign a different password for each user (and communicate the > password to each user individually). Your csv file can be easily converted > to a spreadsheet, where you could insert a column (the second column) for > the password. > > If you want to stay away from scripts, I believe Joe Richards' free ADMod > command line utility can do this. You'll have to check his documentation: > > http://www.joeware.net/freetools/tools/admod/index.htm > > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab - http://www.rlmueller.net > -- > > > Starngeness occuring ...
If I create and disable a user manually this script when I run it enables it without any problem....good. ' Set AccountControl.vbs ' Example VBScript to enable user accounts in a named OU ' Author Guy Thomas http://computerperformance.co.uk/ ' Version 1.7 - March 21st 2004 ' -----------------------------------------------------------------' Option Explicit Dim objOU, objUser, objRootDSE Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("DefaultNamingContext") strContainer = "OU=Test ," intAccValue = 512 strContainer = strContainer & strDNSDomain set objOU =GetObject("LDAP://" & strContainer ) intCounter = 0 For each objUser in objOU If objUser.class="user" then objUser.Put "userAccountControl", intAccValue objUser.SetInfo intCounter = intCounter +1 strLastUser = objUser.Get ("name") End if next WScript.Echo intCounter & " Accounts Enabled. Value " _ & intAccValue WScript.Quit ' End of VBScript Example but it fails to enable those users which are imported from a CSV file in my TEST OU. It gives me an error saying ... the server is unwilling to process the request. Advise Please. Show quote "WILDPACKET" wrote: > > > Thank you Richard for your assistance. > > I was able to find a VB with which I can enable all the accounts which are > imported from the CSV and now from here on I will check into the script which > you mentioned to assign a password. > > Yes, I intend to assign a generic password for all these users. > > > > "Richard Mueller [MVP]" wrote: > > > > > "WILDPACKET" <WILDPAC***@discussions.microsoft.com> wrote in message > > news:F5C41503-810B-4050-ADE7-3762DE936B5C@microsoft.com... > > > > > > I am importing users into AD from CSV file and ran into password assigning > > > limitations. For now I would like to assign a generic password for all > > > the > > > users. > > > > > > I am importing these users in a OU and they will be disabled when > > > imported. > > > How can I assign password to these users so they could change them at > > > logon? > > > > > > CSVDE does not let me do this? How can I assign password to these users? > > > I > > > am trying to avoid VB or other complex scripts. > > > > The csvde utility cannot assign passwords. Since you already have the csv > > file with user Distinguished Names, this can be used with either a command > > line utility or a script to assign the passwords, assuming you intend to > > assign the same password to all of the new users. A VBScript example could > > be: > > ============== > > Const ForReading = 1 > > > > ' Specify the csv file. > > strFilePath = "c:\MyFolder\NewUsers.csv" > > > > ' Open the file for read access. > > Set objFSO = CreateObject("Scripting.FileSystemObject") > > Set objFile = objFSO.OpenTextFile(strFilePath, ForReading) > > > > ' Specify the new password. > > strPassword = "zyx$321" > > > > ' Read each line of the file. > > Do Until objFile.AtEndOfStream > > strLine = Trim(objFile.ReadLine) > > ' Skip blank lines. > > If (strUserDN <> "") Then > > ' Parse the line into fields > > ' delimited by a quote followed by a comma. > > arrFields = Split(strLine, """,") > > ' User DN is the first field with the leading > > ' quote stripped off. > > strUserDN = Mid(arrFields(0), 2) > > ' Bind to the user object. > > Set objUser = GetObject("LDAP://" & strUserDN) > > ' Set the password. > > objUser.SetPassword strPassword > > End If > > Loop > > > > ' Clean up. > > objFile.Close > > ========== > > The hard part is parsing the csv file. We know that the user DN is the first > > field and that it must be enclosed with quotes, because we know it has > > embedded commas. We do not know if any of the other fields are enclosed with > > quotes, but that's OK. If we use the Split function to break up the line > > into fields delimited by a quote followed by a comma, we know the first > > field (index 0 since arrays are zero based) will be the user DN with a > > leading quote, but with the trailing quote stripped off. The Mid function > > strips off the leading quote by taking all of the first field starting with > > the second character. > > > > I also have a few example VBScript programs to reset passwords linked on > > this page: > > > > http://www.rlmueller.net/freecode4.htm > > > > The first three programs are for setting passwords in bulk, the first two > > from text files, the third from a spreadsheet. These would be useful if you > > want to assign a different password for each user (and communicate the > > password to each user individually). Your csv file can be easily converted > > to a spreadsheet, where you could insert a column (the second column) for > > the password. > > > > If you want to stay away from scripts, I believe Joe Richards' free ADMod > > command line utility can do this. You'll have to check his documentation: > > > > http://www.joeware.net/freetools/tools/admod/index.htm > > > > -- > > Richard Mueller > > Microsoft MVP Scripting and ADSI > > Hilltop Lab - http://www.rlmueller.net > > -- > > > > > > Found this
http://www.computerperformance.co.uk/Logon/code/code_80072035.htm but dont know how to add the set password isntruction into the script as the writer suggests. Show quote "WILDPACKET" wrote: > > Starngeness occuring ... > > If I create and disable a user manually this script when I run it enables it > without any problem....good. > > ' Set AccountControl.vbs > ' Example VBScript to enable user accounts in a named OU > ' Author Guy Thomas http://computerperformance.co.uk/ > ' Version 1.7 - March 21st 2004 > ' -----------------------------------------------------------------' > Option Explicit > Dim objOU, objUser, objRootDSE > Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue > Set objRootDSE = GetObject("LDAP://RootDSE") > strDNSDomain = objRootDSE.Get("DefaultNamingContext") > strContainer = "OU=Test ," > intAccValue = 512 > strContainer = strContainer & strDNSDomain > set objOU =GetObject("LDAP://" & strContainer ) > intCounter = 0 > For each objUser in objOU > If objUser.class="user" then > objUser.Put "userAccountControl", intAccValue > objUser.SetInfo > intCounter = intCounter +1 > strLastUser = objUser.Get ("name") > End if > next > WScript.Echo intCounter & " Accounts Enabled. Value " _ > & intAccValue > WScript.Quit > > ' End of VBScript Example > > > > but it fails to enable those users which are imported from a CSV file in my > TEST OU. > > It gives me an error saying ... the server is unwilling to process the > request. > > Advise Please. > > > > > > "WILDPACKET" wrote: > > > > > > > Thank you Richard for your assistance. > > > > I was able to find a VB with which I can enable all the accounts which are > > imported from the CSV and now from here on I will check into the script which > > you mentioned to assign a password. > > > > Yes, I intend to assign a generic password for all these users. > > > > > > > > "Richard Mueller [MVP]" wrote: > > > > > > > > "WILDPACKET" <WILDPAC***@discussions.microsoft.com> wrote in message > > > news:F5C41503-810B-4050-ADE7-3762DE936B5C@microsoft.com... > > > > > > > > I am importing users into AD from CSV file and ran into password assigning > > > > limitations. For now I would like to assign a generic password for all > > > > the > > > > users. > > > > > > > > I am importing these users in a OU and they will be disabled when > > > > imported. > > > > How can I assign password to these users so they could change them at > > > > logon? > > > > > > > > CSVDE does not let me do this? How can I assign password to these users? > > > > I > > > > am trying to avoid VB or other complex scripts. > > > > > > The csvde utility cannot assign passwords. Since you already have the csv > > > file with user Distinguished Names, this can be used with either a command > > > line utility or a script to assign the passwords, assuming you intend to > > > assign the same password to all of the new users. A VBScript example could > > > be: > > > ============== > > > Const ForReading = 1 > > > > > > ' Specify the csv file. > > > strFilePath = "c:\MyFolder\NewUsers.csv" > > > > > > ' Open the file for read access. > > > Set objFSO = CreateObject("Scripting.FileSystemObject") > > > Set objFile = objFSO.OpenTextFile(strFilePath, ForReading) > > > > > > ' Specify the new password. > > > strPassword = "zyx$321" > > > > > > ' Read each line of the file. > > > Do Until objFile.AtEndOfStream > > > strLine = Trim(objFile.ReadLine) > > > ' Skip blank lines. > > > If (strUserDN <> "") Then > > > ' Parse the line into fields > > > ' delimited by a quote followed by a comma. > > > arrFields = Split(strLine, """,") > > > ' User DN is the first field with the leading > > > ' quote stripped off. > > > strUserDN = Mid(arrFields(0), 2) > > > ' Bind to the user object. > > > Set objUser = GetObject("LDAP://" & strUserDN) > > > ' Set the password. > > > objUser.SetPassword strPassword > > > End If > > > Loop > > > > > > ' Clean up. > > > objFile.Close > > > ========== > > > The hard part is parsing the csv file. We know that the user DN is the first > > > field and that it must be enclosed with quotes, because we know it has > > > embedded commas. We do not know if any of the other fields are enclosed with > > > quotes, but that's OK. If we use the Split function to break up the line > > > into fields delimited by a quote followed by a comma, we know the first > > > field (index 0 since arrays are zero based) will be the user DN with a > > > leading quote, but with the trailing quote stripped off. The Mid function > > > strips off the leading quote by taking all of the first field starting with > > > the second character. > > > > > > I also have a few example VBScript programs to reset passwords linked on > > > this page: > > > > > > http://www.rlmueller.net/freecode4.htm > > > > > > The first three programs are for setting passwords in bulk, the first two > > > from text files, the third from a spreadsheet. These would be useful if you > > > want to assign a different password for each user (and communicate the > > > password to each user individually). Your csv file can be easily converted > > > to a spreadsheet, where you could insert a column (the second column) for > > > the password. > > > > > > If you want to stay away from scripts, I believe Joe Richards' free ADMod > > > command line utility can do this. You'll have to check his documentation: > > > > > > http://www.joeware.net/freetools/tools/admod/index.htm > > > > > > -- > > > Richard Mueller > > > Microsoft MVP Scripting and ADSI > > > Hilltop Lab - http://www.rlmueller.net > > > -- > > > > > > > > > Please ignore my earlier posts all have been successfully resolved all works
now. Your script was greata!!!! Now I will do a final last test in my lab. I will have the CSV with 400 users which I have to import next week. All these users will go in an OU in my production DC. The OU in which all these 400 users will be parked is 2 level deep. Example: DomainName OU at the root. |_Province OU I tried to make DN for this in my excel file not working. How can I creat a |_ City OU |_ Field Tech (This is where all the 400 users will be parked) DN Attrib for this OU? Advise Please. Thank you. Show quote "WILDPACKET" wrote: > > Found this > http://www.computerperformance.co.uk/Logon/code/code_80072035.htm > > but dont know how to add the set password isntruction into the script as the > writer suggests. > > > > > > "WILDPACKET" wrote: > > > > > Starngeness occuring ... > > > > If I create and disable a user manually this script when I run it enables it > > without any problem....good. > > > > ' Set AccountControl.vbs > > ' Example VBScript to enable user accounts in a named OU > > ' Author Guy Thomas http://computerperformance.co.uk/ > > ' Version 1.7 - March 21st 2004 > > ' -----------------------------------------------------------------' > > Option Explicit > > Dim objOU, objUser, objRootDSE > > Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue > > Set objRootDSE = GetObject("LDAP://RootDSE") > > strDNSDomain = objRootDSE.Get("DefaultNamingContext") > > strContainer = "OU=Test ," > > intAccValue = 512 > > strContainer = strContainer & strDNSDomain > > set objOU =GetObject("LDAP://" & strContainer ) > > intCounter = 0 > > For each objUser in objOU > > If objUser.class="user" then > > objUser.Put "userAccountControl", intAccValue > > objUser.SetInfo > > intCounter = intCounter +1 > > strLastUser = objUser.Get ("name") > > End if > > next > > WScript.Echo intCounter & " Accounts Enabled. Value " _ > > & intAccValue > > WScript.Quit > > > > ' End of VBScript Example > > > > > > > > but it fails to enable those users which are imported from a CSV file in my > > TEST OU. > > > > It gives me an error saying ... the server is unwilling to process the > > request. > > > > Advise Please. > > > > > > > > > > > > "WILDPACKET" wrote: > > > > > > > > > > > Thank you Richard for your assistance. > > > > > > I was able to find a VB with which I can enable all the accounts which are > > > imported from the CSV and now from here on I will check into the script which > > > you mentioned to assign a password. > > > > > > Yes, I intend to assign a generic password for all these users. > > > > > > > > > > > > "Richard Mueller [MVP]" wrote: > > > > > > > > > > > "WILDPACKET" <WILDPAC***@discussions.microsoft.com> wrote in message > > > > news:F5C41503-810B-4050-ADE7-3762DE936B5C@microsoft.com... > > > > > > > > > > I am importing users into AD from CSV file and ran into password assigning > > > > > limitations. For now I would like to assign a generic password for all > > > > > the > > > > > users. > > > > > > > > > > I am importing these users in a OU and they will be disabled when > > > > > imported. > > > > > How can I assign password to these users so they could change them at > > > > > logon? > > > > > > > > > > CSVDE does not let me do this? How can I assign password to these users? > > > > > I > > > > > am trying to avoid VB or other complex scripts. > > > > > > > > The csvde utility cannot assign passwords. Since you already have the csv > > > > file with user Distinguished Names, this can be used with either a command > > > > line utility or a script to assign the passwords, assuming you intend to > > > > assign the same password to all of the new users. A VBScript example could > > > > be: > > > > ============== > > > > Const ForReading = 1 > > > > > > > > ' Specify the csv file. > > > > strFilePath = "c:\MyFolder\NewUsers.csv" > > > > > > > > ' Open the file for read access. > > > > Set objFSO = CreateObject("Scripting.FileSystemObject") > > > > Set objFile = objFSO.OpenTextFile(strFilePath, ForReading) > > > > > > > > ' Specify the new password. > > > > strPassword = "zyx$321" > > > > > > > > ' Read each line of the file. > > > > Do Until objFile.AtEndOfStream > > > > strLine = Trim(objFile.ReadLine) > > > > ' Skip blank lines. > > > > If (strUserDN <> "") Then > > > > ' Parse the line into fields > > > > ' delimited by a quote followed by a comma. > > > > arrFields = Split(strLine, """,") > > > > ' User DN is the first field with the leading > > > > ' quote stripped off. > > > > strUserDN = Mid(arrFields(0), 2) > > > > ' Bind to the user object. > > > > Set objUser = GetObject("LDAP://" & strUserDN) > > > > ' Set the password. > > > > objUser.SetPassword strPassword > > > > End If > > > > Loop > > > > > > > > ' Clean up. > > > > objFile.Close > > > > ========== > > > > The hard part is parsing the csv file. We know that the user DN is the first > > > > field and that it must be enclosed with quotes, because we know it has > > > > embedded commas. We do not know if any of the other fields are enclosed with > > > > quotes, but that's OK. If we use the Split function to break up the line > > > > into fields delimited by a quote followed by a comma, we know the first > > > > field (index 0 since arrays are zero based) will be the user DN with a > > > > leading quote, but with the trailing quote stripped off. The Mid function > > > > strips off the leading quote by taking all of the first field starting with > > > > the second character. > > > > > > > > I also have a few example VBScript programs to reset passwords linked on > > > > this page: > > > > > > > > http://www.rlmueller.net/freecode4.htm > > > > > > > > The first three programs are for setting passwords in bulk, the first two > > > > from text files, the third from a spreadsheet. These would be useful if you > > > > want to assign a different password for each user (and communicate the > > > > password to each user individually). Your csv file can be easily converted > > > > to a spreadsheet, where you could insert a column (the second column) for > > > > the password. > > > > > > > > If you want to stay away from scripts, I believe Joe Richards' free ADMod > > > > command line utility can do this. You'll have to check his documentation: > > > > > > > > http://www.joeware.net/freetools/tools/admod/index.htm > > > > > > > > -- > > > > Richard Mueller > > > > Microsoft MVP Scripting and ADSI > > > > Hilltop Lab - http://www.rlmueller.net > > > > -- > > > > > > > > > > > > The DN for an example user named "cn=Jim Smith" in the OU you describe would
be: "cn=Jim Smith,ou=Field Tech,ou=City,ou=Province,dc=MyDomain,dc=com" assuming your domain is MyDomain.com. In case it matters, if any of the names have embedded commas, they must be escaped with the backslash "\" escape character. For example, for "cn=Smith, Jim" the DN would be: "cn=Smith\, Jim,ou=Field Tech,ou=City,ou=Province,dc=MyDomain,dc=com" The DN of the OU object itself would be: "ou=Field Tech,ou=City,ou=Province,dc=MyDomain,dc=com" Show quote "WILDPACKET" <WILDPAC***@discussions.microsoft.com> wrote in message news:F56CA1E6-28D0-425A-AB94-3FD046F6D282@microsoft.com... > > Please ignore my earlier posts all have been successfully resolved all > works > now. Your script was greata!!!! > > > Now I will do a final last test in my lab. I will have the CSV with 400 > users which I have to import next week. > > > All these users will go in an OU in my production DC. The OU in which all > these 400 users will be parked is 2 level deep. > > Example: > > DomainName OU at the root. > |_Province OU > |_ City OU > |_ Field Tech (This is where all the 400 users will be > parked) > > I tried to make DN for this in my excel file not working. How can I creat > a > DN Attrib for this OU? > > Advise Please. > > Thank you. > > > > > > > > > "WILDPACKET" wrote: > >> >> Found this >> http://www.computerperformance.co.uk/Logon/code/code_80072035.htm >> >> but dont know how to add the set password isntruction into the script as >> the >> writer suggests. >> >> >> >> >> >> "WILDPACKET" wrote: >> >> > >> > Starngeness occuring ... >> > >> > If I create and disable a user manually this script when I run it >> > enables it >> > without any problem....good. >> > >> > ' Set AccountControl.vbs >> > ' Example VBScript to enable user accounts in a named OU >> > ' Author Guy Thomas http://computerperformance.co.uk/ >> > ' Version 1.7 - March 21st 2004 >> > ' -----------------------------------------------------------------' >> > Option Explicit >> > Dim objOU, objUser, objRootDSE >> > Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue >> > Set objRootDSE = GetObject("LDAP://RootDSE") >> > strDNSDomain = objRootDSE.Get("DefaultNamingContext") >> > strContainer = "OU=Test ," >> > intAccValue = 512 >> > strContainer = strContainer & strDNSDomain >> > set objOU =GetObject("LDAP://" & strContainer ) >> > intCounter = 0 >> > For each objUser in objOU >> > If objUser.class="user" then >> > objUser.Put "userAccountControl", intAccValue >> > objUser.SetInfo >> > intCounter = intCounter +1 >> > strLastUser = objUser.Get ("name") >> > End if >> > next >> > WScript.Echo intCounter & " Accounts Enabled. Value " _ >> > & intAccValue >> > WScript.Quit >> > >> > ' End of VBScript Example >> > >> > >> > >> > but it fails to enable those users which are imported from a CSV file >> > in my >> > TEST OU. >> > >> > It gives me an error saying ... the server is unwilling to process the >> > request. >> > >> > Advise Please. >> > >> > >> > >> > >> > >> > "WILDPACKET" wrote: >> > >> > > >> > > >> > > Thank you Richard for your assistance. >> > > >> > > I was able to find a VB with which I can enable all the accounts >> > > which are >> > > imported from the CSV and now from here on I will check into the >> > > script which >> > > you mentioned to assign a password. >> > > >> > > Yes, I intend to assign a generic password for all these users. >> > > >> > > >> > > >> > > "Richard Mueller [MVP]" wrote: >> > > >> > > > >> > > > "WILDPACKET" <WILDPAC***@discussions.microsoft.com> wrote in >> > > > message >> > > > news:F5C41503-810B-4050-ADE7-3762DE936B5C@microsoft.com... >> > > > > >> > > > > I am importing users into AD from CSV file and ran into password >> > > > > assigning >> > > > > limitations. For now I would like to assign a generic password >> > > > > for all >> > > > > the >> > > > > users. >> > > > > >> > > > > I am importing these users in a OU and they will be disabled when >> > > > > imported. >> > > > > How can I assign password to these users so they could change >> > > > > them at >> > > > > logon? >> > > > > >> > > > > CSVDE does not let me do this? How can I assign password to >> > > > > these users? >> > > > > I >> > > > > am trying to avoid VB or other complex scripts. >> > > > >> > > > The csvde utility cannot assign passwords. Since you already have >> > > > the csv >> > > > file with user Distinguished Names, this can be used with either a >> > > > command >> > > > line utility or a script to assign the passwords, assuming you >> > > > intend to >> > > > assign the same password to all of the new users. A VBScript >> > > > example could >> > > > be: >> > > > ============== >> > > > Const ForReading = 1 >> > > > >> > > > ' Specify the csv file. >> > > > strFilePath = "c:\MyFolder\NewUsers.csv" >> > > > >> > > > ' Open the file for read access. >> > > > Set objFSO = CreateObject("Scripting.FileSystemObject") >> > > > Set objFile = objFSO.OpenTextFile(strFilePath, ForReading) >> > > > >> > > > ' Specify the new password. >> > > > strPassword = "zyx$321" >> > > > >> > > > ' Read each line of the file. >> > > > Do Until objFile.AtEndOfStream >> > > > strLine = Trim(objFile.ReadLine) >> > > > ' Skip blank lines. >> > > > If (strUserDN <> "") Then >> > > > ' Parse the line into fields >> > > > ' delimited by a quote followed by a comma. >> > > > arrFields = Split(strLine, """,") >> > > > ' User DN is the first field with the leading >> > > > ' quote stripped off. >> > > > strUserDN = Mid(arrFields(0), 2) >> > > > ' Bind to the user object. >> > > > Set objUser = GetObject("LDAP://" & strUserDN) >> > > > ' Set the password. >> > > > objUser.SetPassword strPassword >> > > > End If >> > > > Loop >> > > > >> > > > ' Clean up. >> > > > objFile.Close >> > > > ========== >> > > > The hard part is parsing the csv file. We know that the user DN is >> > > > the first >> > > > field and that it must be enclosed with quotes, because we know it >> > > > has >> > > > embedded commas. We do not know if any of the other fields are >> > > > enclosed with >> > > > quotes, but that's OK. If we use the Split function to break up the >> > > > line >> > > > into fields delimited by a quote followed by a comma, we know the >> > > > first >> > > > field (index 0 since arrays are zero based) will be the user DN >> > > > with a >> > > > leading quote, but with the trailing quote stripped off. The Mid >> > > > function >> > > > strips off the leading quote by taking all of the first field >> > > > starting with >> > > > the second character. >> > > > >> > > > I also have a few example VBScript programs to reset passwords >> > > > linked on >> > > > this page: >> > > > >> > > > http://www.rlmueller.net/freecode4.htm >> > > > >> > > > The first three programs are for setting passwords in bulk, the >> > > > first two >> > > > from text files, the third from a spreadsheet. These would be >> > > > useful if you >> > > > want to assign a different password for each user (and communicate >> > > > the >> > > > password to each user individually). Your csv file can be easily >> > > > converted >> > > > to a spreadsheet, where you could insert a column (the second >> > > > column) for >> > > > the password. >> > > > >> > > > If you want to stay away from scripts, I believe Joe Richards' free >> > > > ADMod >> > > > command line utility can do this. You'll have to check his >> > > > documentation: >> > > > >> > > > http://www.joeware.net/freetools/tools/admod/index.htm >> > > > >> > > > -- >> > > > Richard Mueller >> > > > Microsoft MVP Scripting and ADSI >> > > > Hilltop Lab - http://www.rlmueller.net >> > > > -- >> > > > >> > > > >> > > > |
|||||||||||||||||||||||