I wanted to define class in PowerShell. Inside that class I wanted to use function defined elsewhere, so that when one asks for that value it is automatically run when needed. Following is an example of this.
class ActiveDirectoryUser {
$DisplayName
$LastName
$FirstName
$FirstNameNonLatin = Remove-StringLatinCharacters -String $FirstName
}
However this doesn't really work. It works in C# so what is the equivalent for this in PowerShell?
I am using this code in a way:
$user = New-Object ActiveDirectoryUser
$user.DisplayName = $u.DisplayName
$user.LastName = $u.LastName
$user.FirstName = $u.FirstName
$user | ft * # should show all fields including FirstNameNonLatin