Skip to content

Instantly share code, notes, and snippets.

@trondhindenes
Created August 13, 2014 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trondhindenes/948ee0aa0ef99b5ee1d7 to your computer and use it in GitHub Desktop.
Save trondhindenes/948ee0aa0ef99b5ee1d7 to your computer and use it in GitHub Desktop.
GenerateDBs
$Folders = get-childitem *db* -path "D:\MDB" -Recurse
foreach ($folder in $folders)
{
$DBName = $folder.Name
$ExchangeServer = $DBName.split("-")[0]
$LogFolderPath = $folder.Fullname.Replace("DB","LOG")
$edbfilepath = "$($folder.FullName)\$DBName.edb"
if (!(get-mailboxdatabase $DBName -erroraction 0))
{
New-mailboxdatabase -server $ExchangeServer -name $dbname -LogFolderPath $LogFolderPath
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment