bsharath
asked on
On startup of a machine record the Users & groups of the Machine.Just accounts that are manually created.
Hi,
On startup of a machine record the Users & groups of the Machine.Just accounts that are manually created.
Any user or groups that are created manually needs to be logged into a txt file in the UNC path.
Regards
Sharath
On startup of a machine record the Users & groups of the Machine.Just accounts that are manually created.
Any user or groups that are created manually needs to be logged into a txt file in the UNC path.
Regards
Sharath
Are you going to setup a GPO Machine Startup script for this?
ASKER
Hi AT yes via GPO
ASKER
Hi AT any Views...
OK. Try out this .vbs script.
Modify these 3 string variables for your environment.
UNCFile = "C:\AT\ComputerUserGroupli st.txt"
ApprovedUsers = "Administrator,Guest,HelpA ssistant,A SPNET,SUPP ORT_388945 a0"
ApprovedGroups = "Administrators,Users,Powe r Users,Backup Operators,Guests,Remote Desktop Users"
Modify these 3 string variables for your environment.
UNCFile = "C:\AT\ComputerUserGroupli
ApprovedUsers = "Administrator,Guest,HelpA
ApprovedGroups = "Administrators,Users,Powe
On Error Resume Next
UNCFile = "C:\AT\ComputerUserGrouplist.txt"
ApprovedUsers = "Administrator,Guest,HelpAssistant,ASPNET,SUPPORT_388945a0"
ApprovedGroups = "Administrators,Users,Power Users,Backup Operators,Guests,Remote Desktop Users"
strComputer = "."
ApprovedUsers = "," & ApprovedUsers & ","
ApprovedGroups = "," & ApprovedGroups & ","
Set objComputer = GetObject("WinNT://" & strComputer & "")
objComputer.Filter = Array("User")
For Each objUser In objComputer
If InStr(1, ApprovedUsers, "," & objUser.Name & ",", vbTextCompare) = 0 Then WriteToUNC ("LocalUser=" & objUser.Name)
Next
objComputer.Filter = Array("group")
For Each objGroup In objComputer
If InStr(1, ApprovedGroups, "," & objGroup.Name & ",", vbTextCompare) = 0 Then WriteToUNC ("LocalGroup=" & objGroup.Name)
Next
Sub WriteToUNC(Message)
Const ForWriting = 2
Const ForAppending = 8
Set WSHSHELL = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(UNCFile) Then
Set objTextFile = objFSO.OpenTextFile(UNCFile, ForAppending)
Else
Set objTextFile = objFSO.CreateTextFile(UNCFile, ForWriting)
End If
objTextFile.Writeline WSHSHELL.ExpandEnvironmentStrings("%ComputerName%") & "," & Message
objTextFile.Close
Set objFSO = Nothing
Set WSHSHELL = Nothing
End Sub
ASKER
Thanks AT it works fine
Will all machines data get into 1 file?
If yes then can i get them seperate files with Machine name as the txt file name in the UNC folder
Will all machines data get into 1 file?
If yes then can i get them seperate files with Machine name as the txt file name in the UNC folder
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank U AT....Works perfect
Can you help on this...
https://www.experts-exchange.com/questions/25081166/How-can-i-delete-all-related-to-Sophos-registry-entries.html
Can you help on this...
https://www.experts-exchange.com/questions/25081166/How-can-i-delete-all-related-to-Sophos-registry-entries.html
dir /b
to get the localgroups you can use net command
net localgroup