Skip to content

Instantly share code, notes, and snippets.

@sob
Created May 17, 2017 14:49
Show Gist options
  • Select an option

  • Save sob/e5e87f206f2d48cc8b2587d57ef0a636 to your computer and use it in GitHub Desktop.

Select an option

Save sob/e5e87f206f2d48cc8b2587d57ef0a636 to your computer and use it in GitHub Desktop.

Revisions

  1. Sean O'Brien created this gist May 17, 2017.
    7 changes: 7 additions & 0 deletions ClearDirectory.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Connect-AzureAD

    Get-AzureADUser -All | Export-CSV C:\users.csv
    Get-AzureADGroup -All | Export-CSV C:\groups.csv

    Import-CSV C:\Users.csv | Remove-AzureADUser -Force
    Import-CSV C:\Groups.csv | Remove-AzureADGroup -Force