#122364 - 2004-07-08 03:38 PM
How change all users home dir paths in NT4 domain?
|
KentLarsson
Getting the hang of it
Registered: 2004-07-08
Posts: 50
Loc: Sweden, Avesta
|
Hi!
I would like to change all users home directory paths in an NT4 domain using ADSI, except the disabled accounts and accounts without a home directory.
I have searched the forum for "enumerate users" but didnīt find anything. I guess that is what i have to do, "walk through" all users and check properties as well as modify the home directory path property.
As i sidenote i have done this using vbscript but i am uncertain of how itīs done through KixTart (which i want to use instead due to that i find it more easy to work with). An example or a hint on where to find an example would be greatly appreciated!
Edited by KentLarsson (2004-07-08 03:39 PM)
_________________________
Best regards, Kent
|
|
Top
|
|
|
|
#122365 - 2004-07-08 04:32 PM
Re: How change all users home dir paths in NT4 domain?
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
This should get you pretty close...
Code:
$user=getobject("WinNT://@domain")
$user.filter="User",""
for each $user in $user
If $user.HomeDirectory and NOT $user.AccountDisabled
$user.name " " $user.HomeDirectory ?
EndIf
next
Edited by Chris S. (2004-07-08 04:38 PM)
|
|
Top
|
|
|
|
#122368 - 2004-07-08 05:45 PM
Re: How change all users home dir paths in NT4 domain?
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
the first line you asked about simply prints those values to the display. "?" is "newline" as documented in the manual.
$users.filter="User",""
is more interesting. The filter property requires an array. KiXtart will let you build a an array by setting comma separated values to a variable. In this case an array is created where "User" is the first element and an empty string is the second. the filter uses the "User" value.
|
|
Top
|
|
|
|
#122370 - 2004-07-08 08:37 PM
Re: How change all users home dir paths in NT4 domain?
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
That is not my way. I write it your way. Just offering an explanation.
|
|
Top
|
|
|
|
#122371 - 2004-07-08 09:19 PM
Re: How change all users home dir paths in NT4 domain?
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Quote:
That is not my way. I write it your way. Just offering an explanation.
I don't usually leave out the +'s. That was just some really old code of mine that I copied from.
As far as my preference for putting the "?" at the end of the line, I see no reason to perform a line feed prior to writing the line.
|
|
Top
|
|
|
|
#122374 - 2004-07-09 02:32 AM
Re: How change all users home dir paths in NT4 domain?
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Definitely... I guess I should have added an abundance of winking smilies.. .
I was very surprised by some of the reponses.
|
|
Top
|
|
|
|
#122375 - 2004-07-09 04:13 AM
Re: How change all users home dir paths in NT4 domain?
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
I'd normally let your "insult" go, but I haven't been posting much lately and needed to get my post counter moving again.
|
|
Top
|
|
|
|
#122376 - 2004-07-09 06:15 AM
Re: How change all users home dir paths in NT4 domain?
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Ditto - just crawled out from under my rock.
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 476 anonymous users online.
|
|
|