Announcement

Collapse
No announcement yet.

need vbscript to pull NTFS security permission?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • need vbscript to pull NTFS security permission?

    hi everyone,

    i am looking for script which fetch me all NTFS permission on the folder, NTFS permission should be exclipt and not inherited (how do i check this?), what is curical is i will be given only server name as input , from that server i need to pull all NTFS Permission,

    in short my script need to pull server physical NTFS permission which are explicitly assigned, not inherited,script which also need to provide path where folder are located.

  • #2
    Re: need vbscript to pull NTFS security permission?

    So you want a script which works on a given server, and will show you the permissions of *every* folder on that server? That's going to give a LOT of results.

    What have you already tried?
    Gareth Howells

    BSc (Hons), MBCS, MCP, MCDST, ICCE

    Any advice is given in good faith and without warranty.

    Please give reputation points if somebody has helped you.

    "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

    "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

    Comment


    • #3
      Re: need vbscript to pull NTFS security permission?

      i havent tried anything till now i am looking for script in internet but i am not getting any thing , it will be better for me to start script if someone explain me the logic behind this and how to kickstart the script ....

      Comment


      • #4
        Re: need vbscript to pull NTFS security permission?

        I'm sure there's a way to do this using VBScript, however I think it would be much simpler to use a batch file and cacls. cacls /? at a command prompt to see how to use it.
        Gareth Howells

        BSc (Hons), MBCS, MCP, MCDST, ICCE

        Any advice is given in good faith and without warranty.

        Please give reputation points if somebody has helped you.

        "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

        "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

        Comment


        • #5
          Re: need vbscript to pull NTFS security permission?

          i am tried using Xcacls , when i am using it command prompt it pulls me full result but when i run xcalcs through vbscript it gives me only the first value.
          for example :

          if i want to get the result for the folder c:\Test when i run it on command prompt it give me

          C:\Documents and Settings\rz82nr>xcacls c:\Deltest
          c:\Deltest BUILTIN\AdministratorsOI)(CI)F
          NT AUTHORITY\SYSTEMOI)(CI)F
          GMDEV\pzdx5c:F
          CREATOR OWNEROI)(CI)(IO)F
          BUILTIN\UsersOI)(CI)R
          BUILTIN\UsersCI)(special access
          FILE_APPEND_DATA
          BUILTIN\UsersCI)(special access
          FILE_WRITE_DATA

          but when i run the xcacls i gives me only the first line of output
          c:\Deltest BUILTIN\AdministratorsOI)(CI)F

          how can i get the whole output i am giving my script here remodify the script and help me to get the output

          Option Explicit
          Dim objItem,objShell,objWshScriptExec,objStdOut,strlin e
          Dim oWshNet: Set oWshNet = CreateObject("WScript.Network" )
          Dim strComputer: strComputer = oWshNet.ComputerName
          Dim objWMIService: Set objWMIService = GetObject(_
          "winmgmts:\\" & strComputer & "\root\CIMV2")
          Const FilePath1 = "c:\Deltest"
          Const Filepath2 ="c:\Documents and Settings\rz82nr\Desktop\Deltest.txt"
          Dim objFSO,objFile,objFile1,i,item
          Set objFSO = CreateObject("Scripting.FileSystemObject")
          Set objFile1 = objFSO.CreateTextFile(FilePath2, True)
          With objWMIService: Dim strQuery
          Set objShell = CreateObject("WScript.Shell")
          strQuery = "Xcacls" & Chr(32)& FilePath1
          Set objWshScriptExec = objShell.Exec(strQuery)
          Set objStdOut = objWshScriptExec.StdOut
          strline=objStdOut.ReadLine
          MsgBox strline
          objFile1.WriteLine(strline)
          End With

          Comment


          • #6
            Re: need vbscript to pull NTFS security permission?

            i have found solution for my doubt i need to improve little to my script as of now what i have is iam providing path and tested it worl fine

            but what i need is i am given only the server name, from that server name i need to loop through every drive and every folder and produce me the output which has special permission...

            right now i have done fetching permission for single folder by providing path as constant

            Option Explicit
            Dim objItem,objShell,objWshScriptExec,objStdOut,strlin e,strQuery
            Dim oWshNet: Set oWshNet = CreateObject("WScript.Network" )
            Dim strComputer: strComputer = oWshNet.ComputerName
            Dim objWMI: Set objWMI = GetObject(_
            "winmgmts:\\" & strComputer & "\root\CIMV2")
            Const FilePath1 = "c:\Deltest"
            Const Filepath2 ="c:\Documents and Settings\rz82nr\Desktop\Deltest.txt"
            Dim objFSO,objFile,objFile1,i,item,colACLs
            Set objFSO = CreateObject("Scripting.FileSystemObject")
            Set objFile1 = objFSO.CreateTextFile(FilePath2, True)
            'With objWMIService: Dim strQuery
            Set objShell = CreateObject("WScript.Shell")
            strQuery = "Xcacls" & Chr(32)& FilePath1
            Set objWshScriptExec = objShell.Exec(strQuery)
            Do While Not objWshScriptExec.StdOut.AtEndOfStream
            strline = objWshScriptExec.StdOut.Readline()
            MsgBox strline
            objFile1.WriteLine(strline)
            Loop

            Comment


            • #7
              Re: need vbscript to pull NTFS security permission?

              PLease use the code buttons when posting scripts.
              Marcel
              Technical Consultant
              Netherlands
              http://www.phetios.com
              http://blog.nessus.nl

              MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
              "No matter how secure, there is always the human factor."

              "Enjoy life today, tomorrow may never come."
              "If you're going through hell, keep going. ~Winston Churchill"

              Comment


              • #8
                Re: need vbscript to pull NTFS security permission?

                Maybe write the script to work on the local machine, save it to a network share and use psexec to execute it on each server.
                Gareth Howells

                BSc (Hons), MBCS, MCP, MCDST, ICCE

                Any advice is given in good faith and without warranty.

                Please give reputation points if somebody has helped you.

                "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

                "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

                Comment


                • #9
                  Re: need vbscript to pull NTFS security permission?

                  Is it mandatory that you use a script? If not, there are some third party programs that can do this.

                  Comment


                  • #10
                    Re: need vbscript to pull NTFS security permission?

                    I'd be using dumpsec.

                    Comment


                    • #11
                      Re: need vbscript to pull NTFS security permission?

                      hi.

                      i have written a script that fetch me all folders and files and their ACL of the files and folder what i need is i need to populate a list of folder that does not have inheritance access to the child folder.(ie i need to populate a list of folder whose inculde inheritance permission from this object's parent checkbox is not checked in advance tab of security tab of properties option of folders) is there any way to do this ...

                      i need it urgently............
                      pls help me.................

                      Comment

                      Working...
                      X