Solved

Query the Admins on multiple servers

Posted on 2010-09-07
9
734 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

726 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