A. If you want to run a command in PowerShell but aren't sure what it will do, you can use "-whatif" at the end of the command. For example, if you want to execute the Get-Process command and pipe its output to the Stop-Process command, but you're not sure what it will actually do, you can append -whatif to the end of the command. Doing so shows the output of what would be done, but doesn't actually run the command, as the following example shows:
PS C:\Documents and Settings\Administrator> get-process | stop-process -whatifWhat if: Performing operation "Stop-Process" on Target "alg (1872)".
What if: Performing operation "Stop-Process" on Target "certsrv (1036)".
What if: Performing operation "Stop-Process" on Target "csrss (660)".
What if: Performing operation "Stop-Process" on Target "csrss (3028)".
What if: Performing operation "Stop-Process" on Target "ctfmon (1880)".
What if: Performing operation "Stop-Process" on Target "ctfmon (2612)".
What if: Performing operation "Stop-Process" on Target "Dfsr (1864)".
What if: Performing operation "Stop-Process" on Target "dfssvc (1164)".
What if: Performing operation "Stop-Process" on Target "dmadmin (2096)".
What if: Performing operation "Stop-Process" on Target "dns (1204)".
What if: Performing operation "Stop-Process" on Target "explorer (216)".
.. This example shows that if you would run the command without the -whatif, it would stop all processes on the machine (a very fast shutdown). Alternatively, you can use the -confirm inplace of -whatif to be prompted before each action is performed, as this example shows:
PS C:\Documents and Settings\Administrator> get-process | stop-process -confirmConfirm Are you sure you want to perform this action? Performing operation "Stop-Process" on Target "alg (1872)". \[Y\] Yes \[A\] Yes to All \[N\] No \[L\] No to All \[S\] Suspend \[?\] Help (default is "Y"): l