Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20686

Re: Powershell script to searching for a string in a file

$
0
0

Sorry to add to an old post- while I am able to get this to work after doing the above steps (winrm quickconfig, set client) I would prefer to run this as a powershell script only on the local orion poller and allow it connect with UNC path to the remote system. For example rather then using this which works with remote execution;

$sel = select-string -path C:\test_file.txt -pattern "text"

If ($sel -eq $null)….

 

I would prefer to use this with local execution;

$sel = select-string -path \\${IP}\c$\test_file.txt -pattern "text"

If ($sel -eq $null)….

 

If I enter the above into a PS window on the main or additional pollers they work great - but return no path found when executed through the powershell monitor component. I it possibly not passing through the credentials and should I try to pass credentials in the script?

 

Most of our systems are locked down and no way I'll get permission to setup listeners on all the clients when UNC path will work.


Viewing all articles
Browse latest Browse all 20686

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>