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()
ret=process.returncode
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.