Also, you can clean up a lot of PSExec's 'extra' output by throwing away the
'stderr' stream, so:

 

Psexec \\%server% net localgroup "Administrators"   2>NUL  >>%log%

 

And, you can cleanup net localgroup's output with some carefully placed
'findstr' filtering.

 

Mike.

 

 

From: Rankin, James R [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 18, 2008 12:33 am
To: Active Directory Admin Issues
Subject: RE: Script for retriving local admin users

 

How about this quick bit of batch using psexec from PSTools suite

 

 

@echo off

Setlocal

 

Set log=wherever I want to log to.txt

 

For /f %%a in (mytextfile.txt) do set server=%%a& call:NEXT

 

 

Endlocal

Goto :eof

 

 

:NEXT

 

Echo %server%>>%log%

Psexec \\%server% net localgroup "Administrators">>%log%

Goto :eof

 

 

 

 

May need a bit of tidying up, but will get you the down-and-dirty info quite
quickly.

 

  _____  

From: Naresh Kumar [mailto:[EMAIL PROTECTED] 
Sent: 18 April 2008 05:08
To: Active Directory Admin Issues
Subject: Script for retriving local admin users

 

~ NEW: CounterSpy Enterprise: Centralized Antispyware - #1 in eWEEK Test! ~
    ~    ~

 

~ NEW: CounterSpy Enterprise: Centralized Antispyware - #1 in eWEEK Test! ~
    ~    ~

~ NEW: CounterSpy Enterprise: Centralized Antispyware - #1 in eWEEK Test! ~
    ~  <http://www.sunbelt-software.com/product.cfm?id=400>  ~

Reply via email to