July 2017
Intermediate to advanced
648 pages
31h 9m
English
Parameter values containing a space need to be enclosed in either single or double quotation marks. The following command would retrieve all of the mailboxes in the Sales Users OU in Active Directory. Notice that since the OU name contains a space, it is enclosed in single quotes:
Get-Mailbox -OrganizationalUnit 'testlabs.se/Sales Users/Seattle'
Use double quotes when you need to expand a variable within a string:
$City = 'Seattle'
Get-Mailbox -OrganizationalUnit "testlabs.se/Sales Users/$City"
You can see here that we first create a variable containing the name of the city, which represents a sub-OU under Sales Users. Next, we include the variable inside the string used for the organizational unit when running the Get-Mailbox ...
Read now
Unlock full access