Solved

Query the Admins on multiple servers

Posted on 2010-09-07
9
725 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
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 walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…

746 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

13 Experts available now in Live!

Get 1:1 Help Now