troubleshooting Question

Loged On Users Of Computers In A Text File

Avatar of juleswale
juleswaleFlag for United Kingdom of Great Britain and Northern Ireland asked on
VB Script
33 Comments1 Solution319 ViewsLast Modified:
Hi,

I have a script that lists the computers in a Group and writes them to a text file.

I would like another sub routine that reads the text file and populates a second text file with the currently logged on users of those computers.

Please could you help.
Sub GETGROUPMEMBERS ()
	Const ForAppending = 8
	Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objFile = objFSO.OpenTextFile(StrComputerGroupFile, ForAppending, True)
	
	objFile.WriteLine "Least Updated" & " " & Now 
	Set objGroup = GetObject(StrGroupName)
	arrMemberOf = objGroup.GetEx("member")
	For Each strMember in arrMemberOf
		Set oObject = GetObject("LDAP://" & strMember)
		If LCase(oObject.Class) = "user" Then
			objFile.WriteLine oObject.sAMAccountName
		ElseIf LCase(oObject.Class) = "computer" Then
			objFile.WriteLine Left(oObject.sAMAccountName, Len(oObject.sAMAccountName) - 1)
		End If
	Next
	
	objFile.Close
	
	Set objFSO = Nothing 
	Set objFile = Nothing 
	Set objGroup = Nothing
End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 33 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 33 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros