From bf34dfb00a0fa765bee014c087a2d7ede4bb1117 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Mon, 8 Aug 2022 15:55:18 +0200 Subject: [PATCH] Wait for mongodb service running (#6030) --- images/win/scripts/Installers/Install-MongoDB.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/images/win/scripts/Installers/Install-MongoDB.ps1 b/images/win/scripts/Installers/Install-MongoDB.ps1 index 674207ed7..ce73fe5a2 100644 --- a/images/win/scripts/Installers/Install-MongoDB.ps1 +++ b/images/win/scripts/Installers/Install-MongoDB.ps1 @@ -14,6 +14,10 @@ $mongoPath = (Get-CimInstance Win32_Service -Filter "Name LIKE '$mongodbService' $mongoBin = Split-Path -Path $mongoPath.split('"')[1] Add-MachinePathItem "$mongoBin" +# Wait for mongodb service running +$svc = Get-Service $mongodbService +$svc.WaitForStatus('Running','00:01:00') + # Stop and disable mongodb service Stop-Service -Name $mongodbService Set-Service $mongodbService -StartupType Disabled