Hello
I try to make a script that must do the follow
In a windows 2003 domain, I have a 2008 windows share server, on this server there are the homedir from the users in this domain, in a root with the first letter, a example:
User baker (login with the name baker) has his home dir on the windows 2008 server named: \\shareserver\b\baker
Also user bakara (login with the name bakara) has his home dit on the same server , his path is \\shareserver\b\bakara
Now what I want with my script is set the username (also login name) to the owner of this folder, only the user is owner and nobody els, also the administrator is not the owner.
I write this script in powershell, that’s look to the usernames on this server, but what is the best method and how must I do that to set the owner rights correctly, the domain is , lets called, domain a user is domain\baker
function VoerUit ([string]$startDir)
{
write "Bezig met $startDir"
$rootDirs = dir $startDir
foreach ($letter in $rootDirs)
{
$pat = $startDir + "\" + $letter
write "Hier eerst met iacls administrator owner maken van $pat"
write "Hier dan met iacls administrator full control geven op $pat"
$Namen=dir $pat -name
foreach ($naam in $namen)
{
$DirToDo = $pat + "\" + $naam
write "bezig met modificeren van $DirToDo"
write "Hier \\domain\$naam owner maken van $DirToDo"
write "Hier $naam full control geven van $DirToDo"
}
write "Hier eerst met iacls van administrator alle rechten en owner van $pat halen"
}
}
VoerUit ("\\shareserver\b")