Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Powershell: OnFocus validate identity

$
0
0

I am building a form that will automate my companies computer builds a little better (SCCM doesn't do everything) and in order to make it "fat finger proof" I want to validate that the user id that is filled in is correct and depending on the validation, brings up a red X or a green check mark showing the user of the form that it is safe to move on. My problem is that while my script has no errors the proof of validation never shows. My script is over 2000 lines and proprietary but I hope that the snippet below is enough to help me. Thank you in advance!

$objTextBox = New-Object System.Windows.Forms.TextBox 
$objTextBox.Location = New-Object System.Drawing.Size(120,72) 
$objTextBox.Size = New-Object System.Drawing.Size(100,20)
$objTextBox.focus
({

$VerifyUser = Get-ADUser -LDAPFilter "(sAMAccountName=$userid)"

If ($VerifyUser -ne 'True') 
{
$objForm.Controls.Add($iderror)
}
Else {"Userid Found"}
}) 
$objForm.Controls.Add($objTextBox)

Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>