How come I have problems adding a quote into an Active Directory script?

by on May 31, 2011

Q: I’m currently writing a script for adding users to AD (Active Directory) thorugh a CMD window. And I’m experiencing some problems.
The 1st thing is that i can’t seem to add the (“) into the type of line that i need.
dsadd user “cn=
The command is very sensetive , so i kinda need the ” where it belongs.
Anyone got a clue how to add this special character into the script?
2nd i need to know how to export a whole line into a txt file.
I’m currently doing it by using the >> AcitveDirectory.txt
But when I do this , everything i write is typed on a new line..
I’ll try to write the script here , but I’m using ViritualBox without GuestAddon so it’s a bit hard.
And please try answer fast , got a exam coming up 😀
~Alexander Mitchell

EDIT***
dsadd user “cn=USERNAME,ou=MYCLASS,dc=DOMAIN,dc=LOCAL” -fn Firstname -ln Lastname -disabled no -pwd paassword -upn USERNAME


One Response to “How come I have problems adding a quote into an Active Directory script?”
  1.  
    Picked as best answer

    Assuming you’re just writing a batch script, you probably just need an escape character. Have you tried putting a \ in front of the ” ?