Announcement

Collapse
No announcement yet.

Write A Command Script To Extract Data For Scheduled Jobs

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

  • Write A Command Script To Extract Data For Scheduled Jobs

    I have been asked by my boss to write a script to run as a scheduled job to extract share information from Hyena. We are interested in periodically running a script to determine which shares exist and which users have access to those shares.

    I am new with writing scripts and with Hyena. I am sure that this can be done and I have seen some really amazing scripts on this forum already. Could someone please help me get started? Thanks.

  • #2
    Re: Write A Command Script To Extract Data For Scheduled Jobs

    It sounds like you should be able to use Exporter Pro (included with Hyena) to do this. It can report share information, including permissions, and can be run from the command line.

    You wouldn't need to write any scripts, but rather will configure it with the export settings you want, then simply create a batch file to run it. Once you have that working the way you want you can schedule the batch file using Windows Task Scheduler.

    Comment


    • #3
      Re: Write A Command Script To Extract Data For Scheduled Jobs

      Thanks. Would this have to be done for each server (to create the scheduled task) or is there a way to do this for a number of servers? Our company also has our server groups broken down (in Hyena) into Domain Controllers and Servers. I couldn't find a way to select both entities in the right-hand window pane, so I assume that two separate Exporter Pro jobs would need to be done. I have never written a batch file, so I am learning. Is a Macro my best bet?

      Comment


      • #4
        Re: Write A Command Script To Extract Data For Scheduled Jobs

        You can export this information for both servers and domain controllers at the same time. If you want to do this, and if you want to automate it, then you would place everything in one file.

        While Hyena can send the domain controller or server list to Exporter Pro interactively, to do this in a batch file, you would have to build an Exporter Pro configuration independently from Hyena:

        - First, run Exporter Pro by itself.
        - Create a new export configuration by selecting Configuration->New Export Configuration.
        - You can create server/workstation/domain controller objects manually by clicking the green toolbar icon, but if you have a lot of them, you can save some time by importing them into Exporter Pro.
        - To import a list, go to Hyena and display what you want in Hyena's right window. Select them, select Edit->Copy and copy the name, path, and any comment information to the clipboard.
        - Run Excel and rearrange the columns to that it is in this order: name, comment, path. You can use either a Netbios or DNS path. Save the file to a tab delimited text file, then close Excel.
        - Back in Exporter Pro, select Configuration->Import Object File and select the object type and file.

        - Once you have your computers in Exporter Pro, select the Export Properties button on the toolbar and configure the exports that you want.
        - Then, look in the help file for the command line and create a .bat file with that command in it. Run it from the .bat file to make sure it works.
        - Finally, you would create a scheduled task to run the .bat file.

        Let us know how it goes. It sounds harder than it is.
        Kevin Stanush
        SystemTools Software Inc.

        Comment


        • #5
          Re: Write A Command Script To Extract Data For Scheduled Jobs

          Thank you for your help. I'm very new with Hyena (version 6.5)!

          I'm having some trouble with this. I'm not sure if I'm creating a New Export Configuration properly - or if I misinterpreted your last directions. I need share file information exported from Hyena for 27 servers listed under "Servers" in Hyena and seven servers listed under "Domain Controllers" in Hyena. The right-hand window shows the following columns for Domain Controllers: Directory Name, DNS, Site Name, DS, PDC, GC, and Path. However, under Servers, these are my only column headings: Computer Name, Comment, Type, and Domain. I need both Domain Controllers and Servers to have the same column headings in order to export them both to Excel and reimport them into Hyena as an object file, right? I can't find how to change the column headings to display more/different information.

          I have checked under Tools -> Settings -> Display and still cannot determine why I can't change ethe view to display (per your instructions) the name, comment, path information verbatim. Can you please tell me what I'm doing wrong to that display?

          And to be sure I was clear, I COULD create a new Export Configuration through Tools -> Exporter Pro -> Run Exporter Pro... and then going to the Configuration menu and selecting New Export Configuration, BUT since I need information for over 30 servers exported, it would be more efficient to create the list in Hyena/Excel then reimport it to Hyena, right?

          I will probably have additional questions but this is the most immediate one. Thanks again!

          Comment


          • #6
            Re: Write A Command Script To Extract Data For Scheduled Jobs

            Exporter Pro (EP) only needs to know the name and the path of the object to export. I assumed you had a few dozen computers, otherwise you could easily enter them manually into EP using the Add button. But if you can see them in Hyena, you can easily select the columns you want and copy the information into Excel and then import into EP...this just saves some typing.

            You could also configure your export to dynamically export the shares from the DCs and Servers in your domain, but this can be time consuming or unreliable as it depends on the state of your network browse list. So since you had a reasonable set of computers, I think a static list in this case makes more sense, especially since its one that is unlikely to change very often.

            In EPs help file there is a section on the file format to have for import files, but its just a tab-delimited file of name, comment, and path. The comment can be blank, but you would put these into columns A,B,and C in Excel and then save to a tab-delimited output file.

            I was just having you display it into Hyena so that you could have a starting point for your copy to Excel.
            Kevin Stanush
            SystemTools Software Inc.

            Comment


            • #7
              Re: Write A Command Script To Extract Data For Scheduled Jobs

              Thank you. I am still having issues displaying the name, path, and comment within the right-pane window of Hyena. I can't get all three of those options to appear for either the Domain Controllers or for the Servers.

              I understand how to select the Servers/Domain Controllers (not both at the same time) in the right-pane column and go to Edit->Copy, but I can't get the same items to copy for both Domain Controllers and Servers. I am missing the comments column for Domain Controllers and I do not have path as an option for my Servers column. I can't see how to change the view/headings displays to show me these items.

              As best as I can determine, for your instructions to work to export then reimport, this is needed, so I'm stuck! I have checked the help files for both Hyena and for EP and cannot find the solution I need. Thanks for you help.

              Comment


              • #8
                Re: Write A Command Script To Extract Data For Scheduled Jobs

                The file needs to contain:

                Object Name <tab> Object Comment <tab> Object Path

                Comment is not needed. So, an example would be:

                ServerA <tab> <tab> \\ServerA
                ServerB <tab> <tab> \\ServerB

                Since your list of computers has mostly servers and a few domain controllers, work from your list of servers, then manually type in your domain controllers.

                The reason I say this is that, as you've noticed, you have different information displayed in the right window for the list of Servers and the list of Domain Controllers. This can't be changed, and the main issue is Domain Controllers information is coming from AD (so Hyena has more data to work with), and the Servers list comes from your Windows Browse List (so Hyena has less data to work with).

                Select your servers in Hyena's right window, then copy/paste that into Excel. In the first column should be your server names, the Comment column may or may not have information, and you can delete any other columns. Create a third column for your path data and copy and paste the first column.

                It should now look like:

                ServerA <tab> <tab> ServerA

                If there is comment data in the second column, great, if not that is okay too.

                That is all you need. You can manually add in the domain controllers you want to this file, save it, then run through the import steps outlined above.

                Comment


                • #9
                  Re: Write A Command Script To Extract Data For Scheduled Jobs

                  Thank you both so much! This worked great. I have created a command file that will soon be an AT Scheduled Task. Now to figure out how to add the date to the (Excel) file...another day, another challenge! Thanks again! ;-)

                  Comment

                  Working...
                  X