Added to show laps account name
This commit is contained in:
12
laps.ps1
12
laps.ps1
@@ -135,6 +135,14 @@ $calendar.Location = New-Object System.Drawing.Point(150,70)
|
||||
$calendar.Visible = $false
|
||||
|
||||
# laps fields
|
||||
|
||||
$lapsAccountLabel = New-Object System.Windows.Forms.Label
|
||||
$lapsAccountLabel.Location = New-Object System.Drawing.Point(150,100)
|
||||
$lapsAccountLabel.Size = New-Object System.Drawing.Size(300,15)
|
||||
$lapsAccountLabel.Font = New-Object System.Drawing.Font('Consolas',8)
|
||||
$lapsAccountLabel.Text = "Compte LAPS: "
|
||||
$lapsAccountLabel.Visible = $false
|
||||
|
||||
# label
|
||||
$lapsPasswordLabel = New-Object System.Windows.Forms.Label
|
||||
$lapsPasswordlabel.Location = New-Object System.Drawing.Point(30,120)
|
||||
@@ -201,6 +209,7 @@ $showLaps = {
|
||||
$identity = $computerNameTextbox.Text
|
||||
$copyButton.Visible = $false
|
||||
$lapsPasswordTextbox.Visible = $false
|
||||
$lapsAccountLabel.Visible = $false
|
||||
$lapsPasswordLabel.Visible = $false
|
||||
$calendarLabel.Visible = $false
|
||||
$calendar.Visible = $false
|
||||
@@ -209,6 +218,7 @@ $showLaps = {
|
||||
try{
|
||||
$laps = Get-LapsADPassword -Identity $identity -DecryptionCredential $creds -Credential $creds -AsPlainText -ErrorAction Stop
|
||||
$lapsPasswordTextbox.text = $laps.Password
|
||||
$lapsAccountLabel.text = "Compte LAPS: $($laps.Account)"
|
||||
if($laps.Password -eq ''){
|
||||
$copyButton.Enabled = $false
|
||||
}else{
|
||||
@@ -219,6 +229,7 @@ $showLaps = {
|
||||
$calendar.Value = [DateTime]$laps.ExpirationTimestamp
|
||||
$calendar.MinDate = [DateTime]::Now
|
||||
$lapsPasswordTextbox.Visible = $true
|
||||
$lapsAccountLabel.Visible = $true
|
||||
$lapsPasswordLabel.Visible = $true
|
||||
$calendarLabel.Visible = $true
|
||||
$calendar.Visible = $true
|
||||
@@ -245,6 +256,7 @@ $machineForm.Controls.add($computerNameTextbox)
|
||||
$machineForm.Controls.add($showLapsButton)
|
||||
$machineForm.Controls.add($calendarLabel)
|
||||
$machineForm.Controls.add($calendar)
|
||||
$machineForm.Controls.add($lapsAccountLabel)
|
||||
$machineForm.Controls.add($lapsPasswordLabel)
|
||||
$machineForm.Controls.add($lapsPasswordTextbox)
|
||||
$machineForm.Controls.add($copyButton)
|
||||
|
||||
Reference in New Issue
Block a user