Easily Enable Active Directory Recycle Bin in Windows Server 2012 R2

I recently enabled Azure Active Directory (AD) Connect and wanted to turn this feature on. After doing some reading, I found a simple way to enable the AD Recycle Bin.

  1. In the management console, go to ToolsActive Directory Administrative Center
  2. Select Local Domain and in the Tasks Pane
  3. Select Enable Recycle Bin.
  4. Click OK

    NOTE: Be aware this feature cannot be disabled.

  5. Click OK.  Once enabled, wait for AD replication to complete as this is a change made on the configuration partition. This process may take a while should your organization have a large active directory infrastructure.

A very simple enablement of a process that could save you hours of restore time.  Again, this process cannot be reversed once invoked.

Empty the Recycle Bin for All Users with Powershell

On a new client’s server, I ran into an issue where a drive was running low on space and I found that another user account on the server (which had been deleted) had files in the Recycle Bin!

Thankfully, I found this Powershell command which worked to delete the files. All you have to do is open a Powershell console as admin and run the following command:

Get-ChildItem “C:`$Recycle.bin\” -Force | Remove-Item -Recurse -force

You can append -Whatif to do a test run and see what files will be deleted before actually deleting them.

How To: Disable Clutter in Office365

To disable Clutter in Office365 via Powershell, simply do the following:

Connect to Office365 Powershell for your account

Then simply run this command to disable Clutter for all mailboxes:

Get-Mailbox | Set-Clutter –enable $false

That’s it! If you want to disable Clutter for a single mailbox, you can do the following:

Set-clutter -identity user@email.com-Enable $false

To do this via the Office365 Portal, just navigate to: Mail > Automatic Processing > Clutter and turn it off!

How to Find Last Logon Time for Exchange Mailbox Users

The last logon time of an Exchange 2010/2013/2016 mailbox user can easily be found by running the Get-MailboxStatistics cmdlet in the Exchange Management Shell.

 

You can further sort the info by including and running the following command:

Get-MailboxStatistics -Server EXCH | Sort LastLogonTime -Descending

And export it to a CSV by adding an Export-CSV option like below:

Get-MailboxStatistics -Server EXCH | Sort LastLogonTime -Descending | Export-CSV c:\lastlogon.csv

Using WMIC to Uninstall Multiple Versions of Java

I can’t tell you how many times I have logged in to a computer just to see five or more versions of Java installed going back multiple versions. To uninstall ALL of them in one fell swoop without being prompted, I use this command:

wmic product where "name like 'Java%%'" call uninstall /nointeractive

Editing Calendar Permissions in Office365 via Powershell

First you need to connect to Office365.

Next, simply run this commandlet:
Add-MailboxFolderPermission calendar@company.com:\Calendar User guy@company.com AccessRights Author

Your accessrights options are: Owner, PublishingEditor, Editor, PublishingAuthor, Author, NonEditingAuthor, Reviewer, Contributor, AvailabilityOnly, LimitedDetails

If you’d like to get permissions, you can simply use:
Get-MailboxFolderPermission Identity calendar@company.com:\Calendar User guy@company.com

Finally, to remove permissions:

RemoveMailboxFolderPermission Identity calendar@company:\calendar user dude@company.com

Disable the Calendar on a User or Shared Mailbox In Exchange

This works for Office365 or an internal Exchange server to disable the calendar on a Shared Mailbox or User’s Mailbox. First, you’ll have to pull up the Exchange Management Shell. Then run the following commands:

New-OwaMailboxPolicy –Name “New Policy Name”

Creates a new mailbox policy


Set-OwaMailboxPolicy –Identity “New Policy Name” –CalendarEnabled $false

Sets the calendar for all mailboxes under the policy to be off

Set-CASMailbox –Identity “shared mailbox” –OwaMailboxPolicy “newpolicy”

Applies the policy to the mailbox in question

 

Using Dell Command Configure to Enable TPM for Bitlocker

After configuring Wake On Lan via Command Configure in a previous post, I then wanted to enable Bitlocker on the Windows 8 machine. Unfortunately, the Dell laptop did not have TPM enabled in the BIOS, which allows for a secure key to be saved. Command Configure to the rescue!

There are a few commands you have to run. For some reason, Dell requires you to have a BIOS password to enable the TPM. Don’t worry, you can enable it and disable it all at once without needing to reboot the machine. Here is what you need to run:

cctk –setuppwd=biospassword        // This sets a BIOS password

cctk –tpm=on –valsetuppwd=biospassword         // This turns TPM on and provides the BIOS password you set previously

cctk –tpmactivation=activate –valsetuppwd=biospassword          // This activates TPM and provides the BIOS password you previously set

cctk –setuppwd= –valsetuppwd=biospassword          // This removes the BIOS password. Just put one space after the = sign. You need to feed the old BIOS password to make the change.

That is it! You’ll have to restart the computer and Windows will see the TPM device and be able to enable Bitlocker.

Using Dell Command Configure to Enable Wake On Lan (WOL)

I’ve been playing with Dell Command Configure recently and will be doing a few posts on my work.

First up is enabling Wake On Lan (WOL) on Dell Optiplex, Latitude, XPS, Insprion, systems. The main advantage is this can be done remotely, through Windows, and can even be scripted.

You’ll need Dell Command | Configure which you can grab from here. If you are interested in more features, you can read up on the full documentation in the Reference Guide here.

After you install it, you can open the aptly named “Command Configure Command Prompt” tool. From there, you can enter all your arguments that you want to change. To change your Wake On Lan settings, simply type in:

cctk –wakeonlan [enable, disable, enablewakeonwlan, lanorwlan]

The options above are what you can do. You can set it to wake on just wireless, or both wireless and ethernet LAN. For both wlan and lan, your command would be:

cctk –wakeonlan lanorwlan

 

Generate Mailbox Size and Usage Report using PowerShell for Exchange 2010 / 2013

An easy way to get a mailbox usage report is via the Get-Mailboxstatistics commandlet in powershell and a combination of other commands. The below script will output a mailbox usage report in HTML format:

 

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select DisplayName,
TotalItemSize,ItemCount,Database,LastLogonTime,LastLoggedOnUserAccount | Sort
TotalItemSize -Descending | ConvertTo-Html -Title "Mailbox Stats"|
Out-file "C:\MailboxStats.html"