header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Get the event counts from E2K7 msg trk logs.
Last Post 20 Jan 2008 01:06 AM by mjolnir. 8 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
mjolnirUser is Offline
New Member
New Member
Posts:12
Avatar

--
19 Jan 2008 10:50 PM  

gci MSGTRK*.log -name |% {

$src_evt_ht = @{}

write-host

$_

gc $_ | foreach {

if ($_.startswith("2";)){

$rec = $_ -split ","

$src_evt_ht[($rec[7] + "." + $rec[8])] += 1

}

}

write-host

$src_evt_ht

}



mjolnirUser is Offline
New Member
New Member
Posts:12
Avatar

--
19 Jan 2008 10:59 PM  

Some weird pastage on the original post.

 

Let's see if this works better.

 

gci MSGTRK*.log -name |% {
 $src_evt_ht = @{}
 
 write-host
 $_
 gc $_ |
 foreach {
  if ($_.startswith("2";)){
   $rec = $_ -split ","

   $src_evt_ht[($rec[7] + "." + $rec[8])] += 1
  }
 }

 write-host
 $src_evt_ht
}

 

 



mjolnirUser is Offline
New Member
New Member
Posts:12
Avatar

--
19 Jan 2008 11:02 PM  

Still looks odd.

Script file attached.


Attachment: 11197395371.ps1

mjolnirUser is Offline
New Member
New Member
Posts:12
Avatar

--
19 Jan 2008 11:45 PM  

TXT attachment to make the server happy.


Attachment: 1119495110971.txt

halr9000User is Offline
PowerShell MVP, Site Admin
Basic Member
Basic Member
Posts:334
Avatar

--
19 Jan 2008 11:57 PM  

If you use the style drop-down and pick Code, it should work ok for you.

gci MSGTRK*.log -name |% {
$src_evt_ht = @{}

write-host
$_
gc $_ |
foreach {
if ($_.startswith("2";)){
$rec = $_ -split ","

$src_evt_ht[($rec[7] + "." + $rec[8])] += 1
}
}

write-host
$src_evt_ht
}



Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
mjolnirUser is Offline
New Member
New Member
Posts:12
Avatar

--
20 Jan 2008 12:53 AM  
Rules, rules, rules!  Everythings gotta have rules! - Calvin
 
Looks like it got rid of the "smiley", but still doesn't like
the index references in the hash table accumulator.
 
 
 
gci MSGTRK*.log -name |% {
	$src_evt_ht = @{}
	
	write-host
	$_
	gc $_ | 
	foreach {
		if ($_.startswith("2";)){
			$rec = $_ -split ","

			$src_evt_ht[($rec[7] + "." + $rec[8])] += 1
		}
	}

	write-host
	$src_evt_ht
}


mjolnirUser is Offline
New Member
New Member
Posts:12
Avatar

--
20 Jan 2008 12:54 AM  

TANJ!

The "smiley' doesn't show up on Preview, but it's there in the post.



halr9000User is Offline
PowerShell MVP, Site Admin
Basic Member
Basic Member
Posts:334
Avatar

--
20 Jan 2008 12:59 AM  
Yeah, I noticed that. :s I'm sorry your post has turned into a guinea pig. I've brought the issues you're having with the editor to the community leaders. We'll talk it over and find a good fix.


Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
mjolnirUser is Offline
New Member
New Member
Posts:12
Avatar

--
20 Jan 2008 01:06 AM  

No problem.  If it makes it easier to clean up after you get it cornered and stomped on, you can just delete the thread and I'll re-post it if you want.



You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer