Click to See Complete Forum and Search --> : Scripts for Services/OU's and Groups
LaValva
04-04-2005, 10:07 AM
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...
SkyDog
04-04-2005, 10:25 PM
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 (http://www.kixtart.org) 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 (http://www.joeware.net/win/free/index.htm) is a direct link to the free Windows downloads.
LaValva
04-04-2005, 10:37 PM
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?
I4one
04-05-2005, 12:34 AM
From the RUN box;
Start | Run Services.msc
is that what you mean?
LaValva
04-05-2005, 08:07 AM
No... From the command prompt so I can export it as a text file...
ua549
04-05-2005, 08:20 AM
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.
LaValva
04-05-2005, 09:08 AM
Awesome, exactly what I'm looking for... Thanks!
Any other suggestions for getting the other information?
ua549
04-05-2005, 09:51 AM
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.
LaValva
04-05-2005, 11:58 AM
The services command didn't output the full list of running services. Anything else I can use?
ua549
04-05-2005, 12:33 PM
Sorry about that. The info I gave you about services was wrong (I'm getting old. :( )
SkyDog
04-06-2005, 07:49 AM
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.
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 (http://www.sysinternals.com/ntw2k/freeware/psservice.shtml) tool, which is a part of Sysinternals' free Process Tools (http://www.sysinternals.com/ntw2k/freeware/pstools.shtml). 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.
irwincur
04-06-2005, 09:38 AM
For generic scripting check out the TechNet Script Repository.
http://www.microsoft.com/technet/scriptcenter/default.mspx
Easily the best web resource for scripts, questions, and information.
LaValva
04-06-2005, 10:29 AM
Awesome... Thanks a lot for all the info.
ua549
04-06-2005, 10:53 AM
Good post Skydog! I was not aware of the tasklist command. It isn't included in the command list generated in a cmd window.