Avatar of Phase2
Phase2Flag for United States of America

asked on 

Change Local Administrator Password script by passing variable from webpage

I am trying to make a very simple webpage were I can enter in a new password for the local administrator in a text box and click a button that sets a variable that I can use in a bat file.

How can I do this? Do not need to focus on the webpage part just the setting of the variable and passing it to a bat or vbs or something I can plug into.

Windows 2008 r2
VB ScriptShell ScriptingPowershell

Avatar of undefined
Last Comment
x-men
Avatar of x-men
x-men
Flag of Portugal image

$password = "MyNewPassword"
$user = [ADSI]"WinNT://./Administrator"
$user.SetPassword($password)
$user.SetInfo()
Avatar of x-men
x-men
Flag of Portugal image

vbs:

strPassword = "MyNewPassword"
Set objUser = GetObject("WinNT://./Administrator,user")
objUser.SetPassword strPassword
objUser.SetInfo

Avatar of Phase2
Phase2
Flag of United States of America image

ASKER

What is your first post? BAT file?

I need to set the $password variable from a webpage using perl,php,java,forms whatever.

then pass that variable into a vbs script or bat file or something I can make work to change the local administrator password.

not sure how to pass the variable into a seperate script file
Avatar of Phase2
Phase2
Flag of United States of America image

ASKER

So basically I have a webpage that looks like this. attached.
 User generated image
My Form code is below. Also checks to make sure both entered passwords are the same.

How do I get the password entered in this webpage to a VBS script?
<form onSubmit="return checkPw(this)" name="cusfiles" method="get" action="changepassword.vbs">
	<table border=0 summary="Changepassword">
	<tr>
		<td>Password:</td><td><input type=password name=pw1 size=20></td>
	</tr>
	<tr>
		<td>Re-Enter:</td><td><input type=password name=pw2 size=20></td>
	</tr>
	<tr>
		<td colspan=2 align=center><input type=submit value="Submit"></td>
	</tr>
	</table>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of x-men
x-men
Flag of Portugal image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of x-men
x-men
Flag of Portugal image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
VB Script
VB Script

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo