Powershell - Display contents of two tables next to each other

I am attempting to display information for administrators processing user changes to easily see what changes are being made to certain fields in Active Directory users. I've written a PowerShell script to process these changes, but I'm having trouble formatting the output for the administrators who are running the script. See this post for a similar, but different problem.

My code:

$output = [pscustomobject]@{'UserName' = $user.samAccountName; 'FirstName' = $user.GivenName;'LastName' = $user.Surname;'DisplayName' = $user.DisplayName;'UPN' = $user.UserPrincipalName;'E-Mail_Address' = $user.proxyAddresses;'Title' = $user.Title;'Office' = $user.PhysicalDeliveryOfficeName;'Dept' = $user.Department;}
$output[$index++] | Add-Member -NotePropertyMembers @{'NewUserName' = $samAccountName; 'NewFirstName' = $firstName;'NewLastName' = $lastname;'NewDisplayName' = $displayName;'NewUPN' = $UPN;'NewE-Mail_Address' = $SMTP1;'NewTitle' = $Title;'Newoffice' = $office;'NewDept' = $department;}
$output

Output:

UserName          : FirstLast
FirstName         : First
LastName          : Last
DisplayName       : First Last
UPN               : FirstLast@company.com
E-Mail_Address    : SMTP:FirstLast@company.com
Title             : CEO
Office            : HQ
Dept              : Executives
NewDept           : Maintenance
NewE-Mail_Address : SMTP:FirstLast@company.com
NewOffice         : The Dump
NewFirstName      : First
NewLastName       : Last
NewUserName       : FirstLast
NewDisplayName    : First Last
NewUPN            : FirstLast@company.com
NewTitle          : Trash Collector

Desired Output:

UserName          : FirstLast                     NewUserName       : FirstLast
FirstName         : First                         NewFirstName      : First
LastName          : Last                          NewLastName       : Last
DisplayName       : First Last                    NewDisplayName    : First Last
UPN               : FirstLast@company.com         NewUPN            : FirstLast@company.com
E-Mail_Address    : SMTP:FirstLast@company.com    NewE-Mail_Address : SMTP:FirstLast@company.com
Title             : CEO                           NewTitle          : Trash Collector
Office            : HQ                            Newoffice         : The Dump
Dept              : Executives                    NewDept           : Maintenance


Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)