"Too many elements" or "Invalid value" error / comma in command in-parameter
Top  Previous  Next


Applies to: AD.Account.SetProperty, Exchange.55.Mailbox.SetProperty, Exchange.2k.Mailbox.SetProperty

SetupBatcher can not normally handle the comma character in command in-parameters unless it is in the last parameter of a command. This is because commas normally are used as delimiter between command parameters - when a comma is used within a parameter itself, there is no way to differ between delimiter commas and in-parameter commas.

Solution: surround the parameter that contains commas with quotes.

Example:

AD.Account.SetProperty %ADOUPath%/cn="Smith\, Steve",UserPrincipalName,Steve.Smith@acme.com

Notice: Windows 2000 / Exchange 2000 requires that commas in the common name are preceded with a backslash. Example: "Smith\, Steve". (The backslash is invisible in AD.) To add backslashes to a column; click "Edit Data / Replace text" and enter replace text "," with text "\,". No backslashes are needed in Exchange 5.5.

Full example 1
Surround the column variable in the [Batch] section with quotes.

[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=4

SET ADDomainPath=dc=com/dc=acme/dc=d31
SET ADOUName=MyOU
SET ADOUPath=%ADDomainPath%/ou=%ADOUName%
[Settings_End]

[Machines_Begin]
\\MAIN04
[Machines_End]

[Batch_Begin]
Data.Loop   
 AD.Account.SetProperty %ADOUPath%/cn="%col1%",UserPrincipalName,%col2%   
Data.EndLoop   
[Batch_End]

[Data_Begin]
Smith\, Steve   steve.smith@acme.com      
Rogers\, Susan   susan.rogers@acme.com      
[Data_End]

Full example 2
Surround entire AccountADPath parameter in [Batch] section with quotes (use above example 1 and edit [Batch] section).

[Batch_Begin]
Data.Loop   
 AD.Account.SetProperty "%ADOUPath%/cn=%col1%",UserPrincipalName,%col2%   
Data.EndLoop   
[Batch_End]

Full example 3
Surround actual data in [Data] section with quotes (use above example 1 and edit [Batch] and [Data] section).

[Batch_Begin]
Data.Loop   
 AD.Account.SetProperty %ADOUPath%/cn=%col1%,UserPrincipalName,%col2%   
Data.EndLoop   
[Batch_End]

[Data_Begin]
"Smith\, Steve"   asteve.smith@acme.com      
"Rogers\, Susan"   asusan.rogers@acme.com      
[Data_End]

Full example 4
Surround AccountADPath parameter in [Batch] section with quotes, read entire AccountADPath parameter from [Data] section.

[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=4
[Settings_End]

[Machines_Begin]
\\MAIN04
[Machines_End]

[Batch_Begin]
Data.Loop   
 AD.Account.SetProperty "%col1%",UserPrincipalName,%col2%   
Data.EndLoop   
[Batch_End]

[Data_Begin]
dc=com/dc=acme/dc=d31/ou=myou/cn=Smith\, Steve   tsteve.smith@acme.com      
dc=com/dc=acme/dc=d31/ou=myou/cn=Rogers\, Susan   tsusan.rogers@acme.com      
[Data_End]


Old workaround: set command delimiter to semicolon instead of comma.


Add this line to the settings section -

BatchSettings.CommandDelimiter=;

And replace the command delimiter commas for ALL commands in the batch / undo batch sections with semicolons.

Windows 2000 Example - set UPN for an account with a comma in the CN

[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.CommandDelimiter=;
BatchSettings.MarkerCol=4
SET ADDomainPath=dc=com/dc=acme/dc=D09
SET ADOUName=MyOU
SET ADOUPath=%ADDomainPath%/ou=%ADOUName%
[Settings_End]

[Machines_Begin]
\\MAIN01
[Machines_End]

[Batch_Begin]
Data.Loop   
 AD.Account.SetProperty %ADOUPath%/cn=%Col1%;UserPrincipalName;%col2%@acme.com   
Data.Endloop   
[Batch_End]

[Data_Begin]
Smith\, Steve   Steve.Smith
[Data_End]


Notice the semicolons on the "AD.Account.SetProperty" row.

Exchange 5.5 Example - comma in Exchange 5.5 display name

[Settings_Begin]
BatchSettings.Delimiter=;
BatchSettings.MarkerCol=6
BatchSettings.CommandDelimiter=;
Account.FullName=%col3% %col4%
Account.Password.Col=2
Account.Description=Finance
SET username=%col1%
SET ExchContPath=o=y/ou=D30/cn=Recipients
SET NTdomain=D30
SET EmailSuffix=acme.com
[Settings_End]

[Machines_Begin]
\\EDU2830      NT PDC    
[Machines_End]

[Batch_Begin]
Data.Loop   
 Account.Create %username%   
 Exchange.55.Mailbox.Create %servername2%;%ExchContPath%;%NTdomain%;%username%;%col3%, %col4%;@%EmailSuffix%   
 Exchange.55.Mailbox.SetProperty %servername2%;%ExchContPath%;%username%;textEncodedORAddress;c=SE;a= ;p=acme;o=y;s=%col1%;g=%col4%;   
 Exchange.55.Mailbox.SetProperty %servername2%;%ExchContPath%;%username%;department;Finance   
 Exchange.55.Mailbox.SetProperty %servername2%;%ExchContPath%;%username%;givenName;%col4%   
 Exchange.55.Mailbox.SetProperty %servername2%;%ExchContPath%;%username%;sn;%col3%
Data.Endloop   
[Batch_End]

[Undo_Batch_Begin]
Data.Loop   
 Exchange.55.Mailbox.Delete %servername2%;%ExchContPath%;%username%   
 Account.Delete %username%   
Data.Endloop   
[Undo_Batch_End]

[Data_Begin]
stsmith2;klW*2-0A;Smith;Steve;
[Data_End]