Powershell: Delete File if Exists

Posted by SteveHardie | On: Sep 25 2012 | Comments (6)
Powershell script to delete a file if it already exists: If (Test-Path $strFileName){ Remove-Item $strFileName } See Also: Powershell: Check If File Exists Powershell: Delete Folder if Exists Test-Path Remove-Item

Exchange 2010: Set Work Hours for Room Mailbox

Posted by SteveHardie | On: Aug 16 2012 | Comments (2)
In Exchange 2010, when you create a room or resource mailbox, the Resource Policy tab gives you the option to Allow scheduling only during business hours. But what is business hours? The default business hours is from 8:00 am until 5:00 pm. You can check this by...

Exchange 2010: Remove disconnected mailbox

Posted by SteveHardie | On: Jun 26 2012 | Comments (0)
After you delete a user from Acrive directory or Exchagne their mailbox is kept in the Exchange database for a number of days until it is automatiaccly removed. As defined in the “Limits” section of the database properties. If you want to force the...

Exchange 2010: Register custom functions in console

Posted by SteveHardie | On: Jun 26 2012 | Comments (0)
If you have defined custom functions in a .ps1 file, to register them in Exchange Command Shell all you need to do is run the following command: [ps] c:\Exchange> . .\.ps1 Then you can call your functions from the PowerShell command line.

Exchange 2010: Purge Dumpster

Posted by SteveHardie | On: May 23 2012 | Comments (5)
This article outlines how to force empty the deleted items / recoverable items dumpster in a users mailbox. To view how much space is consumed by all users dumpster files run this command: Get-MailBox | Get-MailboxStatistics | select DisplayName,TotalDeletedItemSize To...

Exchange 2010: The Term “Search-Mailbox” Is Not Recognized as the Name of a cmdlet

Posted by SteveHardie | On: May 23 2012 | Comments (7)
Problem: When using Powershell to run the Search-Mailbox command the following error is generated: Search-Mailbox” Command in Powershell: The Term “Search-Mailbox” Is Not Recognized as the Name of a cmdlet Solution: This error will be generated...

Exchange 2010: View available space in database

Posted by SteveHardie | On: May 22 2012 | Comments (0)
To view how much database white space you have on your databases run the following cmdlet: Get-MailboxDatabase -Status | Sort-Object DatabaseSize -Descending | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace

Exchange 2010: Distribution Group Owner doesn’t have permissions to update list

Posted by SteveHardie | On: Apr 04 2012 | Comments (0)
Problem When a distribution group owner tries to update their own group in Outlook, they recieve a message saying changes to the public group membership cannot be saved. You do not have sufficient permission to perform this operation on this object Solution Ensure...

Exchange Powershell: Remove e-mail address from address list

Posted by SteveHardie | On: Mar 26 2012 | Comments (7)
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...

SQL 2008: Truncate or Srink a large Log File

Posted by SteveHardie | On: Nov 23 2011 | Comments (0)
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...