Solved

Query the Admins on multiple servers

Posted on 2010-09-07
9
727 Views
Last Modified: 2012-08-13
I wanted to know if it is possible to create a script that will pull the admins on multiple servers and store the information in excel? I have admin rights on all servers, this can be done in Powershell or VBA.

Thank you
0
Comment
Question by:m_travis
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33622096
This can be done in powershell, but now that I think about it, there are probably easier ways such as using AD functions.  Are you using AD?  Here's an blog post that talks about it, and some script tools that can help. Look for "Use PowerShell to Get Local Group Members from a Remote Computer" in the blog.

http://tasteofpowershell.blogspot.com/

Here's another way to do it and it puts it into excel:

http://www.vistax64.com/powershell/184570-getting-powershell-output-into-sql-table.html
0
 
LVL 1

Expert Comment

by:ldap389
ID: 33622528
As suggested by developedtester, if you have AD, you can use Restricted Groups Policy to pull admins on servers rather than scripting:

http://support.microsoft.com/kb/279301/en-us
http://www.windowsecurity.com/articles/Using-Restricted-Groups.html
http://www.ldap389.info/en/2010/05/12/restricted-groups-policy/




0
 
LVL 39

Accepted Solution

by:
Krzysztof Pytko earned 500 total points
ID: 33624599
download psexec from SysInternals and use this syntax

psexec \\servername -u <administrator> -p <password> net "localgroup administrators >\\server\share\testfile.txt"

and then import text file into excel.

You can also prepare text file with servers , each name in separate line and then use

psexec @server_testfile.txt -u <administrator> -p <password> net "localgroup administrators >\\server\share\testfile.txt"
0
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 33624605
sorry instead of > sign use >> Firts one overwrites your output line. Sorry once again for mistake

psexec \\servername -u <administrator> -p <password> net "localgroup administrators >>\\server\share\testfile.txt"
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33627690
I think iSiek's comment will be the way to go, especially if you don't have AD.  (very nice iSiek)  Parsing the psexec output and putting it into excel can be done using powershell.  Here's a link to help with the excel part, and if you need help parsing, just let us know.

http://kentfinkle.com/PowershellAndExcel.aspx
0
 
LVL 1

Author Comment

by:m_travis
ID: 33682192
we do have AD
0
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33701187
So this link:

http://www.myitforum.com/articles/40/view.asp?id=12263

has this command:

Get-QADUser -ldapFilter '(SamAccountName=*.admin)'|export-csv admins.csv

but you need this free addon:

http://www.quest.com/powershell/activeroles-server.aspx

The other link I gave can do it, but probably not as robustly as using the Quest addon.
0
 
LVL 1

Author Comment

by:m_travis
ID: 33791488
I would prefer if there was a way to do the query with using DOS or VB
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
RSOP Red "X" 7 31
SBS2008 c:\ drive toosmall 64 66
vmdk greater than 2TB 2 31
how do i add admin console 4 13
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now