Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <title>Reset O365 User Password</title>
- </head>
- <body>
- <?php
- // If no submit is posted display the form.
- if(!isset($_POST["submit"]))
- {
- ?>
- <form name="Password-Reset" id="Password-Reset" action="password-reset.php" method="post" />
- Username(E-Mail): <input type="text" name="o365username" id="o365username" /><br />
- New Password: <input type="text" name="o365password" id="o365password" /><br />
- <input type="submit" name="submit" id="submit" value="Reset" />
- </form>
- <?php
- }
- // ElseIf submit was pressed, check if all of the required variables have a value:
- elseif((!empty($_POST["o365username"])) OR (!empty($_POST["o365password"])))
- {
- // Get the variables submitted by POST to pass them to the PowerShell script:
- $o365username = $_POST["o365username"];
- $o365password = $_POST["o365password"];
- // Path to the PowerShell script. Remember double backslashes:
- $psScriptPath = "C:\\powershell\\PasswordReset\\PasswordReset.ps1";
- // Execute the PowerShell script, passing the parameters:
- echo '<img src=\"images\processing.gif\" border=\"0\"></ br>';
- $psquery = shell_exec("powershell -command $psScriptPath -username '$o365username' -password '$o365password'< NUL");
- echo "</ hr></ br>";
- echo $psquery;
- }
- // Else Submit posted without all required fields being filled out
- else
- {
- echo "Sorry, you did not complete all required fields. Please go back and try again.";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement