If you are renaming a computer or joining a domain, then you will need to be able to either shut down or reboot a remote computer. To do this, you can use WMI to perform both tasks. In the ShutdownRebootComputer.ps1 script, use the shutdown() and the reboot() methods from the Win32_OperatingSystem WMI class. To determine which method to call, use the -a parameter in the script to specify the action to take.
The first line of the ShutdownRebootComputer.ps1 script defines the param statement. Once again, specify multiple default values as shown here:
param( $computer="localhost", $user = "administrator", $password, $a, $help )
Next, use the funhelp function to print a help string if requested by the user. ...