Admod certainly doesn't have any issues with proper spaces in DNs. I'm guessing
that cmd.exe is stripping what IT thinks are extraneous quotes.
I would do it in PowerShell. :)
$computers = gc change1.txt
foreach( $computer in $computers )
{
$array = $computer.Split( " " ) ## assuming space separated - update
as necessary for your file
cmd /c admod -b "$($array[0])" "homedrive::H:"
"homedirectory::$($array[1])"
}
-----Original Message-----
From: Kurt Buff [mailto:[email protected]]
Sent: Friday, October 19, 2012 1:51 PM
To: NT System Admin Issues
Subject: Re: This one is stumping me...
OK - fixed that.
However, even when enclosed in quotes, it can't handle spaces in the 'cn='
field.
I'm turning to the alternative presented by James - net user.
An update on that in a moment...
Kurt
On Thu, Oct 18, 2012 at 7:11 PM, Steve Kradel <[email protected]> wrote:
> I'm no batch scripter, but admod is complaining that it doesn't like
> the DN "$i" when it has no business knowing the names of your
> vars--shouldn't it be %i?
>
> --Steve
>
> On Thu, Oct 18, 2012 at 9:00 PM, Kurt Buff <[email protected]> wrote:
>> All,
>>
>> I'm splitting out the large home share on our file server, and
>> spreading the user directories across three different LUNs (don't
>> ask, it's a long story...)
>>
>> So, I've got the files copying now, but I need to reset all of the
>> user profiles to reflect the new shares to which they'll be directed.
>>
>> I've got a list with the DN for each user, and the new share name, it
>> in the format of:
>>
>> "cn=Chatty
>> Kathy,ou=users,ou=companyname-us,dc=company,dc=com"<tab>\\fileserver\
>> home1\ckathy
>>
>> and admod isn't liking it.
>>
>> This incantation spits up error messages:
>>
>> for /f "tokens=1,2 " %i in (change1.txt) do admod -b $i
>> "homedrive::H:" "homedirectory::%j"
>>
>> That looks like this:
>>
>> DN Count: 1
>> Using server: dc4.company.com:389
>> Directory: Windows Longhorn
>>
>> Modifying specified objects...
>> DN: $i...: [dc4.company.com] Error 0x22 (34) - Invalid DN
>> Syntax
>>
>> ERROR: Too many errors encountered, terminating...
>>
>> The command did not complete successfully
>>
>> And so on...
>>
>> Does anyone have a better way of doing this that they could share
>> with me? I really don't want to modify each account manually, since
>> I've got about 220 of them.
>>
>> Thanks,
>>
>> Kurt
>>
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~
> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~
>
> ---
> To manage subscriptions click here:
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~
<http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~
---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~
---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin