- #********** Create multiple Site Collections from .csv file *********************************************
- #csv file path
- $csvfile = 'C:\doc\CreateSiteCollections.csv'
- #O-365 site url and Credential
- Connect-SPOService -Url https:
-
- Import-Csv $csvfile |
- where {
- Write-Host "Creating Site Collection: " $_.URL
- New-SPOSite -Owner $_.Owner -StorageQuota $_.StorageQuota -Url $_.URL -NoWait -ResourceQuota $_.ResourceQuota -Template $_.Template -TimeZoneID $_.TimeZoneID -Title $_.Title -LocaleID $_.Language
- }
-
-
-
-
- #********** delete multiple Site Collections from .csv file *********************************************
- $csvfile = 'C:\doc\DeleteSiteCollections.csv'
- Connect-SPOService -Url https:
-
- Import-Csv $csvfile |
- where { Write-Host "Deleting "$_.URL
-
- remove-sposite –identity $_.URL -Confirm:$False
- Write-Host "Moved to recycle bin"
- remove-spodeletedsite –identity $_.URL -Confirm:$False
- Write-Host "Removed from recycle bin"
- }
Delete site collection pass only site collection Url column