Skip to content

Commit

Permalink
MongoDB
Browse files Browse the repository at this point in the history
  • Loading branch information
SharePointRadi committed Oct 10, 2024
1 parent 7042a97 commit 26fc5ae
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ $command2 = "powershell `"E:\Install\Install-PowerShellCore.ps1`" -ScriptDownloa
$psCommand = "mkdir E:\Install;e:;cd e:\install;powershell -c '$command1';$command2;"
$commandResult = Invoke-AzVMRunCommand -VM $vm -CommandId 'RunPowerShellScript' -ScriptString $psCommand

$ps7Command1 = "iwr -Uri `"https://raw.githubusercontent.com/OneBitSoftware/DevOps/refs/heads/main/scripts/AzurePlatformSetup/SmallEnvironment/Setup-SmallEnvironment`" -OutFile `"E:\Install\Setup-SmallEnvironment.ps1`""
#$ps7Command1 = "& `"C:\Program Files\PowerShell\7\pwsh.exe`" -Command { Get-ChildItem }"
$ps7CommandResult = Invoke-AzVMRunCommand -VM $vm -CommandId 'RunPowerShellScript' -ScriptString $ps7Command1
$ps7Command1 = "iwr -Uri `"https://raw.githubusercontent.com/OneBitSoftware/DevOps/refs/heads/main/scripts/AzurePlatformSetup/SmallEnvironment/Setup-SmallEnvironment.ps1`" -OutFile `"E:\Install\Setup-SmallEnvironment.ps1`""
$ps7Command2 = "& `"C:\Program Files\PowerShell\7\pwsh.exe`" -Command `"E:\Install\Setup-SmallEnvironment.ps1`""
$ps7Command2 = "powershell -c '$ps7Command1';$ps7Command2;"
$ps7CommandResult = Invoke-AzVMRunCommand -VM $vm -CommandId 'RunPowerShellScript' -ScriptString $ps7Command2
$ps7CommandResult
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@

############################################################ Start Windows Defender Exclusions

Add-MpPreference -ExclusionPath $ElasticInstallPath
Add-MpPreference -ExclusionPath $ElasticDataPath
Add-MpPreference -ExclusionPath $MongoDbPath
Add-MpPreference -ExclusionPath $ClientFolder
Add-MpPreference -ExclusionPath $MainFolder

Set-MpPreference -DisableRealtimeMonitoring $true


# To remove Windows Defender
# Remove-WindowsFeature Windows-Defender, Windows-Defender-GUI
############################################################ End Windows Defender Exclusions


############################################################ MongoDB Start

# MongoDB variables - Download the Community edition
$MongoDbPath = "E:\MongoDB"

$MongoMajorVersion = "7.0" # Used in path
$MongoMinorVersion = "14"
$MongoDbVersion = "$MongoMajorVersion.$MongoMinorVersion"
$UnzippedFolderName = "mongodb-win32-x86_64-windows-$MongoDbVersion"
$MongoMsiFilename = "mongodb-windows-x86_64-$MongoDbVersion-signed.msi"
$MongoDownloadURL = "https://fastdl.mongodb.org/windows/$MongoMsiFilename"
$MongoDbConnectionString = "mongodb://localhost:27017/${CatalogDatabaseName}"
$MongoShellFilename = "mongosh-2.3.2-x64.msi"
$MongoShellDownloadURL = "https://downloads.mongodb.com/compass/$MongoShellFilename"


############################################################ MongoDB Start
#Check if mongo is already installed
if ((Test-Path -path $MongoDbPath) -eq $True)
{
Expand All @@ -39,7 +54,7 @@ Write-Host "Downloading mongo complete."


######## New - Use the MSI to install MongoDB Server
msiexec.exe /l*v mdbinstall.log /qb /i $mongoDbMsiFile INSTALLLOCATION="$MongoDbPath\Server\5.0\" ADDLOCAL="ServerService"
msiexec.exe /l*v mdbinstall.log /qb /i $mongoDbMsiFile INSTALLLOCATION="$MongoDbPath\Server\$MongoMajorVersion\" ADDLOCAL="ServerService"

# Loop and wait for the service to start
$limit = (Get-Date).AddMinutes(5)
Expand Down

0 comments on commit 26fc5ae

Please sign in to comment.