Searching output of command for string

I need some assistance looking for a specific string in the output of a command. See below

with disable_file_system_redirection():
process=subprocess.Popen('powershell "%s"'%ps_command, shell=True, stdout=subprocess.PIPE)
process_out, process_err = process.communicate()
     if ret==0:
     mystring = "Result=Off"
     if mystring in process_out:
        print process_out

So Im trying to define ‘mystring’ as the text I want to search for and check to see if its in ‘process_out’ which should execute the command and return the output.

However it doesnt seem to be catching. When I test it on a computer that should contain that string in the output, the script runs as if it doesnt contain the string.

I figured this out. The ps_command reference needed to be defined differently. I needed to change the quoting of the actual command with triple single quotes.

ps_command=r’’‘some commands here’’’

Once I did that, it was putting the correct info in the result and my checks started working.