Getting Data In

Help with field extraction of CMD output like "net localgroup Administrators" or "query user"

DominikW
Engager

Hi,

we like to know which user is in the local Administrator Group and wich is the active User Account of our windows clients.

1. to get the local admins we use  "netgroup local Administrators" and write the output into an textfile.

This is the Output.txt:

-------------------------------------------------------------------------------

Aliasname Administratoren
Beschreibung Administratoren haben uneingeschr„nkten Vollzugriff auf den Computer bzw. die Dom„ne.

Mitglieder

-------------------------------------------------------------------------------
Administrator
AdminX
AdminY
AdminZ
User

Der Befehl wurde erfolgreich ausgefhrt.

-------------------------------------------------------------------------------

Now there are five Members in the local Administrator group.

How can we get these values into fields? 

Like:

localAdmin = Administrator

localAdmin = AdminX

localAdmin = AdminY

localAdmin = AdminZ

...

 

2. We use "query user" to get the active user and write the output in a textfile

This is the output.txt:

BENUTZERNAME SITZUNGSNAME ID STATUS LEERLAUF ANMELDEZEIT
>user console 1 Aktiv 1:07 26.09.2022 12:41

How can we extract these fields?

Like:

Benutzername = user

Sitzungsname = console

ID = Aktiv

...

 

Thank you in advance!

Dominik

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...