Solved

Query the Admins on multiple servers

Posted on 2010-09-07
9
729 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
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 push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…

803 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