Get Full name from Username

I’m creating a Employee Termination script and it start by entering the username

But from that I want to show a pop-up windows asking if they want to terminate this employee by full name, but for the life of me I cannot get it working

# Import Assemblies [void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") #Get UserName and Full Name $dom = "itwwelds" $TermUser = read-host "Enter user name" $FullName = Get-ADUser -filter $termuser | Select-Object userPrincipalName <---I'm having problems here #Check to see if the user already exists in AD if (Get-ADUser -F {SamAccountName -eq $TermUser}) { $oReturn=[System.Windows.Forms.MessageBox]::show("Are you sure you want to disable $FullName ","Employee Term Form",[System.Windows.Forms.MessageBoxButtons]::OKCancel, [System.Windows.Forms.MessageBoxIcon]::Question) 

submitted by /u/melog69
[link] [comments]

Leave a Reply