Hello, so I’m trying to write a simple script for one of our users to restart a computer that’s running a display in the lobby. The display sometimes freezes up and all we have to do is restart the compute and it loads the display on startup. So I got a simple script here:
Param( [Parameter(Mandatory=$True)] [string[]]$ComputerName ) Invoke-Command -ComputerName $ComputerName {shutdown.exe -r -t 0} -Verbose pause
It works just fine, but it looks like this when it’s ran:
cmdlet Restart Computer.ps1 at command pipeline position 1 Supply values for the following parameters: ComputerName[0]:
I’d like to get rid of the top two lines and replace it with some instructions like:
“Type the NETBIOS name, IP address, or fully-qualified domain name of one or more computers in a comma-separated list. To specify the local computer, type the computer name, “localhost”, or a dot (.). You can select multiple computers to restart. Hit enter on a blank line to continue.”
I’m still pretty new to powershell, so I don’t know if this is even possible. I’ve tried the echo command, which ended up kinda weird; write-host didn’t work; write-output I’m not sure if I used correctly, but it didn’t work.
Any help would be appreciated. Thanks!