Jump to content

Permissions not applied to folder on Brazilian machine


ur
 Share

Recommended Posts

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

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

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.

Link to comment
Share on other sites

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)

Musashi-C64.png

"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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...