Exchange – Listing mailboxes, mailbox-type and if the account is enabled

I’ve been working with Exchange some more, lately, where I’ve also had to generate an overview of the mailboxes, mailbox-types and if the underlying account is enabled or not. This had to be exported to a CSV-file.
I came to the next lines of code for that:

$AllMailboxes = Get-Mailbox
$AllMailboxes | select Name,PrimarySmtpAddress,DistinguishedName,OrganizationalUnit,RecipientTypeDetails,@{Name="AccountEnabled";Expression={(Get-ADUser $_.DistinguishedName).Enabled}} | Export-Csv "~\Documents\AllMailboxes_$((Get-Date).ToString("yyyyMMdd_HHmm")).csv" -Delimiter ";" -NoTypeInformation

Exchange – Listing Calendar-delegates for mailboxes

I’ve been troubleshooting an issue where meeting requests are being received by mailboxes/users that are not included in the requests.
To get a list of calendar delegates for mailboxes where these are set, I found the following couple of lines quite handy:

$output = [System.Collections.ArrayList]@()
foreach ($_mbx in (Get-Mailbox -ResultSize Unlimited | Get-CalendarProcessing | Where-Object { $_.ResourceDelegates -notlike "" })) { $_mbx.ResourceDelegates | %{ $output.Add(([PSCustomObject]@{User = $_mbx.Identity; Delegate = $_.ToString()})) | Out-Null }}
$output

Changing the network profile in Windows

Sometimes it happens that the network profile of a connection in Windows is incorrectly categorised. Sometimes such an event happens out of the blue, even.
This can be fixed by changing the value of the value of the Category-key of the network profile in the registry.
This can be found here: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\
There’s a sub-key for each network listed.
Read more Changing the network profile in Windows

Tinkering away

Hi! I’ve decided I want to try and blog more and put things I run into and how I overcome them on the net, and perhaps help others that way.
Currently I’m focusing on PowerShell and Git, for writing scripts to automate things, as well as keeping version history and have the ability to collaborate with others on scripts/projects.

See you soon!