Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Write True or False to a txt file

$
0
0

being new to powershell this might be very easy for everyone here

I have been tasked with creating a script that a monitoring service can run

This script needs to look for a certain word in a certain string within a file

then create a file with true or false in it if it finds it (i am assuming the monitoring software can look at the created file)

Select-String -Path 'd:\pstest\webbad.config' -Pattern WSHttpBinding_Service | Select-String '<!--' -notmatch | Select-String special -quiet >> D:\pstest\special.txt

The above works if its true .. but if its false nothing happens .. so the file is still sitting there with true in it. 

Like I said im completely new to all this, this is just my best guess atm, if I am going about this completely wrong im all ears!

Thanks


Viewing all articles
Browse latest Browse all 21975

Trending Articles