Scripts for Services/OU's and Groups

Sharky Forums


Results 1 to 14 of 14

Thread: Scripts for Services/OU's and Groups

  1. #1
    Hammerhead Shark
    Join Date
    Dec 2000
    Posts
    1,579

    Scripts for Services/OU's and Groups

    I'm trying to document all our servers at work. We need a list of all running services, OU's, users, location/filename of GPUs, permissions and groups.

    I know I've seen scripts for a lot of these things, I was just wondering if anyone knew where I could find these scripts? Even if there are DOS commands, a simple text file would be fine for now.

    Thanks so much...

  2. #2
    Crash Test Dummy SkyDog's Avatar
    Join Date
    Oct 2000
    Location
    Upstate New York
    Posts
    12,183
    For OU's and users, you should be able to pull most basic info right from Active Directory Users and Computers.

    For GPO's, you can use the Group Policy Management console. There's an item in the left column labeled Group Policy Objects and it'll show you every GPO defined in each Active Directory domain in a forest.

    For anything you might need to script, ***********.com might be a good place to start. It's a commercial site, but they've got a whole lot of free resources for KiXtart and other scripting languages. As far as scripting goes, KiXtart is an easy language to learn and is pretty darn powerful for the price (free).

    Joeware.net is another good site with some handy Windows domain tools. HERE is a direct link to the free Windows downloads.

  3. #3
    Hammerhead Shark
    Join Date
    Dec 2000
    Posts
    1,579
    Awesome, thanks a lot. I know how to do it manually, but I was thinking something Belarc or Everest-style where I can just run something and have it pull that info down, if that makes sense. I'll definitely check out that stuff though.

    Offhand, do you know the DOS command to get a list of running services?

  4. #4
    BozoKiller
    Join Date
    Oct 2003
    Location
    Zoso
    Posts
    7,636
    From the RUN box;
    Start | Run Services.msc
    is that what you mean?
    Delete the Electoral College - Support
    www.NationalPopularVote.com

    "The world according to DRM Bozos"

    I am a consumer, I'll buy anything
    I am a sheep, I am cattle, I follow the herd
    I am ignorant, a dumbass, and I am a bozo...
    I am the epitome of the 'rank and file'
    I am your next door neighbor
    I am 95% of American Consumers
    I will consume you

    • If the light in your head hasn't come on yet,
      I suggest you go get a new bulb!

  5. #5
    Hammerhead Shark
    Join Date
    Dec 2000
    Posts
    1,579
    No... From the command prompt so I can export it as a text file...

  6. #6
    Great White Shark
    Join Date
    Nov 2000
    Posts
    21,595
    From the cmd line net services 2>\services.txt will output a list of running services to a text file, services.txt in the root directory.

  7. #7
    Hammerhead Shark
    Join Date
    Dec 2000
    Posts
    1,579
    Awesome, exactly what I'm looking for... Thanks!

    Any other suggestions for getting the other information?
    Last edited by LaValva; 04-05-2005 at 09:22 AM.

  8. #8
    Great White Shark
    Join Date
    Nov 2000
    Posts
    21,595
    From a DC cmd line net group >\group.txt will output a list of domain groups to a text file, group.txt in the root directory. This command is valid only on a domain controller.

    I'm not aware of a way to list OU's from a cui.

  9. #9
    Hammerhead Shark
    Join Date
    Dec 2000
    Posts
    1,579
    The services command didn't output the full list of running services. Anything else I can use?

  10. #10
    Great White Shark
    Join Date
    Nov 2000
    Posts
    21,595
    Sorry about that. The info I gave you about services was wrong (I'm getting old. )

  11. #11
    Crash Test Dummy SkyDog's Avatar
    Join Date
    Oct 2000
    Location
    Upstate New York
    Posts
    12,183
    Originally posted by LaValva
    Offhand, do you know the DOS command to get a list of running services?
    You can use the TASKLIST command in Windows XP or Windows Server 2003.

    Code:
    C:\>tasklist /?
    
    TASKLIST [/S system [/U username [/P [password]]]]
             [/M [module] | /SVC | /V] [/FI filter] [/FO format] [/NH]
    
    Description:
        This command line tool displays a list of application(s) and
        associated task(s)/process(es) currently running on either a
        local or remote system.
    
    Parameter List:
       /S     system           Specifies the remote system to connect to.
    
       /U     [domain\]user    Specifies the user context under which
                               the command should execute.
    
       /P     [password]       Specifies the password for the given
                               user context. Prompts for input if omitted.
    
       /M     [module]         Lists all tasks that have DLL modules
                               loaded in them that match the given
                               pattern name.  If the module name is not
                               specified, displays all modules loaded by
                               each task.
    
       /SVC                    Displays services in each process.
    
       /V                      Specifies that the verbose information
                               is to be displayed.
    
       /FI    filter           Displays a set of tasks that match a
                               given criteria specified by the filter.
    
       /FO    format           Specifies the output format.
                               Valid values: "TABLE", "LIST", "CSV".
    
       /NH                     Specifies that the "Column Header" should
                               not be displayed in the output.
                               Valid only for "TABLE" and "CSV" formats.
    
       /?                      Displays this help/usage.
    
    Filters:
        Filter Name     Valid Operators           Valid Value(s)
        -----------     ---------------           --------------
        STATUS          eq, ne                    RUNNING | NOT RESPONDING
        IMAGENAME       eq, ne                    Image name
        PID             eq, ne, gt, lt, ge, le    PID value
        SESSION         eq, ne, gt, lt, ge, le    Session number
        SESSIONNAME     eq, ne                    Session name
        CPUTIME         eq, ne, gt, lt, ge, le    CPU time in the format
                                                  of hh:mm:ss.
                                                  hh - hours,
                                                  mm - minutes, ss - seconds
        MEMUSAGE        eq, ne, gt, lt, ge, le    Memory usage in KB
        USERNAME        eq, ne                    User name in
                                                  [domain\]user format
        SERVICES        eq, ne                    Service name
        WINDOWTITLE     eq, ne                    Window title
        MODULES         eq, ne                    DLL name
    
    Examples:
        TASKLIST
        TASKLIST /M
        TASKLIST /V
        TASKLIST /SVC
        TASKLIST /M wbem*
        TASKLIST /S system /FO LIST
        TASKLIST /S system /U domain\username /FO CSV /NH
        TASKLIST /S system /U username /P password /FO TABLE /NH
        TASKLIST /FI "USERNAME ne NT AUTHORITY\SYSTEM" /FI "STATUS
        eq running"
    You could also use the PSSERVICE tool, which is a part of Sysinternals' free Process Tools. Check 'em out even if TASKLIST handles the job at hand. There are other tools in the suite like Process Explorer that come in handy.

  12. #12
    Mako Shark
    Join Date
    May 2002
    Location
    Grand Rapids, MI
    Posts
    4,579
    For generic scripting check out the TechNet Script Repository.

    http://www.microsoft.com/technet/scr...r/default.mspx

    Easily the best web resource for scripts, questions, and information.
    If you really want 'em to be a single unit, duct tape your router to your modem. - Skydog 5/5/2005

    MAIN - HP - e6300, 2GB DDR2, 300GB HDD, 250GB HDD, `6x DVD-RW, ATI X800GT, 500w Rosewill PSU

    Work - eMachine T6520, A64 3400+, 1GB PC 3200, 300GB HDD, 16x DVD R/RW, CD-ROM, Via Envy Sound

    HTPC - 2500XP, 1GB PC3200, 60GB HDD, 8x DVD R/RW, Via Envy Sound, ATI 9600PRO, 380w Antec PSU

    SERVER - 1800XP, 512MB PC2100, 3x40GB HDD (RAID5), 2x40GB HDD (RAID1), DDS3 Tape Drive, 300w Enermax PSU

  13. #13
    Hammerhead Shark
    Join Date
    Dec 2000
    Posts
    1,579
    Awesome... Thanks a lot for all the info.

  14. #14
    Great White Shark
    Join Date
    Nov 2000
    Posts
    21,595
    Good post Skydog! I was not aware of the tasklist command. It isn't included in the command list generated in a cmd window.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •