Link to home
Start Free TrialLog in
Avatar of johnnyjonathan
johnnyjonathan

asked on

Add exportation of "managed by" to an exsisting script that export the security groups.

Hi,
I have the below attached VBSCRIPT that reads from a txt file UNC paths.
It exports all the security groups listed in each UNC path.
i was wondering if there's any way that the script can also export the "managed by" tab of each security group. (Excluding several build in groups like domain\domain admins, administrators, everyone...)

(the script uses showacls.exe found from Win 2003 Server Resource kit)
 
 
Const ForReading = 1
 
strList = "c:\list.txt"
strLog = "c:\log.txt"
strFile = "c:\showacls.exe"
  
Set objfso = CreateObject("Scripting.FileSystemObject")
Set objshell = CreateObject("wscript.shell")
Set objlist = objfso.OpenTextFile(strList, ForReading)
Set objlog = objfso.CreateTextFile(strLog, True)
 
Do Until objlist.AtEndOfStream
strPath = objlist.ReadLine
strTemp = Replace(strPath, "\\","")
strHost = Split(strTemp, "\")
If Reachable(strHost(0)) then
cmd = strFile & "  " & strPath
Set objexec = objshell.Exec(cmd)
objlog.WriteLine "ACLS For " & strPath
objlog.WriteLine "-----------------------"
objlog.WriteLine objexec.StdOut.ReadAll & vbCrLf
Else
objlog.WriteLine strHost(0) & " Isn't Reachable" & vbCrLf
End if
Loop
 
MsgBox "Script finished." & vbNewLine & "Please see: " & strLog
 
Function Reachable(strComputer)
 
 strCmd = "ping -n 1 " & strComputer
 
 Set objShell = CreateObject("WScript.Shell")
 Set objExec = objShell.Exec(strCmd)
 strTemp = UCase(objExec.StdOut.ReadAll)
 
 If InStr(strTemp, "REPLY FROM") Then
 Reachable = True 
 Else
 Reachable = False
 End If
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh I left in my testing paramaters.  Delete these lines:
strList = "list.txt"
strLog = "log.txt"
strFile = "c:\program files\resource kit\showacls.exe"

and uncomment the ones above them.

Regards,

Rob.
Avatar of johnnyjonathan
johnnyjonathan

ASKER

As always, you are a true pro! thank you
Great! Glad it worked. Thanks for the grade.

Regards,

Rob.