Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Take Ownership of a folder - Many folders and many users

Posted on 2007-08-10
7
Medium Priority
?
951 Views
Last Modified: 2013-11-05
Hi Guys,

First time posting on here so I apologise if I do anything wrong or don't provide enough info.

What i need to do is simple to explain though:

My users are getting Roaming profile errors after the profile folders were moved from one server to another. The only way to stop these messages is to give ownership of the profile folder to the user (I think this is the only way). Now if a user is called user1 the folder will also be called user1. Is there a quick way to set the ownership of all the folders to the corresponding user?

I hope this makes sense. :-/
Thanks.
0
Comment
Question by:netjets
  • 3
  • 2
  • 2
7 Comments
 
LVL 31

Expert Comment

by:merowinger
ID: 19669451
yes there's a commandline tool called cacls which configures permissions!
You can combine it with vbscript to write a procedure....

See here:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_22141356.html?sfQueryTermInfo=1+30+cacl+script

here are more infos and the download:
http://support.microsoft.com/kb/318754
0
 

Author Comment

by:netjets
ID: 19669508
Thanks for the super fast response.

I don't know how to write VB scripts (very well). Is there an easier way?
0
 
LVL 32

Expert Comment

by:and235100
ID: 19669574
You can use cacls in a  batch file:
http://support.microsoft.com/kb/135268
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 32

Expert Comment

by:and235100
ID: 19669590
Another, updated utility -
Xcacls:
http://support.microsoft.com/kb/825751
0
 
LVL 31

Accepted Solution

by:
merowinger earned 500 total points
ID: 19669629
to change many permissons and for each folder custom...i dont think that there's a faster way!

The script should read the foldername from the profilefolder fro example : JasonBourne
and then change the permissons so, that the user Jason Bourne has specified rigths on its profile folder!

It could look like this:
'ThisIsAtest.vbs~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

dim fso, folder, shell
dim currentUser

set fso = CreateObject("Scripting.FileSystemObject")
set shell = CreateObject("Wscript.Shell")
set folder = fso.GetFolder("D:\UserProfileFolders")   '<---Profile Folder on your server

for each Subfolder in folder.subfolders
     currentUser = subfolder.name
     shell.run ("C:\cacls.exe ..........." &currentUser ..... & subfolder.folder)   '<---type in here the dos command for cacls.exe
next
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The best is when u change for one userfolder the permissons with cacls via command line and insert the command variable into the shell.run line!


("%comspec% /c CACLS.EXE " & Chr(34)& "Z:"_
& Chr(34)& " /E /G " & Chr(34)&  GrpOrAcct1 & Chr(34)&_
":R > C:\TXT\RESULT.TXT")
0
 
LVL 31

Expert Comment

by:merowinger
ID: 19669699
the cacls command could look like this:
cacls.exe profiles\%UserName% /g administrators:f system:f %UserName%:c
0
 

Author Comment

by:netjets
ID: 19671340
Thanks man! Genius...Thank you all for your help :-)

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question