Tag Archives: Get-EmailAddress

Yesterday I was given a relatively easy task: find out who or what has a given email address. As this was within our own Exchange organization it proved to be quite simple: You can achieve the goal with a simple one-liner: get-recipient -ResultSize unlimited | where {$_.emailaddresses -match “email@address.com”} But wouldn’t it be easier to have it in a function? In Powershell, creating functions isn’t all that hard. Basically all you need to do is wrap the command or script block with a function statement, see here: function Get-EmailAddress ($emailaddress) { Get-Recipient -ResultSize unlimited | where {$_.emailaddresses -match “$emailaddress”} } See how easy that was? First you tell powershell that you want to configure a function, then the command you want to associate the function with. Within the ( ) you define what parameters the function will need. Then there’s only a { to start defining what the function will…

Read more

1/1