Skip to content

Instantly share code, notes, and snippets.

@DotTech
Created October 1, 2014 08:14
Show Gist options
  • Save DotTech/b075b6fd2e175c77a173 to your computer and use it in GitHub Desktop.
Save DotTech/b075b6fd2e175c77a173 to your computer and use it in GitHub Desktop.
Sitecore xDB: Install & start MongoDB as Windows service
$service = Get-WmiObject -Class Win32_Service -Filter "Name='MongoDB'"
if ($service -eq $null)
{
$MongoPath = "d:\mongo\mongod.exe"
$MongoLogPath = "d:\mongo\logs\mongod.log"
$MongoDataFolder = "d:\mongo\data"
$binaryPath = "`"$MongoPath`" --service --logpath `"$MongoLogPath`" --dbpath `"$MongoDataFolder`""
New-Service -Name MongoDB -BinaryPathName $binaryPath -Description "MongoDB for Sitecore EMS" -DisplayName "MongoDB" -StartupType auto | Out-Null
$service = Get-WmiObject -Class Win32_Service -Filter "Name='MongoDB'"
}
$service.StartService() | Out-Null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment