Powershell Script to Read Attribute
I'm using Exchange 2007, and I was wondering if there was a way to read an attribute and set it to a variable. For example, if I wanted to read the default email address from a specific email address policy, and set it to a variable, how would I do that?
Thanks.
October 21st, 2008 7:16am
Hi Dan,
Yes you can. Here is an example
$temp = Get-Mailbox "User1"
This one will save all the properties of User1 into variable $temp and you can get various properties by using .[PropertyName]
$temp.PirmarySMTPAddress
But this will be in different format (not as astring) so if you want to save the result in another variable as a string then you can run do it like this
[string]$s = $temp.PirmarySMTPAddress
$s
This will save the value of PrimarySMTPAddress as a string in $s variable.
Please let me know if you have any specific query and you can refer below guide about EMS.
Reference:
Using the Exchange Management Shell
http://technet.microsoft.com/en-us/library/bb123778(EXCHG.80).aspx
Free Windows Admin Tool Kit Click here and download it now
October 21st, 2008 8:45am
That's exactly what I was looking for, thanks!
October 21st, 2008 7:18pm