Showing posts with label Powershell. Show all posts
Showing posts with label Powershell. Show all posts

Thursday, October 23, 2014

Windows Server 2012 Deduplication - Powershell Reference

Some key background points on deduplication on Windows Server 2012:

  • There is a scheduler which runs one deduplication job / operation at any point in time
  • Powershell and windows commands add jobs to the scheduler queue - only one job may run at a given point in time
  • Types of deduplication operations:
    • Optimization - deduplicates files on the filesystem. 
    • Scrubbing - performs an integrity check of the deduplication store
    • GarbageCollection - files deleted from the filesystem do not automatically free up space on the disk. A garbage collection must be run to clean up the dedupe store
  • You can configure the minimum age of files to deduplicate. Typically this should be set to a value greater than one day to ensure active files are not deduplicated.


Here are some handy powershell commands for managing deduplication on Windows Server 2012:


# Enqueue  Full integrity check of the dedup store
Start-DedupJob -Type Scrubbing -Full -Priority High -Volume D:

# Enqueue Garbage Collection of dedup store - deleted files won't reclaim space until GC is done
​Start-DedupJob -Type GarbageCollection -Full -Priority High -Volume D:

​# ​Get running / queued dedup jobs
get-dedupjob

# Get dedup summary status
get-dedupstatus

​# Enqueue the optimization job
​Start-DedupJob -Type Optimization -Full -Priority High -Volume D:


Saturday, February 1, 2014

Upgrading Powershell on Windows Server 2008 R2


The latest version of Powershell, version 4, has been released by Microsoft in late October 2013. It brings a lot of additional functionality and performance improvements to the table. This document covers how to upgrade Powershell from your current version to Powershell 4.0.

Wednesday, July 11, 2012

Exporting Exchange Mailboxes Using Powershell

So we’re doing a mail migration and I want to export the source mailboxes just in case things go awry. We’re using the Quest Exchange Migration manager tool and it’s a magic piece of software – having said that I want the mailboxes backed up in PST format in case a user says a message is missing.

On Exchange 2007 and newer the old Exmerge software is no longer available. It’s been replaced by the powershell commandlet export-mailbox.

Using the command is the easy bit, getting the software in place is the hard bit. For starters you need to run this commandlet of a 32 bit machine. You need the Exchange Management Tools installed on there which in turn relies on IIS. The tools also depend on a local Outlook installation to do all the MAPI work in exporting a mailbox to PST.

Once you’ve got all the above installed the export process is really simple. Using the command below:

Get-Mailbox -Server <server> -sortby Alias | export-mailbox –PSTFolderPath <pstpath>

Breaking the above command down, first we’re getting all the mailboxes on a given server and sorting them by alias. We then pipe the mailboxes to the export-mailbox commandlet which, as the name implies exports the mailbox to a PST file.

There’s a lot of options to the export-mailbox commandlet and the above does the basic export the entire mailbox. It’s possible to do a lot more including exporting messages based on timestamps and content.

Handy Exchange Powershell Commands

I’m really loving the power of powershell (bad pun?) to manage Exchange. Once you’ve got your head around a few basic commands you can do a lot with this tool.

On a side note – don’t get me started on all the features that have been removed from the GUI. Don’t get me wrong, I’m a fan of the command line but when you’re doing a task once the GUI is often faster and easier!

 

Handy Exchange Powershell Query #1 – Give an account full control on all mailboxes

Get-Mailbox | Add-MailboxPermission -User <account> -AccessRights Fullaccess -InheritanceType all

Handy Exchange Powershell Query #2 – Give an account full control at the mail database level

Get-MailboxDatabase | Add-ADPermission -user internal\svc-quest-int -AccessRights GenericAll  

Handy Exchange Powershell Query #3 – Get an item account of a user’s mailbox

get-mailboxStatistics –Identity <alias>

Handy Exchange Powershell Query #4 – Set the default storage quota policy on all mailboxes

get-mailbox | set-mailbox -UseDatabaseQuotaDefaults $true