Exchange 2007 – Remove mailbox without removing the user and some other misc. stuff

I love exchange and have used it for several years each version adds functionality but sometimes they make things harder than they need to be.
You’ll have to use the Exchange Management Shell to accomplish these tasks.

This command will remove the mailbox and leave the user (disconnects it then you can get rid of the disconnected mailbox):

Disable-Mailbox -Identity domain\user

You’ll need to run the Clean-MailboxDatabase command to get Exchange to disconnect the mailbox so you can get rid of it.

Clean-MailboxDatabase

The Clean-MailboxDatabase prompts for Identity, this is the name of your mailbox database.  In my case, and I think the default, it’s Mailbox Database.
At this point you can go to the disconnected mailbox  area of the Exchange console, hit refresh and you can see the disconnected mailbox.
Now, to get rid of disconnected mailboxes.

Show all disconnected mailboxes:

Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

Remove a single box:

Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false

Group them together and remove all:

$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
$users | ForEach { Remove-Mailbox -Database “Mailbox Database” -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }

See the size of mailboxes sorted by size:

Get-MailboxStatistics | Sort-Object TotalItemSize –Descending | ft DisplayName,@{ expression={$_.TotalItemSize.Value.ToKB()}},ItemCount

 

ASP.net – Using enter key in a textbox to trigger a button event as well as set focus and select text in the text box

Ok, that’s probably the longest post title I’ve used yet.
Here’s what I’m working with: a form with a textbox a button and a listbox.  Users enter text into the textbox and hit the button to search for information which is returned into the listbox.
The first issue was I don’t want to have to click the search button to start the search.  I wanted to be able to just hit enter after typing text.  The button triggers vb code behind the page to do the search.

So I found adding the following to the Page_Load sub-routine allowed me to hit enter in the textbox which triggers the button code:

txtSearch.Attributes.Add(“onkeypress”, “return clickButton(event,'” + btnSearch.ClientID + “‘)”)

Replace txtSearch with the id of your textbox and replace btnSearch with the id of your button.

Next, I wanted the text in the textbox to be highlighted/selected after performing a search so you could turn around and type something else and do another search without touching the mouse.
This is accomplished by adding the following to the Page_Load sub-routine:

Me.txtSearch.Focus()
txtSearch.Attributes.Add(“onfocus”, “JavaScript:document.getElementById(‘” + txtSearch.ClientID + “‘).select();”)

Replace txtSearch with the id of your textbox.

Note:  Sometimes when you copy and paste code like that above the quotes and or apostrophes can get funky and need to be corrected.

Wallpaper – Tubes

Click image for 1920 x 1080 version.
You may use this image for personal use only.  Please contact me for business use.

  • Camera: NIKON D7000
  • Taken: 1 November, 2011
  • Aperture: ƒ/3.8
  • Focal length: 21mm
  • ISO: 200
  • Shutter speed: 1/40s

Microsoft Hyper-V error: Hypervisor driver required is not installed or is disabled

I wanted to test out Microsoft Sharepoint Server and decided to test it on a Hyper-V virtual server.  I guess I’ve finally learned not to experiment directly on production servers finally.  That tends to possibly cause problems.
So, on one of my servers which I had recently updated to Windows Server 2008 R2 I decided to add the Hyper-V role and setup a test server.  After adding the role I kept getting error messages and Hyper-V wouldn’t start.

The error stated:
‘Hypervisor’ driver required by the Virtual Machine Management service is not installed or is disabled.  Check your settings or try reinstalling the Hyper-V role.

After some Googling I found several people saying I needed to make sure No-Excecute Memory Protection and Intel Virtualization Technology were enabled in the bios.  I was familiar with the second setting and had enabled it on machines before but not the first.  My server is an HP DL380 G5 and here are the steps for fixing the issue:

1.  Reboot the server and hit F9 to enter the Bios.
2.  Go to Advanced options > Processor Options
3.  Find the “No-Excecute Memory Protection” and enable it. (Hit enter)
4.  Find the “Intel(R) Virtualization Technology” and enable it. (Hit enter)
5.  Save and exit using F10

After reboot my Hyper-V is all happy and functioning.

Enable Ping responses on Windows Server 2008

I use Ping (not the sort of ping in the picture above) to make sure I can communicate with my servers all the time.  Windows Server 2008 doesn’t allow Ping responses through the Windows Firewall.
Here’s how to enable Ping responses:

Open the Windows Firewall Advanced settings (Open Network and Sharing Center, click Windows Firewall bottom left, then Advanced settings).

Find the File and Printer sharing (Echo Request – ICMPv4-In) in the Inbound Rules section and ICMPv6 if you want to enable IPv6 responses.
Double click each rule and select enabled or right-click and select Enable Rule.

You should now be able to ping the server.

Einstein on God

image
I am reading a biography on Einstein and found this paragraph interesting. A reporter asked Einstein if he believed in God.
“I am not an atheist,” he began. “The problem involved is too vast for our limited minds. We are in the position of a little child entering a huge library filled with books in many languages. The child knows someone must have written those books. It does not know how. It does not understand the languages in which they are written. The child dimly suspects a mysterious order in the arrangement of the books but doesn’t know what it is. That, it seems to me, is the attitude of even the most intelligent human being toward God. We see the universe marvelously arranged and obeying certain laws but only dimly understand these laws.”
The universe is indeed marvelously arranged.

Wallpaper – Nevada somewhere

Click image for 1920 x 1080 version.
You may use this image for personal use only.  Please contact me for business use.

  • Camera: NIKON D7000
  • Taken: 31 October, 2011
  • Aperture: ƒ/4.5
  • Focal length: 18mm
  • ISO: 100
  • Shutter speed: 1/640s

Do not panic

image
Deuteronomy 31:6
So be strong and courageous! Do not be afraid and do not panic before them. For the Lord your God will personally go ahead of you. He will neither fail you nor abandon you.”

Moses is passing the mantle of leadership over Israel to Joshua. Moses is now 120 years old and God isn’t allowing him to enter the land promised to Abraham. Joshua is the one who is to take Israel into Canaan and God wants to remind them (and us) that He’s with them and He wants them (and us) to be strong and courageous. I love how the New Living Translation says “Do not panic.” One of my favorite books is the Hitchhiker’s Guide to the Galaxy and the guide in the book has the words “Don’t Panic” on the outside of it. Lot’s of things make us panic. The definition of panic is particularly interesting: “a sudden overwhelming fear, with or without cause, that produces hysterical or irrational behavior.” When we give in to fear it causes us to make bad choices. That’s why God says to be strong and courageous. When we are strong and when we are courageous we don’t give into fear. Fear then isn’t able to “produce hysterical or irrational behavior.” How do we be strong and courageous? Remember that God is with you. When my kids get scared where do they go? They go running for a parent, someone who can help them. Let’s keep this in mind. Run to someone who can help you. Be strong and courageous and do not panic.

Auto login for Windows 7

Here are two methods for auto login on Windows 7.  The first if for computers that are not members of a domain and the second is for those that are members of a domain.

Non-domain computer:
1.Press the Windows key + R on your keyboard to launch the “Run” dialog box.
2.Type in control userpasswords2
3.Press Enter. The User Accounts window will display.
4.Uncheck the option “Users must enter a user name and password to use this computer”
5.Click “OK”
6.You will then be prompted to enter the current password and confirm it.
7.After doing so, you will no longer be prompted to enter your password upon login.

Domain computer:
1. Press the Windows key + R on your keyboard to launch the “Run” dialog box.
2. Type regedit and hit enter to open the Registry Editor
3. Then browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\
4. Set AutoAdminLogon  = 1 (Create it if it doesn’t exist.  Make it a string variable)
5. Set DefaultUserName = your username (Create it if it doesn’t exist.  Make it a string variable)
6. Set DefaultPassword = your password (Create it if it doesn’t exist.  Make it a string variable)
7. Set DefaultDomainName = your domain (Create it if it doesn’t exist.  Make it a string variable)