# Creating password website GUI

**URL:** <https://forums.powershell.org/t/creating-password-website-gui/23512>\
**Category:** PowerShell Help\
**Created:** [January 31, 2024, 10:59pm UTC](https://forums.powershell.org/t/creating-password-website-gui/23512 "2024-01-31T22:59:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![robina80](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/robina80/32/5170_2.png) [@robina80](https://forums.powershell.org/u/robina80)\
**Post date:** [January 31, 2024, 10:59pm UTC](https://forums.powershell.org/t/creating-password-website-gui/23512/1 "2024-01-31T22:59:30Z")

</div>

Hi all,

I’ve created a password GUI form for users to change there password, here’s the code

Add-Type -AssemblyName System.Windows.Forms  
Add-Type -AssemblyName System.Drawing

$unlabel = New-Object System.Windows.Forms.Label  
$unlabel.Location = New-Object System.Drawing.Point(10,20)  
$unlabel.Size = New-Object System.Drawing.Size(280,20)  
$unlabel.Text = ‘Please type in your username below:’

$unbox = New-Object System.Windows.Forms.TextBox  
$unbox.Location = New-Object System.Drawing.Point(10,40)  
$unbox.Size = New-Object System.Drawing.Size(260,20)

$oplabel = New-Object System.Windows.Forms.Label  
$oplabel.Location = New-Object System.Drawing.Point(10,60)  
$oplabel.Size = New-Object System.Drawing.Size(280,20)  
$oplabel.Text = ‘Please type in your old password below:’

$opbox = New-Object System.Windows.Forms.TextBox  
$opbox.Location = New-Object System.Drawing.Point(10,80)  
$opbox.Size = New-Object System.Drawing.Size(260,20)

$nplabel = New-Object System.Windows.Forms.Label  
$nplabel.Location = New-Object System.Drawing.Point(10,100)  
$nplabel.Size = New-Object System.Drawing.Size(280,20)  
$nplabel.Text = ‘Please type in your new password below:’

$npbox = New-Object System.Windows.Forms.TextBox  
$npbox.Location = New-Object System.Drawing.Point(10,120)  
$npbox.Size = New-Object System.Drawing.Size(260,20)

$domlist = New-Object System.Windows.Forms.ComboBox  
$domlist.text = “”  
@(“corp”,“prod”) | ForEach-Object {[void] $domlist.Items.Add($\_)}  
$domlist.SelectedIndex = 0  
$domlist.Location = New-Object System.Drawing.Point(10,160)  
$domlist.Size = New-Object System.Drawing.Size(260,20)

$submit = New-Object System.Windows.Forms.Button  
$submit.Location = New-Object System.Drawing.Point(10,200)  
$submit.Size = New-Object System.Drawing.Size(260,20)  
$submit.Text = “Submit”  
$submit.Add\_Click({  
$un = $unbox.text  
$op = $opbox.text  
$np = $npbox.text  
$dom = $domlist.text  
$dom1 = “lon-”+$domlist.text+“-dc01.domain.com”  
write-host $un $op $np $dom1  
Set-ADAccountPassword -Identity $un -OldPassword (ConvertTo-SecureString -AsPlainText “$op” -Force) -NewPassword (ConvertTo-SecureString -AsPlainText “$np” -Force) -server $dom1  
})

$form = New-Object System.Windows.Forms.Form  
$form.Text = ‘Self Service Password Portal’  
$form.Size = New-Object System.Drawing.Size(500,500)  
$form.StartPosition = ‘CenterScreen’

$form.Controls.Add($unlabel)  
$form.Controls.Add($unbox)  
$form.Controls.Add($oplabel)  
$form.Controls.Add($opbox)  
$form.Controls.Add($nplabel)  
$form.Controls.Add($npbox)  
$form.Controls.Add($domlist)  
$form.Controls.Add($submit)  
$form.Add\_Shown({$form.Activate()})  
$form.ShowDialog()

But how would I go about creating a website for this so users can go on a website and do it

Thanks,  
Rob

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [January 31, 2024, 11:20pm UTC](https://forums.powershell.org/t/creating-password-website-gui/23512/2 "2024-01-31T23:20:20Z")

</div>

I will assume there is no Domain to get this done. I did this a while back and it worked well, however, not sure if it works on Servers beyond 2016. Your mileage may vary 🙂

> <https://superuser.com/questions/1196477/allow-users-to-change-expired-password-via-remote-desktop-connection>

---

<div class="post-metadata">

**Author:** ![robina80](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/robina80/32/5170_2.png) [@robina80](https://forums.powershell.org/u/robina80)\
**Post date:** [February 1, 2024, 8:48am UTC](https://forums.powershell.org/t/creating-password-website-gui/23512/3 "2024-02-01T08:48:29Z")

</div>

i was hoping to write html code for it for the user input stuff ie labels/textbox/combobox and when they click submit button it runs/talks to powershell to run the powershell command to change the users password?

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [February 1, 2024, 3:51pm UTC](https://forums.powershell.org/t/creating-password-website-gui/23512/4 "2024-02-01T15:51:13Z")

</div>

Microsoft has already done that for you? Is this for a learning project?

What I did was customize the web page HTML in the solution Microsoft provides to my liking. Maybe that will work for you.

---

<div class="post-metadata">

**Author:** ![robina80](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/robina80/32/5170_2.png) [@robina80](https://forums.powershell.org/u/robina80)\
**Post date:** [February 7, 2024, 11:02am UTC](https://forums.powershell.org/t/creating-password-website-gui/23512/5 "2024-02-07T11:02:02Z")

</div>

hi @tonyd yes and no, i want to create an HTML website that allows people to enter in there name, old password, new password and then to call powershell somehow so it can run the change password command to do it

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [February 16, 2024, 7:21pm UTC](https://forums.powershell.org/t/creating-password-website-gui/23512/6 "2024-02-16T19:21:50Z")

</div>

There’s lots of different ways you might consider tackling that depending on the scope and project requirements. However, IMO this is a tad beyond the scope of this forum. As Tony pointed out there seems to be a resource already out there, though I haven’t used it myself.

You might consider doing all the HTML part to capture input instead of Powershell, and consider using PowerShell runspaces to connect your site to a PS endpoint. I know its possible in C#. This is particularly powerful if you have a constrained endpoint that is locked down. For example, you could run a JEA constrained endpoint that exposes commands to your web front end that you call for resetting your password. You might also consider simply looking at software that make all of this more trivial. For example, PowerShell Universal you can probably do something like this w/ ease as you can basically expose a PS script as an API.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [March 17, 2024, 7:22pm UTC](https://forums.powershell.org/t/creating-password-website-gui/23512/7 "2024-03-17T19:22:23Z")

</div>

Closed on March 17, 2024, 7:22pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
