I am trying to run the docker command in a PowerShell script and test if the command was not successful, but I am failing to do so. I am using:
if (!Invoke-Expression -Command docker ps -q -f name=php72) {
#some other code here
}
The error that I get after running this is:
Line |
31 | if (!Invoke-Expression -Command docker ps -q -f name=php72) {
| ~~~~~~~~~~~~~~~~~~
| The term '!Invoke-Expression' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
| path was included, verify that the path is correct and try again.
I have tried the -not operator to no avail as well.