[THIN] Re: Easier way to do this...

  • From: Jeff Malczewski <jmalczewski@xxxxxxxx>
  • To: "'thin@xxxxxxxxxxxxx'" <thin@xxxxxxxxxxxxx>
  • Date: Tue, 6 Jul 2004 13:09:25 -0400

Sorry for the double post, I created a new email the last time instead of
responding to the thread, just wanted to make sure people know what this was
for..

-----Original Message-----
From: Jeff Malczewski 
Sent: Tuesday, July 06, 2004 1:02 PM
To: 'thin@xxxxxxxxxxxxx'
Subject: [THIN] 


Replace the entries in <> with the information for your organization.
 
This script assumes that you have the utilities XCACLS.EXE and SUBINACL.EXE
in the root of C: on the machine you run the script from.  These are
available in the Resource Kit.
 
Further, this script assumes that you have shares named "Profiles" and
"Home" for the profile and home directories, respectively.
 
It will change the owner of the directory to the user, as well as any
subdirectories, and it will set the system account to have full access over
the directory, and grant the user change permissions.
 
If you need to do this for multiple OU's, simply add another line just like
the first, and put the other OU names in it, one per entry.  This will step
through AD looking at the user accounts, not the directories.  If you have
directories that don't have a matching account name, they will not be
touched.  If you have an account name without a matching directory, the
script will bomb.
 
HTH,
Jeff
 
<-----------------------------begin
VBScript----------------------------------------->
MoveOU("<OUName>")
WScript.Quit
 


Function MoveOU(orgU)
 Set ws = CreateObject("wscript.shell")
 server = <server name>
 scr_sleep = 5000
 Set oFS = CreateObject("Scripting.FileSystemObject")
 Set OU = GetObject ("  <ldap://OU> LDAP://OU="; & orgU & ",DC=<domain
name>,DC=<extension(local, com, etc)>")
 For Each user In OU
    ws.run("c:\xcacls \\" & server & "\profiles\" & user.samaccountname & "
/T /G SYSTEM:F " & user.samaccountname & ":C /Y")
    WScript.sleep scr_sleep
    ws.run("c:\subinacl /noverbose /file \\" & server & "\profiles\" &
user.samaccountname & " /setowner=" & user.samaccountname)
    WScript.Sleep scr_sleep
    ws.run("c:\xcacls \\" & server & "\home\" & user.samaccountname & """ /T
/G SYSTEM:F " & user.samaccountname & ":C /Y")
    WScript.Sleep scr_sleep
    ws.run("c:\subinacl /noverbose /file \\" & server & "\home\" &
user.samaccountname & " /setowner=" & user.samaccountname)
    WScript.Sleep scr_sleep
  Next
End Function

<-----------------------------------end
VBScript----------------------------------->
 

 

This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. 


This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error please notify the system manager. This 
message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail.

Other related posts: