I created this command line to search all sub folders from where it is ran and use a certain file type and then do a select-string -pattern " the string you want"
Her is the script that has variables I use
get-childitem *snpdrvdbg*.log -recurse | select-string -pattern "$string" -context 3, 3 | Foreach {"$_$nl"} | out-file -Filepath $ActivityLog -encoding ascii
I am running this on a file share . That path is \\stingray\data\2005436477\snap logs\SnapDrive. This is actually a psdrive
Stingray FileSystem \\stingray\data
The results that I get looks something like this in the txt file
\\stingray\data\2005436477\snap logs\SnapDrive\Snpdrvdbg.log:1727:01/12-12:08:36.480 PID:2464 TID:6976 filer_set.cpp@13 filer_t::get_network_name: start.
\\stingray\data\2005436477\snap logs\SnapDrive\Snpdrvdbg.log:1728:01/12-12:08:36.480 PID:2464 TID:6976 localerror.cpp@82 Is_VDS_ITF_Error(): false.
I would like to know if it is possible to remove part of what is written to the txt file or shown on the screen like the current path I am in. Looking to maybe see something like this:
Snpdrvdbg.log:1727:01/12-12:08:36.480 PID:2464 TID:6976 filer_set.cpp@13 filer_t::get_network_name: start.
Snpdrvdbg.log:1728:01/12-12:08:36.480 PID:2464 TID:6976 localerror.cpp@82 Is_VDS_ITF_Error(): false.
Now the file path will never be the same so I was trying to use a variable $path=$pwd.ProviderPath to reports back the current path and location I am in for example:
PS Stingray:\2005436477\snap logs\SnapDrive> $path=$pwd.ProviderPath
PS Stingray:\2005436477\snap logs\SnapDrive> $path
\\stingray\data\2005436477\snap logs\SnapDrive
PS Stingray:\2005436477\snap logs\SnapDrive>
Any help would be great as I am running out of brain cells here.
If you have any questions please feel free to reply. I work 3rd shift so I am here most of the night to reply back in a timely manner. Again thank you for who wver can help me.
Thanks
George