Skip to content

Instantly share code, notes, and snippets.

@JohnyWS
Created January 3, 2019 15:06
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JohnyWS/6d0df355bfa63b05e5405c1c3939c69b to your computer and use it in GitHub Desktop.
Save JohnyWS/6d0df355bfa63b05e5405c1c3939c69b to your computer and use it in GitHub Desktop.
Helper file to spin up various required services
# Helper method
function StartService($ServiceName) {
$arrService = Get-Service -Name $ServiceName
while ($arrService.Status -ne 'Running')
{
Start-Service $ServiceName
write-host $arrService.status
write-host 'Service starting'
Start-Sleep -seconds 5
$arrService.Refresh()
if ($arrService.Status -eq 'Running')
{
Write-Host "Service '$ServiceName' is now Running"
}
}
}
# Services to ensure is started
StartService('MSDTC')
pause
@JohnyWS
Copy link
Author

JohnyWS commented Dec 2, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment