BigNoter Posted November 8, 2013 Posted November 8, 2013 Hi all, I'm trying to do the following steps: 1. Ask the user to select a File from a dialog window "Open" (save its original owner and permissions) and also a UserName from the dialog window "Select User or Group" and grant the ownership and full access of the File to the UserName. 2. Wait for the user to finish accessing the File. 3. Automatically return the original owner and permissions (the one that saved in step 1) back to the File. Using the following commands: TakeOwn /F "full path of the File" ICAcLs "full path of the File" /Grant "UserName":F ICAcLs "full path of the File" /SetOwner "original user" ICAcLs "full path of the File" /Grant:R "original user":RX Any help will be appreciated. TIA
orbs Posted November 8, 2013 Posted November 8, 2013 DIR /Q will give you the owner; but if you are not the owner and you have no access to the file, then you may have difficulty to restore the ownership after you've taken it (i have not tried it), this is a good summary for ICACLS (the lettercase is flexible, but if you insist, then at least the middle ACL must be uppercase ) http://ss64.com/nt/icacls.html anyway, where are you stuck with your script? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
BigNoter Posted November 8, 2013 Author Posted November 8, 2013 DIR /Q will give you the owner; but if you are not the owner and you have no access to the file, then you may have difficulty to restore the ownership after you've taken it (i have not tried it), this is a good summary for ICACLS (the lettercase is flexible, but if you insist, then at least the middle ACL must be uppercase ) http://ss64.com/nt/icacls.html anyway, where are you stuck with your script? Thanx for the quick reply. The 4 commands line with its sequence, will do the job exactly the way I wonted (in DOS prompt) with no error or conflict in ownership! ACL = Access Control List ICAcLa = Inegrated Control Access List I did not yet started with the script! May be someone has it laying somewhere in his archive. I think I have to get rid of my old dusty AutoIt information and start the coding..!
orbs Posted November 8, 2013 Posted November 8, 2013 The 4 commands line with its sequence, will do the job exactly the way I wonted (in DOS prompt) with no error or conflict in ownership! happy for you. did you test on files that are not accessible to you? i find this is the main issue with ownership - users take ownership and revoke admin rights on files and folders... very annoying. I did not yet started with the script! May be someone has it laying somewhere in his archive. I think I have to get rid of my old dusty AutoIt information and start the coding..! look up RunWait() in AutoIt help. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
BigNoter Posted November 8, 2013 Author Posted November 8, 2013 look up RunWait() in AutoIt help. Thanx for the jump start.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now