


We can capture this like so (which also shows the value to be an integer]: We may need a count of all items in a mailbox that we aggregate with all other mailboxes for reporting. We also have numbers, integers, that we can store in variables as well. Notice that the variable is a string, which makes sense since the value is a name of an object: Next, we want to store the name of a mailbox in a variable called name. Quite useful if we are storing a lot of information. The name is a ‘ProxyAddressCollection’ because there can be one or more Proxy Addresses (or email addresses) stored in the variable now. Notice that we have a different type (name and base type) for this object’s properties. Now, what if we wanted to store all email addresses for a mailbox. Notice that the type of variable we have now is a very specific ‘SmtpAddress”. We then use the ‘.GetType()’ to see what variable type is set with this data storage. The value for the PrimarySMTPAddress will be stored in a variable called $SMTP. First, we have a query for the Administrator mailbox’s Primary SMTP Address. Now, let’s take a look at some real world examples. Now, we can convert the type to a string if we do not need that particular data type. Notice that the type is ‘DateTime’ which is logical considering what could pulled from Get-Date. We can store this information in a variable and then see how that data is being stored/interpreted by PowerShell: Get-Date pulls your current date and time information from your computer. Sometimes this can be key to how we handle the data on the variable or how we can display or search for information in the variable. Variables can contain numbers, strings and more.
