PHP shell_exec命令在Windows中不起作用

I have the following code which doesn't seem to work, however it works when I open up a command prompt and run the command:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action="ping.php" method="POST">
<label for="pc_number">Provide target PC names (separate with ":"): </label>
<input type="text" name="pc_number" id="pc_number">
<input type="submit">
</form>
<?php if(empty($_POST["pc_number"])==FALSE)
{
    $number = explode(":", $_POST["pc_number"]);
    foreach($number as $pc)
    {        
        $restart = shell_exec("shutdown /r /m {$pc} /t 0");
        echo "Restarting {$pc}... <br>
";
        echo $restart;        
    }
}
?>
</body>

How come it works in the command prompt but not when I execute it via PHP? I am trying to restart a Windows PC remotely.