Exchange Powershell: Remove e-mail address from address list

Mar 26

Posted by SteveHardie in Exchange, Powershell | No Comments

This powershell script is written for Microsoft Exchange 2010.

Problem
I recently came across a problem where all exchange mailboxes contained a number of address aliases that should not be there. The additional SMTP addresses were not created as part of an address policy so there was no simple way to remove them without manually removing them from each individual mailbox (None that I knew of anyway)

Solution
I created a simple powershell script that will loop through all mailboxes in an Exchange setup checking their list of email addresses. If the email address ends with the domain name that is requested when you run the script, it will remove the entire address from the mailbox.
Put simply, this script will remove any email address that contains a given domain name.
So please be careful when using.

#requires -version 2 

#Custom variables
$mailboxes = Get-Mailbox
$domain = read-host "Domain Name to remove @"
$domain = $domain.ToLower()

#Loop through all mailboxes
foreach ($mailbox in $mailboxes) {
  #Loop through email addresses
  foreach ($address in $mailbox.EmailAddresses){
	$addr=$address.SmtpAddress
	if ($addr){
	  $addr=$addr.ToLower()
	  if ($addr.EndsWith($domain)){
		Set-Mailbox $mailbox -EmailAddresses @{Remove=$addr}
	  }
	}
  }
}


Tags: exchange, microsoft, power shell

Red Meat Commercial Filmed at Our House

Feb 19

Posted by SteveHardie in Little Bay Project | No Comments

View it on the Meat and Livestock Australia website

See also the Coco Pops Commercial

Tags: Video

Office 2010 KMS Error 0xc004f038

Jan 12

Posted by SteveHardie in Microsoft | No Comments

When trying to activate Office 2010 with KMS you recieve the error: 0xc004f038 (Unknown Error).

According to Microsoft, this occurs when the client activation request count on the KMS host is not high enough for client computers to activate
Relevant error code: 0xC004F038

The Office 2010 KMS host must receive activation requests from at least five Office 2010 KMS clients before KMS clients on that network can be activated. If the KMS host does not receive more than five requests, KMS clients will not be activated. If you deploy Office 2010 to more than five computers, their initial activation requests will be used to build up the count. If activation fails, the computers will attempt activation two hours later. At that time, if the KMS host has a sufficient count, activation will be successful. To trigger activation manually on the KMS client, run ospp.vbs /act. For more information about the ospp.vbs script, see Tools to configure client computers in Office 2010.

On the KMS Host, using an elevated command prompt type slmgr.vbs /dli to view license information.

Troubleshoot Volume Activation: technet.microsoft.com/en-us/library/ee624355.aspx
Troubleshoot KMS Host: technet.microsoft.com/en-us/library/ee939272.aspx
Update Office 2010 from MAK to KMS: kb.wisc.edu/page.php?id=13994


Access 97: No license on this machine

Jan 8

Posted by SteveHardie in How To | No Comments

When you start Microsoft Access 97, you may receive the following error message:

Microsoft Access can't start because there is no license for it on this machine.

The most likely cause is that Microsoft Access is not properly registered on your computer. If Microsoft Access is not properly registered on your computer, you will need to delete or rename a font, then reinstall Microsoft Access. Follow the steps here, or the summary below:

  1. Open your fonts directory (Usually c:\windows\fonts)
  2. Find the font named Haettenschweiler or the font file Hatten.ttf
    Note If Hatten.ttf is not found, try searching for Haettenschweiler.ttf.
  3. Delete or rename this file.
  4. Reinstall Microsoft Access 97


Tags: Access, Database, win xp

How To: Access Server 2008 Using a Different DNS Hostname

Jan 5

Posted by SteveHardie in Uncategorized | No Comments

You may have a situation where you would like to abriviate the name of a computer, or make it more meaningful when connecting to file or print shares.
e.g:

from \\big-long-svr-name
to \\shortname

To do this, you can setup a new DNS A record or CNAME in your Active Directory DNS and point it to the FQDN or IP address of the desired server.

However, you may run into trouble when trying to access the Windows Server 2008 share from a Windows XP Machine.
The following error appears:

You were not connected because a duplicate name exists on the network. Go to System in Control Panel to change the computer name and try again.

This is because Windows 2008 and Windows Vista support SMB 2.0. Windows XP uses SMB 1.0. In order to allow Windows XP clients to access the Windows 2008 server with an alias, you need to add a registry entry to the Windows 2008 Server.

  1. Locate and click the following key in the registry of the server:
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters
  2. On the Edit menu, click Add Value, and then add the following registry value:
    Value name: DisableStrictNameChecking
    Data type: REG_DWORD
    Radix: Decimal
    Value: 1

    1. support.microsoft.com/?id=281308

Connecting to Exchange using Outlook Anywhere

Nov 23

Posted by SteveHardie in Exchange, How To | No Comments

Access to your Exchange account when you are outside of your organization’s firewall, such as when you are at home or traveling, usually requires a virtual private network (VPN). VPN connections provide remote access and connections to private networks over the Internet.

Read the rest of this entry »

Tags: E-Mail, exchange, How To, Outlook

SQL 2008: Truncate or Srink a large Log File

Nov 23

Posted by SteveHardie in How To, Other | No Comments

I had a problem with a SQL Server 2008 database that had a log file in excess of 90gb, when the DB file itself was less than 2gb.

Using the SQL Server Managment Studio to Backup, or Shrink File did not reduce the log file size. In previous versions of SQL, you could use the command BACKUP LOG TestDB WITH TRUNCATE_ONLY to shrink the log file. But this command is no longer supported in SQL Server 2008.

I found this code to be very helpful.

USE [master]
GO
ALTER DATABASE [dbname] SET RECOVERY SIMPLE WITH NO_WAIT
DBCC SHRINKFILE(dblogfile, 1)
ALTER DATABASE [dbname] SET RECOVERY FULL WITH NO_WAIT
GO

If you cant figure out the DBCC SHRINKFILE(dblogfile,1) line, just run the first line, then use SQL Server Managment Studio to shrink the log file, then run the third line.

Tags: How To, MSSQL, SQL, T-SQL

Setup Tips for Trixbox

Aug 15

Posted by SteveHardie in How To | No Comments

This post is really just for me to remember what additional setup features I do and how to do them on a new Trixbox installation.
Read the rest of this entry »

Tags: Asterisk

Adding an existing AD User to the SBS 2011 Console

Aug 7

Posted by SteveHardie in How To | No Comments

After migrating from a Server 2003 Active Directory, to a Windows Small Business Server 2011 installation, I found that the migration did not import the existing AD users and computers into the SBS 2011 console.

A quick google search found this simple fix:

  1. Optional. Using the Active Directory Users and Computers console, move your users to the MyBusiness/Users/SBSUsers Orginization Unit.
  2. Open ADSI Edit from administrative tools
  3. Right click ADSI Edit and Connect to… and click Ok keeping the default values
  4. Browse to the user you want to import to the SBS 2011 Console
  5. Richt click the user, and select Properties
  6. Find the setting msSBSCreationState and set the value to Created
    spacer
  7. Save the changes, and repeat for other users.


Tags: How To, SBS 2011, windows

How To: Reset the Directory Services Restore Mode Administrator Account Password in Windows Server 2003

Aug 6

Posted by SteveHardie in How To | No Comments

This article describes how to reset the Directory Services Restore Mode (DSRM) administrator password for any server in your domain without restarting the server in DSRM.

To Reset the DSRM Administrator Password

  1. Click, Start, click Run, type ntdsutil, and then click OK.
  2. At the Ntdsutil command prompt, type set dsrm password.
  3. At the DSRM command prompt: reset password on server null.
    The null variable assumes that the DSRM password is being reset on the local computer.
  4. Type the new password when you are prompted.
  5. At the DSRM command prompt, type q.
  6. At the DSRM command prompt, type q.

The Microsoft KB Article for this can be found here

Tags: troubleshoot, windows

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.