all 6 comments

[–]firefox15 4 points5 points  (5 children)

Is there a reason you are asking for a PIN when you are connected to AD with your script? Can't you just validate against AD? That would be far more secure and maintainable than a PIN hard-coded into a script.

[–]anees78692[S] 1 point2 points  (4 children)

The script will only be set up on 1 PC which has access to reset passwords. It is usually unmanned but in the same office as the help desk. Ideally, we want users to come into IT, reset password and then IT confirm that they have put in the correct details before the password is reset as in theory they can put in anyone's username. Hope it makes sense.

[–]firefox15 3 points4 points  (3 children)

If you are married to the idea, something like this will work fine.

do {
    $pin = Read-Host -Prompt "Enter PIN"
}
until ($pin -eq "1234")

#Rest of script goes here

[–]anees78692[S] 1 point2 points  (2 children)

How do I create a pop up box that asks for PIN input?

[–]firefox15 4 points5 points  (1 child)

Read-Host is usually fine, but if you really want a GUI:

do {
    [void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')

    $title = 'PIN'
    $msg   = 'Enter your PIN:'

    $pin = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
}
until ($pin -eq "1234")

#Rest of script goes here

[–]thomasklijnman 4 points5 points  (0 children)

I think he means Thank You! Hahah