There is the task of sending a letter to a new domain user. The used variable $Name contains "Last Name, First Name, Middle Name". In the letter, you need to leave only the first name and middle name and remove the last name. How can I do that?
Get-Mailbox | where {$_.WhenCreated -gt (get-date).adddays(-1)} | foreach{ $name = $_.Name $Body = «$name, мы рады приветствовать Вас в нашей компании" } We get: "Ivanov Ivan Ivanovich, we welcome you to our company"