Need Help creating PowerShell Script

Greeting Experts,

I need help create a PowerShell script to interact with Sysinternals application "psshutdown.exe."  The purpose of the script is to reboot computers that have not restarted after installing updates.  The script needs to be able to read from a .txt file (i.e., list of PCs), prompt the user of the script for Domain Credentials, send out a command to reboot the computer silently, and print out results (successful or Failed) of each machine that is touched by pssshutdown.exe Utility. Can somebody help me create this script....
MikeSecurityAsked:
Who is Participating?
 
FOXActive Directory/Exchange EngineerCommented:
With this one-liner below the user can input his username and it will prompt for his password

 psshutdown @c:\temp\computers.txt -u operatorsusername  -f -r -t 5 > RSLog.txt 2>&1
0
 
FOXActive Directory/Exchange EngineerCommented:
1. cd to where you have your psshutdown executable
2. Run the command against your file that contains the list of machines.     psshutdown @c:\temp\computers.txt -u user -p passwd -r -t 5

ref link: https://ss64.com/nt/psshutdown.html
0
 
MikeSecurityAuthor Commented:
The person who will be using the script is not very "technology savvy" and is more like an operator. That is the reason I was looking to use a script that will prompt for the user to input Domain credentials, and print out feedback for every device the pssshutdown.exe utility reboots... I am hoping to keep it as simple as possible for the operator who will be running it.
0
 
Kevin StanushApplication DeveloperCommented:
You might want to be careful doing this, as the default security in Windows will require that these credentials (userid/password) have access that you might not want this user to have.  The Windows security right needed is named SeRemoteShutdownPrivilege, and you can get more info here:

https://superuser.com/questions/332548/how-can-i-allow-non-administrators-to-use-shutdown-exe

You can set this right through group policy on your computers.

You also might be able to find a free utility to do this, with a better GUI.  There is probably one out there that can do this and be more friendly, including how it prompts for credentials, if needed.

But definitely look at the security, then you can add this user to a group with the shutdown right.
0
 
MikeSecurityAuthor Commented:
the command has completed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.