|
Home > Archive > Server 2003 > November 2003 > 296 Study Thread...
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
296 Study Thread...
|
|
| jeff_j_black 2003-10-30, 6:44 pm |
| Well, we certainly have enough folks going for 296, what say we get a focused thread going? Where are you at? What are you working with? (Lab details, etc.) | |
| jeff_j_black 2003-10-30, 6:54 pm |
| I'll throw out the first pitch...
I tossed this out to the MS newsgroups but don't have a response yet:
"The help files indicate that input for the dsadd command can be redirected from a file containing the specified values. What is the syntax for the command line and the
text document?"
I have toyed with this for several days and dug through the MS site over and over reading the same short descriptions and examples, but have not seen specifics on how to redirect from text. These command line ds tools could be extremely handy with this facet revealed. | |
|
| Hey jeff
I think the command line for dsadd when in terms of redirection is what sends us old unix guys laughing to the floor.
From the syntax in the help file and from my few small experiments it seems that the ONLY thing you can supply in the redirected stdin would be the DN ( for ONE object ); other parameters must be supplied from the command line
user.inp
cn=newuser,cn=users,dc=mydomai
n,dc=pri
command line:
dcadd user -ln Smith < user.inp | |
| Tarzanboy 2003-10-31, 3:01 am |
| Darn it Jeff, just when I didn't need a distraction to work on you dig up one for me. 
I am not sure if this is any help, but I noticed that there are 2 flags for Unicode: 1 for input (-uci) and 1 for output (-uco) from/to a pipe or file. Since I don't have a W2k3 box up and running at the moment, I haven't tested it.
Another possibility would be utilizing a little WSH scripting and having it call the data from another file.
Cheers,
TB | |
| jeff_j_black 2003-10-31, 8:25 am |
| hlang,
That is pretty much what I am coming down to.
TB,
Don't sweat it too hard, but the scripting is a good idea, time to play.
Microsoft Solutions for Management
This part of Technet has a lot of interesting info, look for the 'Hands-On Lab' under 'Account Management'. This is the best documentation on the ds commands I have found thus far. | |
| Tarzanboy 2003-11-05, 12:08 pm |
| My assessment after playing with the ds* commands were that they are nice for single instances, but for multiple instances, scripting has to be used.
A rather crude scripting example of dsadd:
code: dim ws, fso, file1
set ws = CreateObject("Wscript.shell")
set fso = CreateObject("Scripting.FileSystemObject")
set file1 = fso.OpenTextFile("test.txt", 1)
dim a, b, test
Do while File1.AtEndOfStream <> True
dim list
list = "dsadd;DN;-desc;-samid;-loc;-memberof;-qlimit"
strNextLine = File1.ReadLine
a = Split(strNextLine , ";")
b = Split(list,";")
test = b(0) & " " & a(0) & " " & chr(34) & a(1) & chr(34)
If Lcase(a(0)) = "ou" OR Lcase(a(0)) = "computer" Then
fit
ElseIf Lcase(a(0)) = "quota" Then
test = b(0) & " " & a(0) & " " & "-part " & chr(34) & a(1) & chr(34)
fit
ElseIf Lcase(a(0)) = "user" Then
list = "dsadd;DN;-display;-ln;-fn;-mi;-upn;-pwd;-mustchpwd;-canchpwd;-reversiblepwd;-pwdneverexpires;-disabled;-acctexpires;-memberof;-desc;-hmdir;-hmdrv;-profile;-loscr;-title;-dept;-office;-company;-mgr;-tel;-email;-hometel;-pager;-mobile;-fax;-iptel;-webpg"
b = Split(list,";")
fit
End If
Loop
Function fit
dim x, go
For x = 2 to UBound(a)
If a(x) <> "" Then
test = test & " " & b(x) & " " & chr(34) & a(x) & chr(34)
x = x + 1
Else
x = x + 1
End If
Next
wscript.echo test
ws.exec test
test = ""
End Function
Data source:
code: Ou;OU=Test OU,DC=Nothing,DC=here;A Test OU
ou;OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;Yet another test
User;CN=Test Account,OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;Test Account;Doe;John;Q;testacct@no
thing. here;gh!tsUm;no;no;yes;yes;yes
;30;CN=Domain Users,CN=Users,DC=Nothing,DC=h
ere;Test User account;;;;;worker;Production;
Denver;Bogus Co;;;gone@home.com;;;;;127.0.0.1
computer;CN=Test System3,OU=Test OU,DC=Nothing,DC=Here;A test system;;Tempe;;
User;CN=Test Account 6,OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;Test Account 6;Doe;John;Q;testacct6@nothing
. here;gh!tsUm;no;no;yes;yes;yes
;30;CN=Domain Users,CN=Users,DC=Nothing,DC=h
ere;Test User account6;;;;;worker;Production
;Denver;Bogus Co;CN=Test Account,OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;;gone@ho
me.com;;;;;127.0.0.1
ou;OU=Another Test 2,OU=Test OU,DC=Nothing,DC=Here;Yet another test 2
coMputer;CN=Test System2,OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;A test system 2;;Tempe;;
User;CN=Test Account 7,OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;Test Account 7;Doe2;John;Q;testacct7@nothin
g. here;gh!tsUm;no;yes;no;yes;no;
30;CN=Domain Users,CN=Users,DC=Nothing,DC=h
ere;Test User account 7;;;;;worker;Production;Denver
;Bogus Co;CN=Test Account,OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;;gone2@h
ome.com;;;;;127.0.0.1
User;CN=Test Account 8,OU=Another Test 2,OU=Test OU,DC=Nothing,DC=Here;Test Account 8;Doe3;John;Q;testacct8@nothin
g. here;gh!tsUm;yes;yes;no;no;no;
30;CN=Domain Users,CN=Users,DC=Nothing,DC=h
ere;Test User account 8;;;;;worker;Production;Denver
;Bogus Co;CN=Test Account,OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;;gone3@h
ome.com;;;;;127.0.0.1
User;CN=Test Account 9,OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;Test Account 9;Doe4;John;Q;testacct9@nothin
g. here;gh!tsUm;yes;yes;no;no;yes
;;CN=Domain Users,CN=Users,DC=Nothing,DC=h
ere;Test User account 9;;;;;worker;Production;Denver
;Bogus Co;CN=Test Account,OU=Another Test,OU=Test OU,DC=Nothing,DC=Here;;gone4@h
ome.com;;;;;127.0.0.1
Cheers,
TB | |
| jeff_j_black 2003-11-06, 12:09 pm |
| The best I got off the MS Newsgroups was probably a little simpler to create. Just use a batch file that would use a loop and read the values from a text file. | |
| Tarzanboy 2003-11-11, 12:18 pm |
| With the rather crude example I gave, you could customize it to include other types or include/remove fields that may or may not be used. As for data input, you could theoretically do a db or spreadsheet export to CSV file with a delimiter other than "," and modify the script or create a text file.
Cheers,
TB |
|
|
|
|