Useful Commands - Pt 2.

Useful Commands - Pt 2.

In this installment of useful commands we will look at monitoring Mailboxes for item counts and size as well as managing wireless LAN profiles.

Command #3

Getting a count of how many items are in a mailbox can be accomplished very easily using Exchange PowerShell.

Get-MailboxFolderStatistics -Identity testuser | Where-Object {$_.Identity -like "*Inbox*" -or $_.Identity -like "*Deleted Items" -or $_.Identity -like "*Sent Items" -or $_.Identity -like "*outbox*"} | ft Identity, ItemsInFolder

Note: In order to be able to use the Get-MailboxFolderStatistics cmdlet you will need to be a member of the Mail Recipients or View-Only Recipients Exchange role group.

When you run the command you will end up with a nice little table listing the folder path along with the item count for that folder.

If you would like to see the space used as well simply adjust the command as follows:

Get-MailboxFolderStatistics -Identity testuser | Where-Object {$_.Identity -like "*Inbox*" -or $_.Identity -like "*Deleted Items" -or $_.Identity -like "*Sent Items" -or $_.Identity -like "*outbox*"} | ft Identity, ItemsInFolder, FolderSize

This will give you an additional column containing the folder size.

Command #4

Today I ran into an interesting issue where a co-worker and I needed to look at all of the different Wireless LAN profiles configured on my laptop. Since this laptop hasn't been re-imaged for over a year now I suspected the list could be quite large. Normally I would do this through Manage known networks in Windows 10 control panel but today we looked at it though the command line which worked very nicely.

To get a list of all known networks configured:

netsh wlan show networks

Removing a network can be done as follows:

netsh wlan delete profile name="<profile name>"