ur Posted April 5, 2021 Share Posted April 5, 2021 I am applying permissions to a folder using RunWait by icacls. It is working correctly on windows 10 64bit english machine. But when I ran on the Brazilian machine, it is not applying. So ran the command manually on the brazilian machine and got below error. Operation failed Return code 1332. And it described as "No mapping between account names and security IDs was done." And I understood Users is written as Usuarios in the Brazilian machine. But how to set permissions to Users folder using a language independent code so that it would apply to all the machines even the languages are different. Link to comment Share on other sites More sharing options...
Musashi Posted April 5, 2021 Share Posted April 5, 2021 This is not my area of expertise, but take a look e.g. at https://ss64.com/nt/icacls.html user A user account, Group or a SID "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
ur Posted April 5, 2021 Author Share Posted April 5, 2021 Well the syntax is correct but not working on non-english machines. As on non-english it is not able to detect Users group. Is there any alternative instead of icacls to set permissions (any AUtoIT specific code), to apply permissions on any machine, despite of language. Link to comment Share on other sites More sharing options...
Nine Posted April 5, 2021 Share Posted April 5, 2021 You could use CLSID of special folders. Or refer to shell.application to find the "real" folder name by using special shell name : $sFolder = $oShellApplication.Namespace('shell:My Pictures').Self.Path There is also a number of folder constants that can serve as folder namespaces with shell.application object too. Earthshine 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ur Posted April 5, 2021 Author Share Posted April 5, 2021 Not the users folder. But for users group. Link to comment Share on other sites More sharing options...
Musashi Posted April 5, 2021 Share Posted April 5, 2021 1 hour ago, ur said: Not the users folder. But for users group. List of groups : _GetLocalGroupInfos() Func _GetLocalGroupInfos() Local $objWMIService, $oColItems $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") If Not IsObj($objWMIService) Then SetError(1) Return 0 EndIf $oColItems = $objWMIService.ExecQuery("Select * from Win32_Group Where LocalAccount = True") For $objItem In $oColItems ConsoleWrite(" ------------------------------------------------------ " & @CRLF) ConsoleWrite("Name ....... : " & $objItem.Name & @CRLF) ConsoleWrite("Caption .... : " & $objItem.Caption & @CRLF) ConsoleWrite("Description . : " & $objItem.Description & @CRLF) ConsoleWrite("Domain ...... : " & $objItem.Domain & @CRLF) ConsoleWrite("Local Account : " & $objItem.LocalAccount & @CRLF) ConsoleWrite("SID ......... : " & $objItem.SID & @CRLF) ConsoleWrite("SID Type .... : " & $objItem.SIDType & @CRLF) ConsoleWrite("Status ...... : " & $objItem.Status & @CRLF) Next EndFunc ;==>_GetLocalGroupInfos Use the SID of the desired group. Set the permissions with icacls by using the SID (add an asterisk as prefix to tell icacls this is a SID) : Example : icacls d:\ /grant *S-1-5-32-545:(OI)(CI)(M,W,RX) "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." 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