Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Cleaning unwanted data from IIS log files.

Reply
Thread Tools Display Modes

Cleaning unwanted data from IIS log files.

 
 
ThatVaiGuy
Guest
Posts: n/a

 
      12-28-2009
So here's what I have and could use some help. I'm a scripting newbie.
I'm cleaning IPs out of IIS logs in powershell. I'm calculating the current
date and appending it into the file name, changing the directory, and then
running my little type command and piping the results to another file. I can
do this using the type command in powershell like this:

$date = Get-Date -format yyMMdd
$filename = "u_ex$date.log"
cd \
d:
cd iis1-w3svc1
(Type \\iisserver\w3svc1\$filename) -notmatch "10.10.10.2" -notmatch
"10.10.10.3" | out-file $filename

this is working okay for the current day's log file, but now I need to run
this type command on all older log files in the directory to remove the data
I don't want to report on:
Get-ChildItem \\iisserver\w3svc1 -name and run this command on every object
in the folder one at a time, remove the data I don't want with the -notwith
parameter and pipe the results to another file on another machine.

So my question is how can I work with the Get-Childitems file names for the
type command to work and the outfile to work correctly? I know what I want to
do, but I'm having syntax trouble. Am I doing this efficiently?

Someone please help, thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Offline files fail to synchronize Bob Windows Vista File Management 19 04-30-2009 04:45 AM
Shared Data Files with XP and Vista Frank Preston 2 Windows Vista File Management 0 11-17-2007 05:37 PM
User Account Control & Data in the Program Files Folder Brian T Windows Vista Administration 1 07-24-2007 05:03 PM
Files cannot be written/modified everywhere?? prasad Windows Vista File Management 5 12-16-2006 04:01 PM
Outlook 2007 Data files Obialor Windows Vista File Management 3 09-10-2006 10:25 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59