So we have 850 plus folders out on a network share that has user data so for example the full path would be
\\server1\data\username1
\\server1\data\username2
\\server1\data\username3
\\server1\data\username4
\\server1\data\username5
etc...
Insdide each username folder are 4 folders and some text files, like this
What I want to do is just search the Logs folder under each username for a specific .log file to select-string
To make this even more daunting, there are about 20-30 .log files inside the log folder
Here is my starting point
Get-childitem \\server1\data -Recurse -Include *.log | Select-String 'Network Limit', 'Run Interval'
Just trying to add some powershellfu and search just the Logs directory
Get-childitem filter down
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Get-childitem filter down
Try it like this:
Code: Select all
Get-ChildItem \\server1\data\*\logs -Directory |
ForEach-Object{
Get-ChildItem $_
} |
Select-String 'Network Limit', 'Run Interval'
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Get-childitem filter down
Gasp! I can't believe it was so simple
puny brain
this will give me a great way to learn regex & replace since my string now looks like this
\\server\Data\user\Logs\Application_Run_2017-05-17.log:1317:2017-05-17_13-45-53 : Network Limit = 1
There will literally be thousands of these files and I just want to export it to a table\csv\excel and have it look like this
Cheers!
puny brain
this will give me a great way to learn regex & replace since my string now looks like this
\\server\Data\user\Logs\Application_Run_2017-05-17.log:1317:2017-05-17_13-45-53 : Network Limit = 1
There will literally be thousands of these files and I just want to export it to a table\csv\excel and have it look like this
Code: Select all
Server User NetworkLimit
servername username Very last digit