1

I am looking to write a batch or vbs script to gather all users (local to the server. ie. administrators or a local account(not ad users)) on a collection of servers inside my network.

I assume I could do this by subnet. Could even put the server names into a csv text file for the script to read from and report back to. Lots to ask. I would use net user however I run into local access only.

Ideas? Or too many security walls to work?

Update: I do have access to these servers. It is mostly a security check to make sure that no other admin has changed the template. Powershell would be fine as well.

I know it can be done. Just been a while...

6
  • 1
    This question appears to be off-topic because it has too many security walls to work ;) -- Mike I'm guessing you want to find/edit an existing script. Better to check on Technet's Script Center or elsewhere and see what you can find. Not really On-topic here. Commented Jun 9, 2014 at 21:15
  • 2
    So what is your problem here? Do you have access to all these systems? If you don't have access to the system, then you can't do anything. If you do have access, then is the firewall open in a way to permit remote access via powershell/psexec? Commented Jun 9, 2014 at 21:17
  • 1
    I'd say it's on topic if the OP has access to/is owner of the servers in question Commented Jun 9, 2014 at 21:56
  • how is this off-topic? a very common need for a server admin is to manage local and remote users? why doesn't anybody just answer the question around here? Commented Jun 9, 2014 at 22:32
  • @RapidWebs Welcome to SF. There is significant "discussion" over what exactly constitutes "professional" [capacity]. At times, this hair-splitting makes it difficult to see on which side the line is drawn. Commented Jun 10, 2014 at 0:26

1 Answer 1

1

using PowerShell

computerName = Read-Host 'Enter computer name or press <Enter> for localhost' if ($computerName -eq "") {$computerName = "$env:computername"} $computer = [ADSI]"WinNT://$computerName,computer" $computer.psbase.Children | Where-Object { $_.psbase.schemaclassname -eq 'user' } | Format-Table Name, Description -autoSize 

source

or you could use an example from technet, as suggested. here is one

3
  • can Powershell read in a txt file with all the $computerNames$ and export the results to a txt or csv? I would do something like that in a bat script... Any possibility for that? By the way thank you for this info. Commented Jun 16, 2014 at 20:10
  • check out the Import-csv and Export-csv cmdlet's. for example (read csv to array): $Array = Import-Csv .\test.csv -Delimiter ";" Commented Jun 16, 2014 at 20:30
  • some information on Import-csv: technet.microsoft.com/en-us/library/ee176874.aspx (Export-csv is mostly the same logic IIRC). if this helps you resolve your issue, please think about accepting my answer. thanks. Commented Jun 16, 2014 at 20:32

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.