Page 1 of 1 1
Topic Options
#122364 - 2004-07-08 03:38 PM How change all users home dir paths in NT4 domain?
KentLarsson Offline
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. Offline
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
#122366 - 2004-07-08 05:10 PM Re: How change all users home dir paths in NT4 domain?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I've recently done something similar (though more complex) for migrating terminal server users.

If you don't get far with Chris' hint ask again and I will dig out the script I used.

Top
#122367 - 2004-07-08 05:17 PM Re: How change all users home dir paths in NT4 domain?
KentLarsson Offline
Getting the hang of it

Registered: 2004-07-08
Posts: 50
Loc: Sweden, Avesta
The code seems to work, but i donīt understand the line
Code:
$user.name "	" $user.HomeDirectory ?


And what is the difference between
Code:
$users.filter="User",""


and
Code:
$users.filter="User"



Could you/someone else explain please and i will be very happy!
_________________________
Best regards, Kent

Top
#122368 - 2004-07-08 05:45 PM Re: How change all users home dir paths in NT4 domain?
Howard Bullock Offline
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.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#122369 - 2004-07-08 06:02 PM Re: How change all users home dir paths in NT4 domain?
KentLarsson Offline
Getting the hang of it

Registered: 2004-07-08
Posts: 50
Loc: Sweden, Avesta
Thanks!

I was just confused by the syntax of the first line, i have always written it like:
? $user.name + " " + $user.HomeDirectory
But of course itīs possibly your way to! My bad!

Very interesting about the second line, i didnīt know that you could create arrays that way! But now i do.
_________________________
Best regards, Kent

Top
#122370 - 2004-07-08 08:37 PM Re: How change all users home dir paths in NT4 domain?
Howard Bullock Offline
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.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#122371 - 2004-07-08 09:19 PM Re: How change all users home dir paths in NT4 domain?
Chris S. Offline
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
#122372 - 2004-07-09 01:02 AM Re: How change all users home dir paths in NT4 domain?
KentLarsson Offline
Getting the hang of it

Registered: 2004-07-08
Posts: 50
Loc: Sweden, Avesta
Take it easy Howard, i said "Thanks" and i did not mean any harm in my post. Your way is the way, you rule!

I started to write ? first due to missunderstanding of the language. As ? is often equivalent with PRINT in BASIC dialects i thought it was the case with KiXtart as well.

I am not printing anything complex so the way i use it will work fine to i guess. No debate though, i am the novice here and am just struggeling to get the work done.
_________________________
Best regards, Kent

Top
#122373 - 2004-07-09 01:08 AM Re: How change all users home dir paths in NT4 domain?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

Take it easy Howard



LOL
That is the only way he can! Have never seen him any other way. Me thinks you misconstrued.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#122374 - 2004-07-09 02:32 AM Re: How change all users home dir paths in NT4 domain?
Howard Bullock Offline
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.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#122375 - 2004-07-09 04:13 AM Re: How change all users home dir paths in NT4 domain?
Chris S. Offline
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 Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Ditto - just crawled out from under my rock.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#122377 - 2004-07-09 07:21 AM Re: How change all users home dir paths in NT4 domain?
KentLarsson Offline
Getting the hang of it

Registered: 2004-07-08
Posts: 50
Loc: Sweden, Avesta
Quote:

Me thinks you misconstrued



I sure did! My most humble apologies!
_________________________
Best regards, Kent

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.196 seconds in which 0.145 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org