Skip to content

Commit 26fc5ae

Browse files
MongoDB
1 parent 7042a97 commit 26fc5ae

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

scripts/AzurePlatformSetup/SmallEnvironment/Create-SmallEnvironment.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ $command2 = "powershell `"E:\Install\Install-PowerShellCore.ps1`" -ScriptDownloa
117117
$psCommand = "mkdir E:\Install;e:;cd e:\install;powershell -c '$command1';$command2;"
118118
$commandResult = Invoke-AzVMRunCommand -VM $vm -CommandId 'RunPowerShellScript' -ScriptString $psCommand
119119

120-
$ps7Command1 = "iwr -Uri `"https://raw.githubusercontent.com/OneBitSoftware/DevOps/refs/heads/main/scripts/AzurePlatformSetup/SmallEnvironment/Setup-SmallEnvironment`" -OutFile `"E:\Install\Setup-SmallEnvironment.ps1`""
121-
#$ps7Command1 = "& `"C:\Program Files\PowerShell\7\pwsh.exe`" -Command { Get-ChildItem }"
122-
$ps7CommandResult = Invoke-AzVMRunCommand -VM $vm -CommandId 'RunPowerShellScript' -ScriptString $ps7Command1
120+
$ps7Command1 = "iwr -Uri `"https://raw.githubusercontent.com/OneBitSoftware/DevOps/refs/heads/main/scripts/AzurePlatformSetup/SmallEnvironment/Setup-SmallEnvironment.ps1`" -OutFile `"E:\Install\Setup-SmallEnvironment.ps1`""
121+
$ps7Command2 = "& `"C:\Program Files\PowerShell\7\pwsh.exe`" -Command `"E:\Install\Setup-SmallEnvironment.ps1`""
122+
$ps7Command2 = "powershell -c '$ps7Command1';$ps7Command2;"
123+
$ps7CommandResult = Invoke-AzVMRunCommand -VM $vm -CommandId 'RunPowerShellScript' -ScriptString $ps7Command2
123124
$ps7CommandResult

scripts/AzurePlatformSetup/SmallEnvironment/Setup-SmallEnvironment.ps1

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
11

2+
############################################################ Start Windows Defender Exclusions
3+
4+
Add-MpPreference -ExclusionPath $ElasticInstallPath
5+
Add-MpPreference -ExclusionPath $ElasticDataPath
6+
Add-MpPreference -ExclusionPath $MongoDbPath
7+
Add-MpPreference -ExclusionPath $ClientFolder
8+
Add-MpPreference -ExclusionPath $MainFolder
9+
10+
Set-MpPreference -DisableRealtimeMonitoring $true
11+
12+
13+
# To remove Windows Defender
14+
# Remove-WindowsFeature Windows-Defender, Windows-Defender-GUI
15+
############################################################ End Windows Defender Exclusions
16+
17+
18+
############################################################ MongoDB Start
219

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

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

1632

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

4055

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

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

0 commit comments

Comments
 (0)