I’m working on a script for new starters which includes syncing the user to O365 via AD. As part of that, and because of the time the sync takes I’ve put a Start-Sleep -Seconds 60 command into the script to give the object enough time to sync.
I’ve been reading about Do/while and Do/until loops but don’t have much experience in using them. Is there a way I can incorporate one of these loops so the script waits until the object is visible in Azure AD/O365 and then continues the script?
I also have the same issue when it comes to licence assignment and mailbox creation. I’ve had to put another sleep in of 60 seconds in order for the mailbox to show so I can perform further actions on it.
Any help/guidance is appreciated.