Sweet. Now I just need to figure out how to disable sync and make this loop through 20 domains.
From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On Behalf Of Krueger, Jeff Sent: Wednesday, June 8, 2016 3:16 PM To: powershell@lists.myitforum.com Subject: [powershell] RE: How To Manipulate Azure Domains If you're just looking to delete any account that was synced it looks like in theory you should be able to do a one liner like: Get-MsolUser -Synchronized | Remove-MsolUser -Force The cmdlet help indicates that Remove-MsolUser will take pipline input which is a bit nuclear, but you may want to pull a list of users first to see what you've got to work with. This will delete the users and they'll show up in the delete users node in the portal, the Remove-MsolUser cmdlet also has an option parameter -RemoveFromRecycleBin which will get rid of all traces of the account From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Marcum, John Sent: Wednesday, June 8, 2016 3:17 PM To: powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com> Subject: [powershell] RE: How To Manipulate Azure Domains No, they were labs and the domain controllers are gone. I'm essentially trying to figure out how to reset them so I can reuse them for the same lab over and over. The DC's are only up for 24 hours and then they are gone. From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Krueger, Jeff Sent: Wednesday, June 8, 2016 2:00 PM To: powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com> Subject: [powershell] RE: How To Manipulate Azure Domains Are these currently being DirSync'd? You can change your DirSync setting to only sync an empty OU or something with no user objects, force a full sync which will delete the users from AzureAD and then you could disable DirSync From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Marcum, John Sent: Wednesday, June 8, 2016 11:11 AM To: 'powershell@lists.myitforum.com' <powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com>> Subject: [powershell] How To Manipulate Azure Domains I have 19 domains in a single Azure tenant. I want to remove all users who were sourced from Local Active Directory and then disable synchronization. Anyone have a script that would do that? ________________________________ Confidentiality Notice: This e-mail is from a law firm and may be protected by the attorney-client or work product privileges. If you have received this message in error, please notify the sender by replying to this e-mail and then delete it from your computer. ________________________________ CONFIDENTIALITY NOTICE: This email contains information from the sender that may be CONFIDENTIAL, LEGALLY PRIVILEGED, PROPRIETARY or otherwise protected from disclosure. This email is intended for use only by the person or entity to whom it is addressed. If you are not the intended recipient, any use, disclosure, copying, distribution, printing, or any action taken in reliance on the contents of this email, is strictly prohibited. If you received this email in error, please contact the sending party by reply email, delete the email from your computer system and shred any paper copies. Note to Patients: There are a number of risks you should consider before using e-mail to communicate with us. See our Privacy & Security page on www.henryford.com<http://www.henryford.com> for more detailed information as well as information concerning MyChart, our new patient portal. If you do not believe that our policy gives you the privacy and security protection you need, do not send e-mail or Internet communications to us.