function Show-sAMAccount_Update_Toolkit_psf {
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$formXXXXXXSAMAccountUpdateT = New-Object 'System.Windows.Forms.Form'
$labelStatus = New-Object 'System.Windows.Forms.Label'
$groupbox1 = New-Object 'System.Windows.Forms.GroupBox'
$richtextboxLOG = New-Object 'System.Windows.Forms.RichTextBox'
$richtextboxAccount = New-Object 'System.Windows.Forms.RichTextBox'
$buttonUpdate = New-Object 'System.Windows.Forms.Button'
$buttonCheck = New-Object 'System.Windows.Forms.Button'
$textboxNewLANID = New-Object 'System.Windows.Forms.TextBox'
$labelNewLANID = New-Object 'System.Windows.Forms.Label'
$textboxCurrentMailAddress = New-Object 'System.Windows.Forms.TextBox'
$labelCurrentMailAddress = New-Object 'System.Windows.Forms.Label'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$formXXXXXXSAMAccountUpdateT_Load={
#TODO: Initialize Form Controls here
try
{
Import-Module ActiveDirectory -ErrorAction Stop
$labelStatus.Text = "Active Directory module is loaded success !!!.."
$labelStatus.ForeColor = 'Blue'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Active Directory module is loaded success !!!`n"
}
catch
{
$labelStatus.Text = "Error !!! Active Directory module is not loaded.."
$labelStatus.ForeColor = 'Red'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Active Directory module is not loaded success !!!`n"
}
}
$buttonCheck_Click={
#TODO: Place custom script here
$richtextboxAccount.Text = ""
if ($textboxCurrentMailAddress.Text -eq "")
{
$labelStatus.Text = "Current Mail address can not be NULL"
$labelStatus.ForeColor = 'Red'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Current Mail address can not be NULL`n"
}
if ($textboxCurrentMailAddress.Text -ne "")
{
$currentemailaddress_op = $textboxCurrentMailAddress.Text.ToString().Trim()
}
if (!($currentemailaddress_op -like '*@XXXXXX.com') -and ($textboxCurrentMailAddress.Text -ne ""))
{
$labelStatus.Text = "Error !!! Current Mail address format is not correct "
$labelStatus.ForeColor = 'Red'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Error !!! Current Mail address format is not correct`n"
}
if (($currentemailaddress_op -like '*@XXXXXX.com') -and ($textboxCurrentMailAddress.Text -ne ""))
{
$Global:tmppkeyword = $textboxCurrentMailAddress.Text.ToString().Trim()
try
{
$richtextboxLOG.Text = $richtextboxLOG.Text + "Searching the keyword $tmppkeyword`n"
$Global:Result = Get-ADUser -Filter { mail -eq $tmppkeyword } -Property * | Select-Object Name,`
accountExpires, `
physicalDeliveryOfficeName,`
PasswordNeverExpires, `
StreetAddress,`
sAMAccountName,`
@{ n = "_badPasswordTime"; e = { [datetime]::FromFileTime($_.badPasswordTime) } },`
LockedOut,`
@{ n = "SAPNumber"; e = { $_.extensionAttribute9 } }, `
@{ n = 'AccountExpiresTime'; e = { [datetime]::fromFileTime($_.accountExpires) } },`
EmployeeID, `
Mail,`
DistinguishedName, `
badpwdcount,`
DisplayName,`
Department,`
Title, `
TelephoneNumber,`
Manager, `
@{ n = "MS_O365Address"; e = { $_.targetAddress } },`
@{ n = "SWNA_ExchangeServer"; e = { $_.msExchHomeServerName -replace ".*=" } },`
whenCreated,`
Description,`
PasswordLastSet,`
@{ n = "LastLogonTime"; e = { [datetime]::FromFileTime($_.lastLogonTimestamp) } },`
@{ n = 'Password_Expire_Time'; e = { Get-Date([datetime]::fromFileTime($_.pwdlastset)).AddDays(90) } } -ErrorAction Stop
}
catch
{
$labelStatus.Text = "Error !!! Current Mail address can not be found !!! "
$labelStatus.ForeColor = 'Red'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Error !!! Current Mail address can not be found !!!`n"
}
if ($Result -eq $null)
{
$labelStatus.Text = "Error !!! Current Mail address can not be found !!! "
$labelStatus.ForeColor = 'Red'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Error !!! Current Mail address can not be found !!!`n"
}
if ($Result -ne $null)
{
$labelStatus.Text = "Get the email $tmpkeyword success!!! "
$labelStatus.ForeColor = 'Blue'
if (!(Test-Path c:\PowerShell\LOG\))
{
mkdir c:\PowerShell\LOG
}
cmd /c set > c:\PowerShell\LOG\saMaccountupdate_set.log
$sets = Get-Content "c:\PowerShell\LOG\saMaccountupdate_set.log"
foreach ($set in $sets)
{
if ($set -like "*LOGONSERVER*")
{
$global:DC = ($set -replace("LOGONSERVER=\\\\",""))+'.XXXXXX.com'#.XXXXXX.com是域名DNS后缀
}
}
$richtextboxLOG.Text = $richtextboxLOG.Text + "Get the email $tmpkeyword success!!! `n"
$TargetAccouontResult = $Result
$CurrentDisplayName = $NULL
$CurrentDisplayName = $TargetAccouontResult.DisplayName.ToString()
$richtextboxAccount.SelectionColor = 'Blue'
$richtextboxAccount.AppendText("***AD Account -- $CurrentDisplayName -- Account information on DC $DC Result BEGIN***`n")
$richtextboxAccount.SelectionColor = 'Black'
try { $outputname = ($TargetAccouontResult | select name).Name.ToString() }
catch { }
try
{
$global:outputLANID = ($TargetAccouontResult | select sAMAccountName).sAMAccountName.ToString()
$globalTargetLANID = ($TargetAccouontResult | select sAMAccountName).sAMAccountName.ToString()
}
catch { }
try { $outputDisplayName = ($TargetAccouontResult | select displayname).displayname.ToString() }
catch { }
try { $outputsapnumber = ($TargetAccouontResult | select sapnumber).sapnumber.ToString() }
catch { }
try { $outputMail = ($TargetAccouontResult | select Mail).Mail.ToString() }
catch { }
try { $outputEmployeeID = ($TargetAccouontResult | select employeeID).employeeID.ToString() }
catch { }
try { $outputOU = ($TargetAccouontResult | select DistinguishedName).DistinguishedName.ToString() }
catch { }
try { $outputOfficeCode = ($TargetAccouontResult | select physicalDeliveryOfficeName).physicalDeliveryOfficeName.ToString() }
catch { }
try { $outputStreetAddress = ($TargetAccouontResult | select StreetAddress).StreetAddress.ToString() }
catch { }
try { $outputdepartment = ($TargetAccouontResult | select department).department.ToString() }
catch { }
try { $outputtitle = ($TargetAccouontResult | select title).title.ToString() }
catch { }
try { $outputmanager = ($TargetAccouontResult | select manager).manager.ToString() }
catch { }
try { $outputtelephonenumber = ($TargetAccouontResult | select telephonenumber).telephonenumber.ToString() }
catch { }
try { $outputMS_O365Address = ($TargetAccouontResult | select MS_O365Address).MS_O365Address.ToString() }
catch { }
try { $outputSWNA_ExchangeServer = ($TargetAccouontResult | select SWNA_ExchangeServer).SWNA_ExchangeServer.ToString() }
catch { }
try { $outputwhenCreated = ($TargetAccouontResult | select whenCreated).whenCreated.ToString() }
catch { }
try { $outputAccountExpiresTime = ($TargetAccouontResult | select AccountExpiresTime).AccountExpiresTime.ToString() }
catch { }
try { $outputPasswordLastSet = ($TargetAccouontResult | select PasswordLastSet).PasswordLastSet.ToString() }
catch { }
try { $outputLastLogonTime = ($TargetAccouontResult | select LastLogonTime).LastLogonTime.ToString() }
catch { }
try { $outputPasswordNextExpiredTime = ($TargetAccouontResult | select Password_Expire_Time).Password_Expire_Time.ToString() }
catch { }
$richtextboxAccount.AppendText("Name: $outputname`n")
$richtextboxAccount.SelectionColor = 'Red'
$richtextboxAccount.AppendText("LAN ID <+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>:$outputLANID`n")
$richtextboxAccount.SelectionColor = 'Black'
$richtextboxAccount.AppendText("Display Name: $outputDisplayName`n")
$richtextboxAccount.AppendText("SAP: $outputsapnumber`n")
$richtextboxAccount.AppendText("Mail: $outputMail`n")
$richtextboxAccount.AppendText("EmployeeID: $outputEmployeeID`n")
$richtextboxAccount.AppendText("OU: $outputOU`n")
$richtextboxAccount.AppendText("Office Code: $outputOfficeCode`n")
$richtextboxAccount.AppendText("StreeAddress: $outputStreetAddress`n")
$richtextboxAccount.AppendText("Department: $outputdepartment`n")
$richtextboxAccount.AppendText("Title: $outputtitle`n")
$richtextboxAccount.AppendText("Manager: $outputmanager`n")
$richtextboxAccount.AppendText("Telephone Number:$outputtelephonenumber`n")
$richtextboxAccount.AppendText("O365: $outputMS_O365Address`n")
$richtextboxAccount.AppendText("Exchange: $outputSWNA_ExchangeServer`n")
$richtextboxAccount.AppendText("whenCreated: $outputwhenCreated`n")
$richtextboxAccount.AppendText("Account Expired Time: $outputAccountExpiresTime`n")
$richtextboxAccount.AppendText("Password Last Set: $outputPasswordLastSet`n")
$richtextboxAccount.AppendText("Last Logon Time:$outputLastLogonTime`n")
$richtextboxAccount.AppendText("Password Next Expired Time: $outputPasswordNextExpiredTime`n")
####################################Handle BadPassword Count BEGIN####################################
$CR_BadPassword_Count = $TargetAccouontResult.badpwdcount
if ($CR_BadPassword_Count -ne $NULL)
{
if ($CR_BadPassword_Count -eq 0)
{
$richtextboxAccount.SelectionColor = 'Blue'
$richtextboxAccount.AppendText("BadPassword Count Timer is 0 in DC $DC `n")
$richtextboxAccount.SelectionColor = 'Black'
}
else
{
$richtextboxAccount.SelectionColor = 'Red'
$richtextboxAccount.AppendText("BadPassword Count:$CR_BadPassword_Count in DC $DC `n")
$richtextboxAccount.SelectionColor = 'Black'
}
}
####################################Handle BadPassword Count END####################################
################################################Check Account if Locked Out BEGIN#######################################
$CR_LockedOut = $TargetAccouontResult.LockedOut.ToString()
if ($CR_LockedOut -eq $false)
{
$richtextboxAccount.SelectionColor = 'Blue'
$richtextboxAccount.AppendText("LockedOut Status in $DC DC: $CR_LockedOut `n")
$richtextboxAccount.SelectionColor = 'Black'
}
else
{
$richtextboxAccount.SelectionColor = 'Red'
$richtextboxAccount.AppendText("LockedOut Status: $CR_LockedOut !!!Locked Out!!! DC $DC `n")
$richtextboxAccount.SelectionColor = 'Black'
}
################################################Check Account if Locked Out END#########################################
####################################Handle Password Expired Issue Begin####################################
$CR_Password_Next_Expire_Time = $TargetAccouontResult.Password_Expire_Time
$CR_Now = Get-Date
if ($CR_Password_Next_Expire_Time -gt $CR_Now)
{
$richtextboxAccount.SelectionColor = 'Blue'
$richtextboxAccount.AppendText("Password is not expired, expired time is $CR_Password_Next_Expire_Time`n")
$richtextboxAccount.SelectionColor = 'Black'
}
else
{
$richtextboxAccount.SelectionColor = 'Red'
$richtextboxAccount.AppendText("Password Expired `n")
$richtextboxAccount.SelectionColor = 'Black'
}
####################################Handle Password Expired Issue END####################################
####################################Handle Account Expired Issue Begin####################################
$CR_Account_Expire_Time = $TargetAccouontResult.AccountExpiresTime
$CR_Account_Now = Get-Date
if ($CR_Account_Expire_Time -ne $NULL -and $CR_Account_Expire_Time.ToString() -ne '1/1/1601 8:00:00 AM')
{
if ($CR_Account_Expire_Time -gt $CR_Account_Now)
{
$richtextboxAccount.SelectionColor = 'Blue'
$richtextboxAccount.AppendText("Account is not expired, Expired Time is $CR_Account_Expire_Time`n")
$richtextboxAccount.SelectionColor = 'Black'
#write-host "Account is not expired, Expired Time is $CR_Account_Expire_Time " -foregroundcolor "blue"
}
else
{
$richtextboxAccount.SelectionColor = 'Red'
$richtextboxAccount.AppendText("Account Expired `n")
$richtextboxAccount.SelectionColor = 'Red'
$richtextboxAccount.AppendText("Account expired time is $CR_Account_Expire_Time `n")
$richtextboxAccount.SelectionColor = 'Black'
#write-host "!!! Account Expired !!!!! " -foregroundcolor "red"
#write-host Account expired time is $CR_Account_Expire_Time -foregroundcolor "red"
}
}
else
{
$richtextboxAccount.SelectionColor = 'Blue'
$richtextboxAccount.AppendText("Account is not expired, expired time is not set `n")
$richtextboxAccount.SelectionColor = 'Black'
#write-host "Account is not expired, expired time is not set " -foregroundcolor "blue"
}
####################################Handle Account Expired Issue END####################################
################################################Check If Disabled BEGIN#########################################
if (!(Get-ADUser -Server $DC -Identity $globalTargetLANID).Enabled)
{
$richtextboxAccount.SelectionColor = 'Red'
$richtextboxAccount.AppendText("Account is disabled in DC $DC !`n")
$richtextboxAccount.SelectionColor = 'Black'
#Write-Host "Account is disabled in DC $DC !" -ForegroundColor Red
}
else
{
$richtextboxAccount.SelectionColor = 'Blue'
$richtextboxAccount.AppendText("Account is not disabled in DC $DC ! `n")
$richtextboxAccount.SelectionColor = 'Black'
#Write-Host "Account is not disabled in DC $DC !" -ForegroundColor blue
}
################################################Check If Disabled END#########################################
$richtextboxAccount.SelectionColor = 'Blue'
$richtextboxAccount.AppendText("***AD Account -- $CurrentDisplayName -- Account information on DC $DC Result END***`n")
$richtextboxAccount.SelectionColor = 'Black'
}
}
}
$textboxCurrentMailAddress_TextChanged={
#TODO: Place custom script here
$labelStatus.Text = ""
$richtextboxAccount.Clear()
$textboxNewLANID.Text = ""
}
$textboxNewLANID_TextChanged={
#TODO: Place custom script here
$labelStatus.Text = ""
}
$formXXXXXXSAMAccountUpdateT_KeyDown=[System.Windows.Forms.KeyEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.KeyEventArgs]
#TODO: Place custom script here
if ($_.KeyCode -eq "Escape")
{
$formXXXXXXSAMAccountUpdateT.Close()
}
if ($_.KeyCode -eq "Return")
{
try { $buttonCheck_Click.invoke() }
catch{}
}
}
$buttonUpdate_Click={
#TODO: Place custom script here
if ($textboxNewLANID.Text -eq "")
{
$labelStatus.Text = "Error!!! New LAN ID can not be NULL"
$labelStatus.ForeColor = 'Red'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Error!!! New LAN ID can not be NULL`n"
}
if (!($textboxNewLANID.Text -match '\d\d\d'))#新的LANID需要符合的规则,根据实际情况来修改
{
$labelStatus.Text = "Error!!! New LAN ID format is not correct !!!"
$labelStatus.ForeColor = 'Red'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Error!!! New LAN ID format is not correct !!!`n"
}
if (($textboxNewLANID.Text -ne "") -and ($textboxNewLANID.Text -match '\d\d\d') )
{
$global:tmpNewLANID = $textboxNewLANID.Text.ToUpper().Trim()
try
{
$NEWLANIDResult = Get-ADUser -Identity $tmpNewLANID -ErrorAction Stop
}
catch
{
$richtextboxLOG.Text = $richtextboxLOG.Text + "New LAN ID is not binded to any account in APAC domain --OK `n"
}
if ($NEWLANIDResult -ne $null)
{
$labelStatus.Text = "Error!!! Update Failed !!! New LAN ID is binded with an account in APAC domain !!!Check if you have typed the wrong SAP Account !!!"
$labelStatus.ForeColor = 'Red'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Error!!! Update failed !!! New LAN ID is binded with an account in APAC domain !!!Check if you have typed the wrong SAP Account !!!`n"
}
if (($Result -ne $null) -and ($NEWLANIDResult -eq $null))
{
$richtextboxLOG.Text = $richtextboxLOG.Text + "Start update the current user's LAN ID to $tmpNewLANID`n"
TRY
{
Get-ADUser -Identity $outputLANID | Set-ADUser -Replace @{ samaccountname = $tmpNewLANID } -ErrorAction Stop
try
{
$buttonCheck_Click.Invoke()
$labelStatus.Text = "Success!!! Update Finished !!!"
$labelStatus.ForeColor = 'green'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Success!!! Update Finished !!!`n"
}
catch{}
}
catch
{
$labelStatus.Text = "Error!!! Update failed !! Please check your account permission !!!"
$labelStatus.ForeColor = 'Red'
$richtextboxLOG.Text = $richtextboxLOG.Text + "Error!!! Update failed !! Please check your account permission !!!`n"
}
}
}
}
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$formXXXXXXSAMAccountUpdateT.WindowState = $InitialFormWindowState
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$buttonUpdate.remove_Click($buttonUpdate_Click)
$buttonCheck.remove_Click($buttonCheck_Click)
$textboxNewLANID.remove_TextChanged($textboxNewLANID_TextChanged)
$textboxCurrentMailAddress.remove_TextChanged($textboxCurrentMailAddress_TextChanged)
$formXXXXXXSAMAccountUpdateT.remove_Load($formXXXXXXSAMAccountUpdateT_Load)
$formXXXXXXSAMAccountUpdateT.remove_KeyDown($formXXXXXXSAMAccountUpdateT_KeyDown)
$formXXXXXXSAMAccountUpdateT.remove_Load($Form_StateCorrection_Load)
$formXXXXXXSAMAccountUpdateT.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch { Out-Null <# Prevent PSScriptAnalyzer warning #> }
}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$formXXXXXXSAMAccountUpdateT.SuspendLayout()
$groupbox1.SuspendLayout()
#
# formXXXXXXSAMAccountUpdateT
#
$formXXXXXXSAMAccountUpdateT.Controls.Add($labelStatus)
$formXXXXXXSAMAccountUpdateT.Controls.Add($groupbox1)
$formXXXXXXSAMAccountUpdateT.Controls.Add($richtextboxAccount)
$formXXXXXXSAMAccountUpdateT.Controls.Add($buttonUpdate)
$formXXXXXXSAMAccountUpdateT.Controls.Add($buttonCheck)
$formXXXXXXSAMAccountUpdateT.Controls.Add($textboxNewLANID)
$formXXXXXXSAMAccountUpdateT.Controls.Add($labelNewLANID)
$formXXXXXXSAMAccountUpdateT.Controls.Add($textboxCurrentMailAddress)
$formXXXXXXSAMAccountUpdateT.Controls.Add($labelCurrentMailAddress)
$formXXXXXXSAMAccountUpdateT.AutoScaleDimensions = '6, 13'
$formXXXXXXSAMAccountUpdateT.AutoScaleMode = 'Font'
$formXXXXXXSAMAccountUpdateT.ClientSize = '1412, 699'
$formXXXXXXSAMAccountUpdateT.FormBorderStyle = 'FixedDialog'
$formXXXXXXSAMAccountUpdateT.KeyPreview = $True
$formXXXXXXSAMAccountUpdateT.MaximizeBox = $False
$formXXXXXXSAMAccountUpdateT.MinimizeBox = $False
$formXXXXXXSAMAccountUpdateT.Name = 'formXXXXXXSAMAccountUpdateT'
$formXXXXXXSAMAccountUpdateT.StartPosition = 'CenterScreen'
$formXXXXXXSAMAccountUpdateT.Text = 'XXXXXX sAMAccount Update Toolkit'
$formXXXXXXSAMAccountUpdateT.add_Load($formXXXXXXSAMAccountUpdateT_Load)
$formXXXXXXSAMAccountUpdateT.add_KeyDown($formXXXXXXSAMAccountUpdateT_KeyDown)
#
# labelStatus
#
$labelStatus.AutoSize = $True
$labelStatus.Font = 'Century Gothic, 9pt, style=Bold'
$labelStatus.Location = '12, 625'
$labelStatus.Name = 'labelStatus'
$labelStatus.Size = '42, 20'
$labelStatus.TabIndex = 8
$labelStatus.Text = 'label1'
$labelStatus.UseCompatibleTextRendering = $True
#
# groupbox1
#
$groupbox1.Controls.Add($richtextboxLOG)
$groupbox1.Font = 'Century Gothic, 8.25pt'
$groupbox1.Location = '815, 12'
$groupbox1.Name = 'groupbox1'
$groupbox1.Size = '585, 612'
$groupbox1.TabIndex = 7
$groupbox1.TabStop = $False
$groupbox1.Text = 'LOG'
$groupbox1.UseCompatibleTextRendering = $True
#
# richtextboxLOG
#
$richtextboxLOG.BackColor = 'Control'
$richtextboxLOG.Font = 'Century Gothic, 8.25pt'
$richtextboxLOG.Location = '7, 16'
$richtextboxLOG.Name = 'richtextboxLOG'
$richtextboxLOG.ReadOnly = $True
$richtextboxLOG.Size = '572, 586'
$richtextboxLOG.TabIndex = 0
$richtextboxLOG.Text = ''
#
# richtextboxAccount
#
$richtextboxAccount.BackColor = 'Control'
$richtextboxAccount.Font = 'Century Gothic, 8.25pt'
$richtextboxAccount.Location = '12, 84'
$richtextboxAccount.Name = 'richtextboxAccount'
$richtextboxAccount.ReadOnly = $True
$richtextboxAccount.Size = '797, 527'
$richtextboxAccount.TabIndex = 6
$richtextboxAccount.Text = ''
#
# buttonUpdate
#
$buttonUpdate.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$buttonUpdate.ForeColor = 'Green'
$buttonUpdate.Location = '1167, 645'
$buttonUpdate.Name = 'buttonUpdate'
$buttonUpdate.Size = '121, 42'
$buttonUpdate.TabIndex = 5
$buttonUpdate.Text = 'Update'
$buttonUpdate.UseCompatibleTextRendering = $True
$buttonUpdate.UseVisualStyleBackColor = $True
$buttonUpdate.add_Click($buttonUpdate_Click)
#
# buttonCheck
#
$buttonCheck.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$buttonCheck.ForeColor = 'Blue'
$buttonCheck.Location = '522, 9'
$buttonCheck.Name = 'buttonCheck'
$buttonCheck.Size = '131, 41'
$buttonCheck.TabIndex = 4
$buttonCheck.Text = 'Check'
$buttonCheck.UseCompatibleTextRendering = $True
$buttonCheck.UseVisualStyleBackColor = $True
$buttonCheck.add_Click($buttonCheck_Click)
#
# textboxNewLANID
#
$textboxNewLANID.Font = 'Century Gothic, 9.75pt, style=Bold'
$textboxNewLANID.ForeColor = '0, 0, 192'
$textboxNewLANID.Location = '138, 41'
$textboxNewLANID.Name = 'textboxNewLANID'
$textboxNewLANID.Size = '342, 23'
$textboxNewLANID.TabIndex = 3
$textboxNewLANID.add_TextChanged($textboxNewLANID_TextChanged)
#
# labelNewLANID
#
$labelNewLANID.AutoSize = $True
$labelNewLANID.Font = 'Century Gothic, 8.25pt, style=Bold'
$labelNewLANID.Location = '12, 44'
$labelNewLANID.Name = 'labelNewLANID'
$labelNewLANID.Size = '68, 18'
$labelNewLANID.TabIndex = 2
$labelNewLANID.Text = 'New LAN ID'
$labelNewLANID.UseCompatibleTextRendering = $True
#
# textboxCurrentMailAddress
#
$textboxCurrentMailAddress.Font = 'Century Gothic, 9.75pt, style=Bold'
$textboxCurrentMailAddress.ForeColor = 'Purple'
$textboxCurrentMailAddress.Location = '138, 9'
$textboxCurrentMailAddress.Name = 'textboxCurrentMailAddress'
$textboxCurrentMailAddress.Size = '342, 23'
$textboxCurrentMailAddress.TabIndex = 1
$textboxCurrentMailAddress.add_TextChanged($textboxCurrentMailAddress_TextChanged)
#
# labelCurrentMailAddress
#
$labelCurrentMailAddress.AutoSize = $True
$labelCurrentMailAddress.Font = 'Century Gothic, 8.25pt, style=Bold'
$labelCurrentMailAddress.Location = '12, 12'
$labelCurrentMailAddress.Name = 'labelCurrentMailAddress'
$labelCurrentMailAddress.Size = '118, 18'
$labelCurrentMailAddress.TabIndex = 0
$labelCurrentMailAddress.Text = 'Current Mail Address'
$labelCurrentMailAddress.UseCompatibleTextRendering = $True
$groupbox1.ResumeLayout()
$formXXXXXXSAMAccountUpdateT.ResumeLayout()
#endregion Generated Form Code
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $formXXXXXXSAMAccountUpdateT.WindowState
#Init the OnLoad event to correct the initial state of the form
$formXXXXXXSAMAccountUpdateT.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$formXXXXXXSAMAccountUpdateT.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $formXXXXXXSAMAccountUpdateT.ShowDialog()
} #End Function
#Call the form
Show-sAMAccount_Update_Toolkit_psf | Out-Null
本文链接: https://www.pstips.net/powershell-gui-update-samaccount-via-mailaddress.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!

