What happens if I run this command in Powershell

As Powershell allows us to do things, like stop process, move files and more, we might prefer to check “what if I run this command” before actually executing it.

Whatif

Let’s assume we want to stop several processes, but before executing the command we’d like to see some output showing what the command will do.

For example

Get-Process *host | Stop-Process -whatif

Instead of actually stopping the processes found via the wildcard *host this will output a list of “what if” statements, showing the operation which would take place against which target (process).

So we might notice that our wildcard includes unintended consequences and can thus save ourselves the headache unwanted changes.