Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

list local groups & user membership with alternate credentials

$
0
0

Hello All,

I need to scan windows servers and retrieve members of all local groups. Right now I am using this vbs script:

Const ForAppending = 8

Const ForReading = 1
ServerCount = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
    ("list.txt", ForReading)
Do Until objTextFile.AtEndOfStream
    strNextLine = objTextFile.Readline
strComputer = strNextLine
WScript.Echo "Processing " & strComputer
ProcessGroups
ServerCount = ServerCount + 1
Loop
Sub ProcessGroups
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile("GroupInfo.txt", _
    ForAppending, True)
  
objLogFile.writeline " "
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")
For Each objGroup In colGroups
    For Each objUser in objGroup.Members
        objLogFile.writeline strComputer & vbTab & objGroup.Name & vbTab  & objGroup.Description & vbTab & objUser.ADsPath
    Next
Next
objLogFile.Close
End Sub

Set WshShell = WScript.CreateObject("WScript.Shell")

But I would like to ask, if is possible following:

1. modify script to list only domain accounts and not also local users

2. modify scrpt to use alternate credentials -> I am running script from terminal server, which is in another domain as scanned servers.

Or if you have some another script, which can help me :)

Thank you very much for your help.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>