Powershell use Get-ChildItem

I need to clean data out of my IIs logs before webtrends processes them.  How can I pass the Get-ChildItem -Name results into an array and then run the following command against each item in the array?

(Type $ChildItemVariable1.log) -Notwith "192.168.11.24" | Out-File $ChildItemVariable1.log
LVL 1
ThatVaiGuyAsked:
Who is Participating?
 
Chris DentPowerShell DeveloperCommented:

Hmmm... -NotWith?

Perhaps...

$Dir = "C:\Whatever"
ForEach ($File in (Get-ChildItem $Dir)
{
  (Type $File.Name) -NotWith "192.168.11.24" | Out-File $File.Name
}

Not entirely clear what you're doing to the file, so that simply encapsulates the command in a very simple loop.

Chris
0
 
ThatVaiGuyAuthor Commented:
Sorry, that should have read "-notmatch".  I kept thinking it was -notwith yesterday, but that parameter is not valid.  Forgive me, It was an error on my part.
0
 
ThatVaiGuyAuthor Commented:
Chris-Dent is right that the parameter -notwith is incorrect.  the correct parameter to use is -notmatch.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.