12 July 2012

Reclaim free space on Windows Server 2008 R2 SP1

Free space on C: drive will eventually go below your threshold. After investigating the cause with TreeSize Free tool (http://www.jam-software.com/treesize_free/), I ended up in this result (biggest folder is with the name winsxs):

image

If you are running out of other options to free space on a Windows Server 2008 R2 SP1 computer, then as a last resort you can disable SP1 uninstall feature by running the following command on the administrative command prompt:

dism /online /cleanup-image /spsuperseded

image

It will remove the files needed for Service Pack uninstall and free some gigabytes on Windows drive. In my case about 4GB.

11 July 2012

NetStumbler’s replacement for Windows 7

If you are using Windows 7 and you want to see details of wireless networks in your range you can use command line (NetStumbler doesn’t work on Vista nor 7):

netsh wlan show networks mode=bssid

or in short

netsh wl sh n b

The result is something like that (fragment of an output)

image

If you want a graphical utility, take a look at inSSIDer (http://www.metageek.net/products/inssider-wifi-scanner)

05 July 2012

Outlook/Exchange and Notes/Domino and Rich Text

If you send an e-mail with Rich Text formatting from Exchange to Domino, it appears very ugly in Lotus Notes.

Original message in Outlook:

image

As seen on Lotus Notes:

image

As you can see, the result looks ugly. It doesn’t look always ugly, it depends on several factors: Outlook contact properties, Active Directory Contact/Mail User properties and Remote Domain settings. I suggest to change only remote domains settings on Exchange 2010.

Easiest way is to do it on Exchange Shell (get all remote domains and disable Microsoft proprietary TNEF/Rich text format for sending e-mails):

Get-RemoteDomain | Set-RemoteDomain -TNEFEnabled $false

Graphical interface is also possible. Select your remote domain from Organization/Hub Transport/Remote Domains and change the following setting:

image

And yes, all your e-mails can have attachments and formatting after changing this setting. Your e-mail can have 3 formats, when you use Outlook:

  1. Plain Text
  2. Rich Text
  3. HTML

All messages containing formatting information will be converted to HTML format instead of the second option (Rich Text).

04 July 2012

DPM 2010 eject tape (or Windows 2008 eject tape)

As you probably figured out that Windows Server 2008 backup software doesn’t support tapes. So if you use Microsoft Data Protection Manager 2010 or some other tape compatible software and don’t see the place to eject tape programmatically, you are in the right place. Here comes the solution.

First of all you need a piece of software to support devio controls. I found a little one on http://www.ltr-data.se/files/devioctl.zip. This zip file contains devioctl.exe, which needs to be placed in windows directory.

To try the eject functionality, you need a test script as a .bat file containing the following line:

devioctl.exe eject \\.\Tape2147483645

The last number can be found out in DPM shell using the following command:

get-dpmlibrary -dpmservername yourdpmservernamehere | get-tapedrive | ft acc*

The result is in my case:

image

It seems, like I have two drives. In fact I have only one, the other one was the old one, which was replaced to the new drive. So I will use the line with the lowest number.

If you are wondering, what’s the deal with this strange number, you can put it to windows calculator and look at the binary representation of this number:

image

So if you look at bits 31..0, then 2147483646 is in some interpretation -1, 2147483645 means -2 etc.

26 June 2012

OWA 2010 change password

If you want your users to be able to change their expired passwords in Outlook Web App 2010, you must change the registry on all your CAS servers. For the change you can use the following .REG file and double-click it:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MSExchange OWA]
@="Automatically managed by Exchange"
"ChangeExpiredPasswordEnabled"=dword:00000001

Or run the following command:

REG ADD "HKLM\SYSTEM\CurrentControlSet\services\MSExchange OWA" /v ChangeExpiredPasswordEnabled /t REG_DWORD /d 1

You will need to do iisreset after making those changes.

22 June 2012

Another move mailbox script

This script will get mailboxes from a specified database and moves them around to other databases one-by-one and shows progress in PowerShell window.

while (get-mailbox -database mail*)
    {
    "starting hard work"
    if (get-moverequest)
        {
        "got existing move requests, not starting a new one"
        }
    else
        {
        "starting a mailbox move"
        $var1 = get-mailbox -database mail*
        $var2 = $var1 | Get-MailboxStatistics
        $var3 = $var2 | sort itemcount
        New-MoveRequest $var3[0].Displayname
        "started a mailbox move"
        }
    while (get-moverequest)
        {
        for ($i=1; $i -le 60; $i++)
            {
                Write-Host "." -nonewline
                sleep 1
            }
        Write-Host
        get-moverequest | Get-MoveRequestStatistics | select displayname,bytestransferred,bytestransferredperminute,itemstransferred,totalmailboxitemcount,percentcomplete
        if (get-moverequest -movestatus completed)
            {
            "got a completed move request"
            get-moverequest -movestatus completed | select -first 1 | remove-moverequest -confirm:$false
            "deleted that completed request"
            }
        }
    "no ongoing move requests"
    }
"no mailboxes left to move"

21 June 2012

Reduce the number of move requests

At a previous post (http://raunomagi.blogspot.com/2012/06/display-move-request-statistics-on.html) I found out that resuming all move-requests at once is probably not the best idea. First I would suspend all move requests and then start only few of them. Using the following script I will find completed ones and delete those requests and start new ones (in order small mailboxes –> huge mailboxes). Then the list gets smaller quicly, but last items will to their work quite long time.

while (get-moverequest)
{
if (get-moverequest -movestatus completed)
{
"get one completed move request"
get-moverequest -movestatus completed | select -first 1 | remove-moverequest -confirm:$false
"deleted that completed request, trying to find a suspended request to resume"
get-moverequest -movestatus suspended | Get-MoveRequestStatistics | sort totalmailboxsize | select -first 1 | foreach {Resume-MoveRequest $_.displayname}
"move request having smallest mailbox size is resumed"
}
"now sleeping a minute"
for ($i=1; $i -le 60; $i++)
{
Write-Host "." -nonewline
sleep 1
}
Write-Host
"waking up"
}
"seems like everything is done now"