Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

select objects displayed in results

$
0
0

I have designed a form using PrimalForms which lets administrators search for AD user accounts, including deleted ones, they can also restore deleted accounts. The form allows you to search using 5 different criteria (first name, last name, display name, account name and email address). The results are the standard output (as below)

Deleted           :  True
DistinguishedName : CN=FirstName LastName,OU=StandardOU,DC=OrganizationName,DC=com
Name              : FirstName LastName
ObjectClass       : user
ObjectGUID        : a1234bcde-567f-9012-g345-6hi78j9012kl

I have now been asked by the people who rename accounts (changes of name after marriage/divorce etc.) if I can include the sAMAccountName in the results to prevent issues, like trying to rename an account to an already existing name.

The script used to search for items is a standard one (though variables are used to make the form work), shown below

Please note, I have not included the entire script as it is almost 80 lines long and most of it is the form layout design so not relevant to this question

$results.Text=Get-ADObject -Filter "sAMAccountName -eq '$($AccountName.text)'" -IncludeDeletedObjects | Out-String $Results.Focus() 

How can I add extra properties into the output window? The results are generated automatically, I do not select what is displayed here so I am puzzled as to how I can include an additional item.

In the above code block $results.text is the output window, $AccountName.text is the text entered by the user searching.



Viewing all articles
Browse latest Browse all 21975

Trending Articles



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