0

I'm have to get a Exchange Distributionlist by using powershell. The only thing I know about the list is the GUID. So I've tried following:

function GroupGetName([string]$ADGuid)
{
$DISGR = Get-DistributionGroup -filter { Guid -like $ADGuid}
$DISGR
}

But it does not work (I think "Guid" is a internal name from powershell)

Does any one know how to solve it?

HW90
  • 1,953
  • 2
  • 21
  • 45

2 Answers2

0

Try the -match operator instead of -like. If you pass a partial string to -like, it will expect wildcards to fill in the rest.

'asdf' -like 'a' # result: false
'asdf' -match 'a' # result: true

To test, run Get-DistributionGroup without the -Filter, and examine the GUID property on one of the returned objects. This should give you an idea of what you're looking for in the property's value.

0

Get-DistributionGroup $ADGuid should be sufficient. Per the docs (http://technet.microsoft.com/en-us/library/bb124755.aspx), the objectGuid is a valid input for the Identity parameter.

Brian Desmond
  • 4,473
  • 1
  • 13
  • 11