lithnet / miis-powershell

Lithnet PowerShell Module for FIM/MIM Synchronization Service
Microsoft Public License
40 stars 9 forks source link

Start-ManagementAgent waits if already running #22

Closed IAmStevenJohnson closed 5 years ago

IAmStevenJohnson commented 5 years ago

I'm wondering if there's a way when a PS script runs a Start-ManagementAgent command to not stop and wait if that MA is already running. I would like to have the script just continue on with the next line instead of waiting if the MA on the current Start-ManagementAgent line is already running. Is that possible or would I have to use a PS If statement to check if it's running before using that command? If I must use an If statement, do you have an example of how to do that? Thanks so much.

FredrikMelby commented 5 years ago

if(!$(Get-ManagementAgent -Name "MA").ExecutingRunProfileName){Start-ManagementAgent -MA "MA" -RunProfileName "DI" -Async}

IAmStevenJohnson commented 5 years ago

Thank you so much. Just what I needed.