Jump to content

Change Administrator password


Recommended Posts

I need a solution for this:

I'm building a WinXP with nlite, and I wish at the final of installation, I mean the first time you run Windows, to launch something, a little application, script, or anything to ask you for the new admin password...

In cmd is really simple, but I need something more "graphical", with a little more estetic :P

Thanks in advice,

Bj

Link to comment
Share on other sites


probably not the best looking solution, but you might be able to get the text that the user enters in a command prompt and change the password to that..

such as.. a command prompt that pops up with

Enter New Administrator Password:

however.. it would be in clear text, and woudln't be able to check itself against password rules.... like having spaces, min length.. i'm sure someone with vbs scripting knowledge would be able to make this.. using an inputbox.

Link to comment
Share on other sites

Here is a simple VBS Script That changes the user who is log on pass word.

Save as ChangePassWord.Vbs

strComputer = "."

Dim A1, Act,UserN

Set Act = CreateObject("Wscript.Shell")

UserN = Act.ExpandEnvironmentStrings("%UserName%")

A1 = InputBox("Please Type In A New Pass Word For : " & UserN,"Gsm Change Pass Word",,5500,4800)

If A1 = "" Then

Act.Popup UserN & ", Has Cancel The Pass Word Change", 5, "Cancel Pass Word", 0 + 32

End If

If A1 <> "" Then

Set objUser = GetObject("WinNT://" & strComputer & "/" & UserN & ", user")

Act.Popup UserN & ", You Have Change Your Pass Word " & vbCrLf &_

"To This Pass Word, " & A1, 5,"Cancel Pass Word", 0 + 32

objUser.SetPassword A1

objUser.SetInfo

End If

This is a HTA that uses VBS script to change the pass word this looks a lot better

but the code is longer.

Save As ChangePassWord.hta

<HTML><HEAD><TITLE> Gsm Change Password</TITLE> <HTA:APPLICATION ID="PasswordChange" SYSMENU="No" SCROLL="No"

SCROLLFLAT ="No" SingleInstance="No" ShowInTaskbar="No" SysMenu="No" MaximizeButton="No" MinimizeButton="No"

Border="Thin" BORDERSTYLE ="complex" INNERBORDER ="No" Caption="Yes" WindowState="Normal" APPLICATIONNAME="Gsm PasswordChanger">

<!-- ======================= SCRIPT SEPARATOR ======================= --><Style>

p.TText{font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;text-align:Center;}

p.BText{font:8.75pt Palatino Linotype;color:#0000ab;font-weight:Bold-Italic;text-align:Left;}

--></Style>

<!-- ======================= SCRIPT SEPARATOR ======================= --><script>

//FOR EXIT BUTTON

function Exit_1(Text){if(Ex1.style.visibility == "hidden"){

Ex1.style.visibility = "",Ex2.style.visibility = "",Ex3.style.visibility = "" } else {

Ex1.style.visibility = "hidden",Ex2.style.visibility = "hidden",Ex3.style.visibility = "hidden"}}

//FOR CONFIRM BUTTON

function Info_1(Text){if(Ex1.style.visibility == "hidden"){

Ex1.style.visibility = "",Q2.style.visibility = "",Q3.style.visibility = "" } else {

Ex1.style.visibility = "hidden",Q2.style.visibility = "hidden",Q3.style.visibility = "hidden"}}

</SCRIPT>

<script language="vbscript">window.resizeTo 475,205 : window.moveTo 550, 275 </SCRIPT>

<script language="vbscript">

strComputer = "."

Dim Act, Fso, PWChange, UserN, SDi

Set Act = CreateObject("Wscript.Shell")

Set Fso = CreateObject("Scripting.FileSystemObject")

SDi = Act.ExpandEnvironmentStrings("%systemdrive%\ChangePassWord.HTA")

UserN = Act.ExpandEnvironmentStrings("%UserName%")

Function ExitHta '''' THIS CHECKS FOR THE HTA DELETES IT IF FOUND AND TASKKILL MSHTA.EXE

If Fso.FileExists(SDi) Then Fso.DeleteFile(SDi) end if

Act.Run("%comspec% /c TASKKILL /F /T /IM Mshta.exe"),Hidden,true

End Function

</SCRIPT>

<body STYLE="8.75pt Palatino Linotype;color:#006c6c;filter:progid:DXImageTransform.Microsoft.Gradient

(GradientType=0, StartColorStr='#e8e4de',EndColorStr='#5e9ab9')">

<!-- ======================= SCRIPT SEPARATOR ======================= -->

<Form><table>Change User Pass Word:<TD STYLE="font:10.25pt Palatino Linotype;color:Green;">Type In The New Password

<script LANGUAGE="VBScript">

<!--

Function DoReg1()

A1 = document.Forms(0).elements("UserName").value

Q1 = Window.Confirm ("Are You Sure You Want To Change" & vbcrlf & "This User Account : " & UserN &_

Vbcrlf & "To This Pass Word = " & A1)

If Q1 = True Then

Set objUser = GetObject("WinNT://" & strComputer & "/" & UserN & ", user")

objUser.SetPassword A1

objUser.SetInfo

Window.Alert "Completed Changing," & UserN & " Password" & Vbcrlf & "Press This To Close The HTA And This Dialog"

ExitHta

End If

If Q1 = False Then Window.Alert UserN & " Has Cancel The Pass Word Change" End If

Exit Function

End Function

-->

</SCRIPT>

<!-- CHANGING PASSWORD --><input type=text Size=50 name=UserName tabindex=1><p align=Right><TD>

<!-- CONFIRM BUTTON --><input type=button language="vbscript" STYLE="font:8pt Palatino Linotype;color:Green;font-weight:Bold-Italic;"

value="Confirm" Title="" onclick="DoReg1" OnMouseOver="Info_1('Text')" OnMouseOut="Info_1('Text')"></TD><TD>

<!-- ======================= SCRIPT SEPARATOR ======================= -->

<!-- EXIT BUTTON --><input type=button language="vbscript" STYLE="font:8.75pt Palatino Linotype;color:Red;font-weight:Bold-Italic;"

value="Close" onclick="ExitHta : Window.close" OnMouseOver="Exit_1('Text')" OnMouseOut="Exit_1('Text')"></TD></Table></form>

<!-- COMMON BACKGROUND TRANSPARENT-->

<Div id="Ex1" style="visibility:hidden; position:absolute; top:1; Left:1; width:1; height:1;

background-color: white; filter:progid:DXImageTransform.alpha(opacity=100);filter:progid:

DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#bbb7b3', EndColorStr='#c4c0bb')"></DIV>

<!-- INFORMATION CHANGE PASSWORD POPUP TEXT TOP -->

<DIV id="Q2" style="visibility:hidden; color:red; position:absolute; top:85; left:41; width:380;

height:20; margin-top:5; margin-left:5;"><P Class="TText">Change The Pass Word</P></DIV>

<!-- INFORMATION CHANGE PASSWORD POPUP TEXT BOTTOM -->

<DIV id="Q3" style="visibility:hidden; color:red; position:absolute; top:101; left:41; width:380;

height:16; margin-top:5; margin-left:5;"><P Class="BText">This Changes The User Pass Word, Who Is Log On At

The Time This Scripts Runs. Please Remeber Your Pass Word.</P></DIV>

<!-- EXIT POPUP TEXT TOP -->

<DIV id="Ex2" style="visibility:hidden; color:red; position:absolute; top:85; left:111; width:200;

height:20; margin-top:5; margin-left:5;">

<P Class="TText">Exit The Hta</P></DIV>

<!-- EXIT POPUP TEXT BOTTOM -->

<DIV id="Ex3" style="visibility:hidden; color:red; position:absolute; top:101; left:111; width:200;

height:16; margin-top:5; margin-left:5;"><P Class="BText">Press to close this Hta Application</P></DIV>

</BODY>

I included the HTA I made in to a SFX file.

ChangePassWord.exe

Edited by gunsmokingman
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...