LosDos Posted August 27, 2008 Share Posted August 27, 2008 I have a pretty big task on my hands and it could turn out to be very cumbersome if I cannot find a way to automate it. I normally use powershell to script out anything but in this case it is not an option. I have a file server with user profiles located on it and nearly have the profiles are having a permission issue. The issue is when you go to the Security Tab, it errors saying" You do not have permission to view or edit..." but I can however take ownership or set ownership to Administrators and then edit the permissions. I do not need to set anything specific, but I do need AutoIt to read from a text file a list of profiles, such as john, charles, dave, ect. and then right click their profile folder, go to properties, Security Tab, select OK to bypass the error, Advanced, go to Owner Tab, select Administrators, Check the Replace permissions checkbox and hit apply. I would then assume it would sleep for 10 minutes or so while the permissions are set and then I need to go back into Advanced and Select Inherit and Replace. So as you can see, XACLS and Powershell are not available because the netapp currently owns the folders that have incorrect permissions. I was able to pull a list of users that have this issue with powershell and would like to put their usernames into a text file and let it run. If this isn't possible, I understand, I'll just have to start hand-jammin. God Bless. Link to comment Share on other sites More sharing options...
burners Posted August 27, 2008 Share Posted August 27, 2008 write down all the keystrokes needed and the amount of seconds in between them. Use the keyboard 100% Post here and I will make it for you in a flash. ~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK Link to comment Share on other sites More sharing options...
LosDos Posted August 27, 2008 Author Share Posted August 27, 2008 (edited) Thanks for the quick response burners, these are the keystrokes I found to work. I am not sure how to get it to open the shared folder and go to the user's folder. I will have a text file with the list of users I will edit. Script will open shared folder \\share\profiles$ The script will have to move to that user's appropriate folder, Alt+Enter will open the properties. CTRL+TAB to go to Security. Enter to Say OK to the error. ALT+V for Advanced. CTRL+TAB x 2 to go from Permissions to Owner Tab. Space Bar to select the first possible Owner. ALT+R to Replace owner on all Subfolders and objects. Enter to Replace. Alt+Y to select Yes. Sleep for 10 minutes. Enter to close the Properties window. ALT+ENTER to reopen Properties. CTRL+TAB back to Security TAB. ALT+V for Advanced. The script will have to reenter the user name from the text file. ALT+C to Check Name Enter for OK Tab x2 Space to select full permissions Tab x3 Space Tab Space Enter Alt+Y to select Yes. Sleep for 10 minutes. Enter to exit. Loop to second name in text file. Edited August 27, 2008 by LosDos Link to comment Share on other sites More sharing options...
Airwolf Posted August 27, 2008 Share Posted August 27, 2008 Thanks for the quick response burners, these are the keystrokes I found to work. I am not sure how to get it to open the shared folder and go to the user's folder.I will have a text file with the list of users I will edit.Script will open shared folder \\share\profiles$The script will have to move to that user's appropriate folder,Alt+Enter will open the properties.CTRL+TAB to go to Security.Enter to Say OK to the error.ALT+V for Advanced.CTRL+TAB x 2 to go from Permissions to Owner Tab.Space Bar to select the first possible Owner.ALT+R to Replace owner on all Subfolders and objects.Enter to Replace.Alt+Y to select Yes.Sleep for 10 minutes.Enter to close the Properties window.ALT+ENTER to reopen Properties.CTRL+TAB back to Security TAB.ALT+V for Advanced.The script will have to reenter the user name from the text file.ALT+C to Check NameEnter for OKTab x2Space to select full permissionsTab x3SpaceTabSpaceEnterAlt+Y to select Yes.Sleep for 10 minutes.Enter to exit.Loop to second name in text file.Keypresses are not as precise as command line utilities.Use Takeown.exe /R: http://technet.microsoft.com/en-us/library/cc786603.aspxThen use XCACLS. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
burners Posted August 27, 2008 Share Posted August 27, 2008 Your on your own from here. This should get you started. expandcollapse popup$10min = "10000" * "60" ;open some text file and read line, line = $username Opt("sendkeydelay", 25) Opt("sendkeydowndelay", 15) Send("#r");opens run command WinWaitActive("Run");waits for run command s2() Send("\\share\profiles$ {enter}");opens shared folder Opt("sendkeydelay", 50) ;move to folder somehow Send("!{enter}");open properties Sleep(5000) Send("{lctrl}{tab}");go to security s2() Send("{enter}");say OK to error s2() Send("!v");advanced s2() Send("{lctrl}{tab}") s2() Send("{lctrl}{tab}");go from Permissions to Owner Tab s2() Send("{space}");select the first possible Owner s2() send("!r");Replace owner on all Subfolders and objects s2() Send("{enter}");replace s2() send("!y");select yes sleep($10min);sleep 10min Send("{enter}");close the Properties window s2() Send("!{enter}");reopen Properties s2() Send("{lctrl}{tab}");back to Security TAB s2() Send("!v");advanced s2() ;$username s2() Send("!c");Check Name s2() Send("{enter}") s2() Send("{tab}") s2() Send("{tab}") s2() Send("{space}");select full permissions s2() Send("{tab}") s2() Send("{tab}") s2() Send("{tab}") s2() Send("{space}") s2() Send("{tab}") s2() Send("{space}") s2() Send("!{enter}") s2() Send("!y");select yes s2() sleep($10min);sleep 10min Send("{enter}");enter to exit Exit Func s2() sleep(2000) EndFunc ~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK Link to comment Share on other sites More sharing options...
burners Posted August 27, 2008 Share Posted August 27, 2008 also if your not already using scite you should get it from the autoit homepage. It will help with your syntax and the tidy finction will check for erros. ~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK Link to comment Share on other sites More sharing options...
burners Posted August 27, 2008 Share Posted August 27, 2008 (edited) Oh yes almost forgot. If your going to read from a txt file a list of names to edit then you can do something like this Add this var in top of script $fileline=1 then add this in the file read statement $line = FileReadLine(file.txt,$fileline) Then add this before the wend $fileline=1+1 or something along those lines Edited August 27, 2008 by burners ~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK Link to comment Share on other sites More sharing options...
LosDos Posted August 27, 2008 Author Share Posted August 27, 2008 Understood, I'll work on adding the FileReadLine. Thanks for all the help burners. God Bless. Link to comment Share on other sites More sharing options...
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