Checking OS folder permissions

  • I have a list of approx 20 OS file folders. I want to check that the "Authenticated Users" OS Group is granted Full Control to each of the folders. I also want to run this script against 130 remote servers.

    The desired output is:

    Server, Folder Name, Boolean Flag (desired group is present or not)

    Can someone give me a direction to go on this? I've tried calling xp_cmdshell from an EXEC and from sp_executesql.

    I need to learn, so I don't want the solution, but some hints on approach and/or where to look or go would be greatly appreciated.

    Thanks,

    Bill

  • If you insist on using SQL for this, I would --

    create script to enable xp_cmdshell & run cacls.exe using xp_cmdshell & then disable xp_cmdshell

    choose a method to multi query multiple servers simultaneously

    save output to table with servername

    build query to parse data saved to product desired output

    Methods for multi query:

    Buy a tool like Idera Multi Query (or find a free one)

    Code a quick app or script to query and insert to a table somewhere

    Use this method: http://www.mssqltips.com/tip.asp?tip=1767

    If you're programming it, you could also just use the WMI interface which is pretty easy to use in .NET and skip SQL altogether

    If you have admin on the same domain with all the servers, you could just use the cacls directly to the unc path. Then parse the output to a SQL table.

    cacls.exe \\server\c$\etc\etc

    A few options, I'm sure there's more.

  • Thank you. I appreciate your time and effort. I am close to a solution now in SQL and will attempt to recreate it in WMI as suggested.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply