#167604 - 2006-10-05 08:59 AM
Re: How remove old Serverprofiles
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
A. It is about the place where the Roaming Profiles are stored
Quote:
\\server\Profiles$\username
|
Top
|
|
|
|
#167605 - 2006-10-05 10:58 AM
Re: How remove old Serverprofiles
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
I know Witto, I was referring to NTDOC's statement about "Roaming profiles are bad for you" Anyway, it is simple, enumerate all users in AD compare the users to the folders using simple Dir() and if the user does not exists remove dir.
An example code to list the users: Code:
Function ListADUsers Dim $User, $Users $Users = GetObject("WinNT://@ldomain") $Users.filter = "User","" For Each $User In $Users ? $User.Name Next EndFunction
Edited by apronk (2006-10-05 11:05 AM)
|
Top
|
|
|
|
#167609 - 2006-10-05 10:50 PM
Re: How remove old Serverprofiles
|
Nexus
Fresh Scripter
Registered: 2006-03-10
Posts: 11
Loc: Germany
|
Hi
my script, delete still all folders.
Code:
call "D:\KIX\GroupMembers.udf" call "D:\KIX\DirPlus.udf"
$members = groupmembers(@Domain,"Domain Users")
for each $member in $members ? $member
next
$folders = dirplus("D:\00", "/ad /s")
for each $folder in $folders ? $folder.name ? $folder.path
If AScan($Members, $folder.name) = -1 $folder.delete EndIf next
I have change in the script "$members" at name.
Code:
call "D:\KIX\GroupMembers.udf" call "D:\KIX\DirPlus.udf"
$members = groupmembers(@Domain,"Domain Users")
for each $member in $members ? $member
next
$folders = dirplus("D:\00", "/ad /s")
for each $folder in $folders ? $folder.name ? $folder.path
If AScan(Test, $folder.name) = -1 $folder.delete EndIf next
Dirplus output: Test d:\00\test test2 d:\00\test2
all subfolder are delete (test, test2) and he had to be delete only test2
can you check my script ?
Good Night
|
Top
|
|
|
|
#167610 - 2006-10-05 11:28 PM
Re: How remove old Serverprofiles
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
well, your script won't work as "Test" is no array, thus your ascan() test returns always with the delete result. put the array back.
then, change the ascan if to this: Code:
If AScan($Members, $folder.name) = -1 ? $folder.name " " $folder.delete EndIf
compare this output with the members output before and you will what you have wrong in the script.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 918 anonymous users online.
|
|
|