I am trying to write a VBScript that writes a VBScript out to a *.vbs file(otf). The following is the script that I need my script to generate:
Set cont = GetObject("LDAP://OU=Department, OU=Location, OU=Region, OU=Company, DC=Tree, DC=Forest"
cont.Delete "user", "CN=UserName"
And this is the script that I'm using to write it:
rs.MoveFirst
Do While Not rs.EOF
otf.WriteLine(1, "Set cont = GetObject(", """, "LDAP://OU=", rs.Department, ", OU=", rs.Location, ", OU=", rs.Region, ", OU=Citadel, DC=CCC, DC=CCC", """, ""
oft.WriteLine(1, "cont.Delete ", """, "user", """, ", ", """, "CN=", rs.UserName, """
oft.WriteBlankLines(1)
rs.MoveNext
Now, when I try and compile this code, I get an error that says; "Error Source: Microsoft VBScript Compilation error, Error Description: Expected ')' " and it's saying this error occurred on the first "WriteLine" statement.
Is there a VBScript wizzard out there that can see where the problem is or maybe suggest a better way to accomplish what I'm trying to do? I'm assuming that the problem has something to do with all commas, quotation marks and parentheses that I am trying to write into my output script.
Any suggestions will be greatly appreciated.
Thanks!
Nate
Set cont = GetObject("LDAP://OU=Department, OU=Location, OU=Region, OU=Company, DC=Tree, DC=Forest"
cont.Delete "user", "CN=UserName"
And this is the script that I'm using to write it:
rs.MoveFirst
Do While Not rs.EOF
otf.WriteLine(1, "Set cont = GetObject(", """, "LDAP://OU=", rs.Department, ", OU=", rs.Location, ", OU=", rs.Region, ", OU=Citadel, DC=CCC, DC=CCC", """, ""
oft.WriteLine(1, "cont.Delete ", """, "user", """, ", ", """, "CN=", rs.UserName, """
oft.WriteBlankLines(1)
rs.MoveNext
Now, when I try and compile this code, I get an error that says; "Error Source: Microsoft VBScript Compilation error, Error Description: Expected ')' " and it's saying this error occurred on the first "WriteLine" statement.
Is there a VBScript wizzard out there that can see where the problem is or maybe suggest a better way to accomplish what I'm trying to do? I'm assuming that the problem has something to do with all commas, quotation marks and parentheses that I am trying to write into my output script.
Any suggestions will be greatly appreciated.
Thanks!
Nate