kiboost Posted March 24, 2012 Share Posted March 24, 2012 Hi, I'm managing a team network and some people changes some files I don't want they touch for security reasons (mainly config files for some softwares). I have some exe that runs on all machines for other tasks, so I can ad some check, but I would like to simply and robustly block the file from being deleted. Sometimes you can't delete a file because it is opened by a software. While annoying, I've tried to fileopen the file but we can still delete it. Of course the file must be readable by the user and its running softwares. If anyone have any idea, he's wellcome ;-) Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79 Link to comment Share on other sites More sharing options...
water Posted March 24, 2012 Share Posted March 24, 2012 If the files is on a network share you can set the NTFS permissions so the file can not be deleted. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
wakillon Posted March 24, 2012 Share Posted March 24, 2012 Take a look to AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
wakillon Posted March 25, 2012 Share Posted March 25, 2012 #include 'Permissions.au3' _InitiatePermissionResources() Dim $aPerm[2][3] = [['Administrators', 1, $FILE_AUTH_USERS_DEFAULT], ['Everyone', 1, BitOR ( $GENERIC_READ, $GENERIC_WRITE ) ]] $ret = _SetObjectPermissions ( 'c:test.txt', $aPerm ) MsgBox(0,'','Give only read and write access to Everyone and Default access to Administrators' & @CRLF & @CRLF & '_SetObjectPermissions return value : ' & $ret ) _ClosePermissionResources() Only Admin can delete file, and it can be read and write by everyone. AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts 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