# Taken from: http://blogs.msdn.com/b/daiken/archive/2007/02/12/compress-files-with-windows-powershell-then-package-a-windows-vista-sidebar-gadget.aspx
function Extract-Zip
{
param([string]$zipfilename, [string] $destination)
if(test-path($zipfilename))
{
$shellApplication = new-object -com shell.application
$zipPackage = $shellApplication.NameSpace($zipfilename)
$destinationFolder = $shellApplication.NameSpace($destination)
$destinationFolder.CopyHere($zipPackage.Items())
}
}
$client = New-Object System.Net.Webclient
$client.DownloadFile("http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2.2.0-rc2.zip", "c:\mongo.zip")
Extract-Zip "c:\mongo.zip" "c:\"
Rename-Item "C:\mongodb-win32-x86_64-2.2.0-rc2" "C:\mongodb"
if (!(Test-Path c:\MongoDBData)) {
New-Item -Type directory c:\MongoDBData
}
&c:\mongodb\bin\mongod.exe --dbpath=c:\MongoDBData --install --master --noprealloc --smallfiles
Start-Service -Name "MongoDB"
del "C:\mongo.zip"
$client.DownloadFile("http://gist.github.com/raw/633137/55e4681c4cfd3ba42b7bef71c3525697900c6906/purge_old_groups_index.js", "c:\mongodb\purge_old_groups_index.js")
$sch = (&schtasks /Query /TN "Purge old groups and reindex MongoDB")
if($sch -eq $null) {
&schtasks.exe /create /sc DAILY /tn "Purge old groups and reindex MongoDB" /tr "c:\mongodb\bin\mongo.exe GroupsTempData c:\mongodb\purge_old_groups_index.js" /st "01:30"
}
download and install Mongo db
最新推荐文章于 2023-05-06 09:40:24 发布