Query regarding Error code : 87 - The Parameter is Incorrect

Paramesh T S 1 Reputation point
2023-01-18T11:25:55.1966667+00:00

Hi, Recently I have faced an Error code 87 in two different instances.

Instance 1 :
I was trying to apply SACL of a folder named "Test_Folder" using Cacls.exe, It returned the error : 87 , Then I found that the folder is having 1820 DACL's and after referring this document : https://learn.microsoft.com/en-us/troubleshoot/windows-server/windows-security/error-add-user-to-security-permissions confimed that why this error came.

Instance 2 :
I have written a CPP file to set SACL for an share/folder say "temp_folder" using Win API (https://learn.microsoft.com/en-us/windows/win32/api/aclapi/nf-aclapi-setentriesinacla)) , the "temp folder" doesnot have more than 10 ACLs and 0 SACLs before applying, I have tried to apply the SACL using that CPP file it didn't work and returns error 87 , but for other shares/folder it works well and SACL applied without any error and the parameters inserted are correct as I checked. In this instance I cannot able to find where the actual issue is.

By referring the above two instances , It returns only the Error code 87 if error encountered, But the error does not say where and why the actual error is coming , Kindly someone guide me how to analyse the error parameter is incorrect.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
8,176 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
1,893 questions
Windows Server Security
Windows Server Security
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
1,300 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
71 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MotoX80 23,491 Reputation points
    2023-01-19T00:52:22.1066667+00:00

    Instance 1 :
    Don't put 1820 DACL's on the file system. Use groups instead of individual accounts. How many of them are dead SID's from deleted accounts?

    Instance 2 :

    Sounds like you have a bug in your program. Are you trying to also add individual user's accounts to the audit policy? If so, why don't you just use the Windows explorer and add "everyone" or "authenticated users" instead?