Search code examples
windowscommand-linensisfrench

'net share' doesn't work on french Windows OS


I am writing an NSIS script on windows OS to create shared directories at the time of installation. Here is my code which works well on English Windows but doesn't work on French Windows 7.

CreateDirectory C:\tmpShare
nsExec::Exec 'icacls C:\tmpShare /grant *S-1-1-0:(OI)(CI)F'
nsExec::Exec 'net share "tmpShare"="C:\tmpShare" /grant:Everyone,full  /remark:"Temp shared folder"'

Reason: French OS doesn't understand user name string 'Everyone' in the net share command, it translates to 'Tout le monde' in french.

I tried using security id of the 'Everyone' i.e. *S-1-1-0 instead string 'Everyone' but it doesn't work with net share (BAD DESIGN OF WINDOWS, icacls works with it though)

I tried using "Tout de monde" instead of 'Everyone' and it solved the problem, now the question is How to write my NSIS script which platform independent ?


Solution

  • The AccessControl plug-in can convert the SID for you:

    AccessControl::SidToName "(S-1-1-0)"
    Pop $2
    Pop $1
    MessageBox MB_OK "Name=$1 Domain=$2"