Sometimes, we need to know, if our PowerShell command run successfully or not.
Normally if there are any errors, we see them in red. But still!!
There is a special variable in PowerShell, Dollar sign and question mark $?, which tell about , if the last command runs successfully or not. If the command runs successfully, the output is set to true, and it the command doesn't run successfully, the output contains False.
Now, you must be thinking, what will happen, if the -ErrorAction is set to SilentlyContinue. And you are not able to see the red-error code, in-those-scenario $? is really helpful to know , if the command runs fine or not.
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube” channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.