Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

powershell stop-computer error handling

$
0
0

I am working on a powershell script to shut down all of the computers in an office every night for a customer. So far, I have the script working to read the computer list from a text file and shut down each computer as long as I know it is on.

I want to know if I need to add some sort of error handling where if the computer is already off it will skip the computer and not freeze the program. When I ran the script in the powershell ISE it gave me errors when the computer was already off and I want to make sure that it won't stop the other computers from shutting down if it hits the error.

I am new to powershell, so I'm sorry if this is a silly/stupid question.


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>