Categories
IT PowerShell

Save diskspace and zip folder contents using 7zip

Ever got annoyed with your disk filling up with big database backups, text files or other compressable data? 7-Zip to the rescue! Save diskspace and zip folder contents using 7-Zip!

Categories
PowerShell

View members of a dynamic distribution group

Recently I noticed it wasn’t easy to view members of a dynamic distribution group, which was set up by a somewhat incapable sysadmin. The following line shows how the list was set up:

((((((((((((((((((((CustomAttribute1 -eq 'All_everyone') -or (Company -eq '[companyname1]'))) -or (Company -eq '[companyname2]'))) -and (((((RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUser'))) -or (RecipientType -eq 'MailContact'))))) -and (-not(Name -like 'SystemMailbox{*')))) -and (-not(Name -like 'CAS_{*')))) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')))) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')))) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')))) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))

Yes, it does it’s job but not as simple as a distribution group.

Now, from now on I use the following:

$FTE = Get-DynamicDistributionGroup "Name Of Your Group"
Get-Recipient -RecipientPreviewFilter $FTE.RecipientFilter -OrganizationalUnit $FTE.RecipientContainer

Of course you can pipe that into a text document or something, but at least you got the start now.

Categories
IT PowerShell

Remove files by extension and date

Here you find a little bit of Powershell code to remove files by extension and date. Or better said, older then an x amount of days.

Clean, not much about it and very useful!

Categories
Exchange IT PowerShell

Move Exchange Mailboxes using a CSV

The Problem: Corrupted Exchange System User

Today we faced a challenge. Since one the administrative users in our MS Exchange environment was corrupted, we decided to create a new mailbox database (MDB) and move the users to that new database.  Sound quite easy, don’t you think? Here is what we came up with.