Trivial in powershell. Use sort with the groupby option.

 

Regards,

 

Michael B. Smith, MCITP:SA,EMA/MCSE/Exchange MVP

My blog: http://TheEssentialExchange.com/blogs/michael

Link with me at: http://www.linkedin.com/in/theessentialexchange

 

From: David McSpadden [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 01, 2008 1:33 PM
To: NT System Admin Issues
Subject: Run a batch file to send emails

 

I want to read an input file.

It would comma delimited.  It will have those users that have not logged off
and are getting after hours logon events with their names.

I only want to send 1 email per user so I would have to sort and then group
then blat out the email.

My format for the file is like this:

866265068,Security,Security,AUDIT FAILURE,031004LD5Z3K55,12/1/2008 12:49:14
AM,530,SYSTEM\NT AUTHORITY,Logon Failure:     Reason:  Account logon time
restriction violation     User Name: DawnH     Domain:  IM_DOM1     Logon
Type: 3     Logon Process: NtLmSsp      Authentication Package: NTLM
Workstation Name: XP31090634014W     Caller User Name: -     Caller Domain:
-     Caller Logon ID: -     Caller Process ID: -     Transited Services: -
Source Network Address: 10.0.31.40     Source Port: 1087    

866265066,Security,Security,AUDIT FAILURE,031004LD5Z3K55,12/1/2008 12:49:11
AM,530,SYSTEM\NT AUTHORITY,Logon Failure:     Reason:  Account logon time
restriction violation     User Name: DawnH     Domain:  IM_DOM1     Logon
Type: 3     Logon Process: NtLmSsp      Authentication Package: NTLM
Workstation Name: XP31090634014W     Caller User Name: -     Caller Domain:
-     Caller Logon ID: -     Caller Process ID: -     Transited Services: -
Source Network Address: 10.0.31.40     Source Port: 1044    

866265063,Security,Security,AUDIT FAILURE,031004LD5Z3K55,12/1/2008 12:49:07
AM,530,SYSTEM\NT AUTHORITY,Logon Failure:     Reason:  Account logon time
restriction violation     User Name: DawnH     Domain:  IM_DOM1     Logon
Type: 3     Logon Process: NtLmSsp      Authentication Package: NTLM
Workstation Name: XP31090634014W     Caller User Name: -     Caller Domain:
-     Caller Logon ID: -     Caller Process ID: -     Transited Services: -
Source Network Address: 10.0.31.40     Source Port: 4976    

866264132,Security,Security,AUDIT FAILURE,031004LD5Z3K55,12/1/2008 12:34:33
AM,530,SYSTEM\NT AUTHORITY,Logon Failure:     Reason:  Account logon time
restriction violation     User Name: DavidE     Domain:  IM_DOM1     Logon
Type: 3     Logon Process: NtLmSsp      Authentication Package: NTLM
Workstation Name: XP250308200506     Caller User Name: -     Caller Domain:
-     Caller Logon ID: -     Caller Process ID: -     Transited Services: -
Source Network Address: 10.0.50.48     Source Port: 4656    

866264130,Security,Security,AUDIT FAILURE,031004LD5Z3K55,12/1/2008 12:34:33
AM,530,SYSTEM\NT AUTHORITY,Logon Failure:     Reason:  Account logon time
restriction violation     User Name: DavidE     Domain:  IM_DOM1     Logon
Type: 3     Logon Process: NtLmSsp      Authentication Package: NTLM
Workstation Name: XP250308200506     Caller User Name: -     Caller Domain:
-     Caller Logon ID: -     Caller Process ID: -     Transited Services: -
Source Network Address: 10.0.50.48     Source Port: 4614    

866264128,Security,Security,AUDIT FAILURE,031004LD5Z3K55,12/1/2008 12:34:33
AM,530,SYSTEM\NT AUTHORITY,Logon Failure:     Reason:  Account logon time
restriction violation     User Name: DavidE     Domain:  IM_DOM1     Logon
Type: 3     Logon Process: NtLmSsp      Authentication Package: NTLM
Workstation Name: XP250308200506     Caller User Name: -     Caller Domain:
-     Caller Logon ID: -     Caller Process ID: -     Transited Services: -
Source Network Address: 10.0.50.48     Source Port: 4572    

866264126,Security,Security,AUDIT FAILURE,031004LD5Z3K55,12/1/2008 12:34:33
AM,530,SYSTEM\NT AUTHORITY,Logon Failure:     Reason:  Account logon time
restriction violation     User Name: DavidE     Domain:  IM_DOM1     Logon
Type: 3     Logon Process: NtLmSsp      Authentication Package: NTLM
Workstation Name: XP250308200506     Caller User Name: -     Caller Domain:
-     Caller Logon ID: -     Caller Process ID: -     Transited Services: -
Source Network Address: 10.0.50.48     Source Port: 4529    

 

So basically I want to skip everything except the User Name: and Workstation
Name:

I generate this list every morning for the prior day using psloglist and now
I want to parse it and blat an email to the offenders telling them to shut
down every night.

 

Any ideas???

 

 

 

 

Data Security is everyone's responsibility.

 

 

 

 

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to