top of page
Writer's pictureHamizi Jamaluddin

Sample scripts for dsadd, dsmodify, dsget, dsquery, dsmod, dsmove

AddUsers.bat

dsadd ou "OU=Sales,DC=worldwideimporters,DC=com" dsadd ou "OU=Marketing and Finance,DC=worldwideimporters,DC=com" dsadd user "CN=KimA,OU=Sales,DC=worldwideimporters,DC=com" dsadd user "CN=SeanA,Ou=Sales,DC=worldwideimporters,DC=com" dsadd user "CN=NeilC,Ou=Sales,DC=worldwideimporters,DC=com" dsadd user "CN=AaronC,Ou=Sales,DC=worldwideimporters,DC=com" dsadd user "CN=AndrewH,Ou=Sales,DC=worldwideimporters,DC=com" dsadd user "CN=DonH,Ou=Marketing and Finance,DC=worldwideimporters,DC=com" dsadd user "Cn=GarthF,Ou=Marketing and Finance,DC=worldwideimporters,DC=com" dsadd user "CN=MarkH,Ou=Marketing and Finance,DC=worldwideimporters,DC=com" dsadd user "CN=JoB,Ou=Marketing and Finance,DC=worldwideimporters,DC=com" dsadd user "CN=ScottC,Ou=Marketing and Finance,DC=worldwideimporters,DC=com" dsadd group "CN=Sales Users,CN=users,DC=worldwideimporters,DC=com" -scope g dsadd group "CN=Marketing and Finance Users,CN=users,DC=worldwideimporters,DC=com" -scope g dsadd group "CN=Sales Data,CN=users,DC=worldwideimporters,DC=com" -scope l dsadd group "CN=Marketing and Finance Data,CN=users,DC=worldwideimporters,DC=com" -scope l dsadd computer "CN=SALESWKSTN1,OU=Sales,DC=worldwideimporters,DC=com" dsadd computer "CN=SALESWKSTN2,OU=Sales,DC=worldwideimporters,DC=com" dsadd computer "CN=MAFWKSTN1,OU=Marketing and Finance,DC=worldwideimporters,DC=com" dsadd computer "CN=MAFWKSTN2,OU=Marketing and Finance,DC=worldwideimporters,DC=com"

ModifyMembers.bat

dsmod group "CN=Marketing and Finance users,CN=users,DC=worldwideimporters,DC=com" -addmbr "CN=KimA,OU=Marketing and Finance,DC=worldwideimporters,DC=com" "CN=SeanA,OU=Marketing and Finance,DC=worldwideimporters,DC=com" "CN=AaronC,OU=Marketing and Finance,DC=worldwideimporters,DC=com"

dsmod user "CN=KimA,OU=Marketing and Finance,DC=worldwideimporters,Dc=com" "CN=SeanA,OU=Marketing and Finance,DC=worldwideimporters,DC=com" "CN=AaronC,OU=Marketing and Finance,DC=worldwideimporters,DC=com" -pwd Abcd123 -mustchpwd yes

MoveUsers.bat

dsmove "CN=KimA,OU=Sales,DC=worldwideimporters,DC=com" -newparent "OU=Marketing and Finance,DC=worldwideimporters,DC=com"

dsmove "CN=AaronC,OU=Sales,DC=worldwideimporters,DC=com" -newparent "OU=Marketing and Finance,DC=worldwideimporters,DC=com"

dsmove "CN=SeanA,OU=Sales,DC=worldwideimporters,DC=com" -newparent "OU=Marketing and Finance,DC=worldwideimporters,DC=com"ModifyMembers.bat

QueryUsers.bat

dsget user "CN=KimA,OU=Sales,DC=worldwideimporters,DC=Com" -memberof -expand >"c:\documents and Settings\All Users\Desktop\userinfo.txt"

dsquery user "OU=Sales,DC=worldwideimporters,DC=com" >>"c:\documents and Settings\All Users\Desktop\userinfo.txt"

dsquery user "OU=Marketing and Finance,DC=worldwideimporters,DC=com" >>"c:\documents and Settings\All Users\Desktop\userinfo.txt"

Notepad "c:\documents and Settings\All Users\Desktop\userinfo.txt"

Remove1.bat

dsrm -noprompt -c "cn=KimA,OU=Marketing and Finance,DC=worldwideimporters,DC=com" dsrm -noprompt -c "CN=mafwkstn1,OU=Marketing and Finance,DC=worldwideimporters,DC=com" dsrm -noprompt -c "CN=Marketing and Finance Users,CN=Users,DC=worldwideimporters,DC=com" dsrm -subtree -noprompt -c "OU=Marketing and Finance,DC=worldwideimporters,DC=com"

RemoveAll.bat

dsrm -subtree -noprompt -c "OU=Sales,DC=worldwideimporters,DC=com" dsrm -noprompt -c "CN=Marketing and Finance Data,CN=Users,DC=worldwideimporters,DC=com" dsrm -noprompt -c "CN=Sales Users,CN=Users,DC=worldwideimporters,DC=com" dsrm -noprompt -c "CN=Sales data,CN=Users,DC=worldwideimporters,DC=com"

100 views0 comments

Recent Posts

See All

Comments


bottom of page