I use bat + Powershell script to reboot a domain computer. I do not want to use domain admin but local user with admin privileges.
bat file:
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Unrestricted -File ""d:\public\Reboot Computer\Reboot.ps1""' -Verb RunAs}";
Powershell Reboot.ps1:
Restart-Computer -ComputerName (Read-Host "ComputerName") -Credential (Get-Credential) -Force
I run bat as administrator, then enter computer name comp002, as credentials I use local user which are in administrators group comp002\admuser and password script is executed but computer is not rebooting.
Maybe the problem is related to windows firewall (WMI are allowed)?