How do. Just had an issue here in production with a script of mine that uses 'Select-String'.
What happens is... – the script uses PSFTP to send some files from here to a remote directory. It scrolls output to a txt file – I use 'Select-String' within the txt file output to see if the file transfer worked: something like...
(I've changed file names to protect the innocent...). This worked fine in my testing, and in prod for three days. Today it failed to find the text. But when I grab the XFER_TODAY.txt file and run the same logic, it works fine.
So – anything funny with Select-String? Or maybe my PSFTP had the file locked exclusive and 'Select-String' failed to go through the lock?
Thoughts welcome – and thanks!
by nohandle at 2012-11-14 14:02:57
Hi, it is hard to say what exactly went wrong. You should implement some logging and exception handling to be aware of any errors.
btw: the patttern is regex and . has some special meaning in regex. not really a problem in this case but you should use -simpleMatch operator.
by JonBryce at 2013-01-28 10:58:49
Thanks Jakub – I'll put in the '-simplematch'. I already have logging and exception – but I'll see what else I can do.