Added Files
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Retrive a list of all OneDrive for Business sites within the organisation
|
||||
#
|
||||
# Requires the Sharepoint Online PowerShell module to be installed
|
||||
#
|
||||
|
||||
# The name of your Office 365 organization
|
||||
# This can be found in your Sharepoint URL before the '-my', eg: https://thecompany-my.sharepoint.com/
|
||||
$spoTenantName=''
|
||||
|
||||
# Connect to Sharepoint Online
|
||||
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
|
||||
Connect-SPOService -Url ('https://' + $spoTenantName + '-admin.sharepoint.com')
|
||||
|
||||
# Create the common base URL for OneDrive for Business
|
||||
$spoBaseWildcard = 'https://' + $spoTenantName + '-my.sharepoint.com/personal/*'
|
||||
|
||||
# Get a list of all 'personal' sites (e.g.: OneDrive for Business sites) within the tenant
|
||||
Get-SPOSite -Limit all -IncludePersonalSite $true | Where-Object {$_.Url -like $spoBaseWildcard} | Select-Object Owner,URL,StorageQuota | Format-Table -AutoSize
|
||||
@@ -0,0 +1,47 @@
|
||||
# Increase the size of specific users' OneDrive for Business accounts
|
||||
#
|
||||
# Requires the Sharepoint Online PowerShell module to be installed
|
||||
#
|
||||
|
||||
# The name of your Office 365 organization
|
||||
# This can be found in your Sharepoint URL before the '-my', eg: https://thecompany-my.sharepoint.com/
|
||||
$spoTenantName=''
|
||||
|
||||
# The size you want to increase to in TB.
|
||||
$newSize = 1
|
||||
|
||||
# The list of UPNs for the accounts you wich to add the secondary admin to (list can contain a single item if required)
|
||||
$userList = @('','')
|
||||
|
||||
# Connect to Sharepoint Online
|
||||
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
|
||||
Connect-SPOService -Url ('https://' + $spoTenantName + '-admin.sharepoint.com')
|
||||
|
||||
# Create the base URL for OneDrive for Business
|
||||
$spoBaseURL = 'https://' + $spoTenantName + '-my.sharepoint.com/personal/'
|
||||
|
||||
# Convert new size to bytes
|
||||
$newBytes = $newSize * 1048576
|
||||
|
||||
# Increase size for each user in list
|
||||
foreach ($userUPN in $userList) {
|
||||
$spoURL = $spoBaseURL + ($userUPN.ToLower() -replace "[@.]", "_")
|
||||
try {
|
||||
$currentBytes = (Get-SPOSite -Identity $spoURL -ErrorAction:Stop).StorageQuota
|
||||
if ($currentBytes -gt $newBytes) {
|
||||
try {
|
||||
Set-SPOSite -Identity $spoURL -StorageQuota $newBytes -ErrorAction:Stop
|
||||
Write-Output -InputObject ('Updated OneDrive account limit for ' + $userUPN + ' to ' + $newSize + 'TB.')
|
||||
}
|
||||
catch {
|
||||
Write-Output -InputObject ('Failed to update OneDrive account limit for ' + $userUPN + '.')
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Output -InputObject ('OneDrive account limit for ' + $userUPN + ' already equal to or higher than ' + $newSize + 'TB.')
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Output -InputObject ('No OneDrive account found for ' + $userUPN + '.')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
# Increase the size of all users' OneDrive for Business accounts
|
||||
#
|
||||
# Requires the Sharepoint Online PowerShell module to be installed
|
||||
#
|
||||
|
||||
# The name of your Office 365 organization
|
||||
# This can be found in your Sharepoint URL before the '-my', eg: https://thecompany-my.sharepoint.com/
|
||||
$spoTenantName=''
|
||||
|
||||
# The size you want to increase to in TB.
|
||||
$newSize = 1
|
||||
|
||||
# Connect to Sharepoint Online
|
||||
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
|
||||
Connect-SPOService -Url ('https://' + $spoTenantName + '-admin.sharepoint.com')
|
||||
|
||||
# Create the common base URL for OneDrive for Business
|
||||
$spoBaseWildcard = 'https://' + $spoTenantName + '-my.sharepoint.com/personal/*'
|
||||
|
||||
# Convert new size to bytes
|
||||
$newBytes = $newSize * 1048576
|
||||
|
||||
# Get a list of all personal sites within the tenant.
|
||||
$personalSites = Get-SPOSite -Limit all -IncludePersonalSite $true | Where-Object {$_.Url -like $spoBaseWildcard}
|
||||
|
||||
# Increase size for each user in turn.
|
||||
foreach ($personalSite in $personalSites) {
|
||||
$spoURL = $personalSite.Url
|
||||
$userUPN = $personalSite.Owner
|
||||
$currentBytes = $personalSite.StorageQuota
|
||||
|
||||
if ($currentBytes -lt $newBytes) {
|
||||
try {
|
||||
Set-SPOSite -Identity $spoURL -StorageQuota $newBytes -ErrorAction:Stop
|
||||
Write-Output -InputObject ('Updated OneDrive account limit for ' + $userUPN + ' to ' + $newSize + 'TB.')
|
||||
}
|
||||
catch {
|
||||
Write-Output -InputObject ('Failed to update OneDrive account limit for ' + $userUPN + '.')
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Output -InputObject ('OneDrive account limit for ' + $userUPN + ' already equal to or higher than ' + $newSize + 'TB.')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
# Add a collection administrator to your users' OneDrive for Business accounts
|
||||
#
|
||||
# Requires the Sharepoint Online PowerShell module to be installed
|
||||
#
|
||||
|
||||
# The name of your Office 365 organization
|
||||
# This can be found in your Sharepoint URL before the '-my', eg: https://thecompany-my.sharepoint.com/
|
||||
$spoTenantName=''
|
||||
|
||||
# The UPN of the account you wish to add as a secondary admin
|
||||
$secondaryAdminUPN = ''
|
||||
|
||||
# The list of UPNs for the accounts you wich to add the secondary admin to
|
||||
$userList = @('','')
|
||||
|
||||
# Connect to Sharepoint Online
|
||||
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
|
||||
Connect-SPOService -Url ('https://' + $spoTenantName + '-admin.sharepoint.com')
|
||||
|
||||
# Create the base URL for OneDrive for Business
|
||||
$spoBaseURL = 'https://' + $spoTenantName + '-my.sharepoint.com/personal/'
|
||||
|
||||
# Add secondary admin to each user in the list
|
||||
foreach ($userUPN in $userList) {
|
||||
$spoURL = $spoBaseURL + ($userUPN.ToLower() -replace "[@.]", "_")
|
||||
Set-SPOUser -Site $spoURL -LoginName $secondaryAdminUPN -IsSiteCollectionAdmin $true -ErrorAction:Continue
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# Remove a collection administrator from your users' OneDrive for Business accounts
|
||||
#
|
||||
# Requires the Sharepoint Online PowerShell module to be installed
|
||||
#
|
||||
|
||||
# The name of your Office 365 organization
|
||||
# This can be found in your Sharepoint URL before the '-my', eg: https://thecompany-my.sharepoint.com/
|
||||
$spoTenantName=''
|
||||
|
||||
# The UPN of the account you wish to add as a secondary admin
|
||||
$secondaryAdminUPN = ''
|
||||
|
||||
# The list of UPNs for the accounts you wich to add the secondary admin to
|
||||
$userList = @('','')
|
||||
|
||||
# Connect to Sharepoint Online
|
||||
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
|
||||
Connect-SPOService -Url ('https://' + $spoTenantName + '-admin.sharepoint.com')
|
||||
|
||||
# Create the base URL for OneDrive for Business
|
||||
$spoBaseURL = 'https://' + $spoTenantName + '-my.sharepoint.com/personal/'
|
||||
|
||||
# Add secondary admin to each user in the list
|
||||
foreach ($userUPN in $userList) {
|
||||
$spoURL = $spoBaseURL + ($userUPN.ToLower() -replace "[@.]", "_")
|
||||
Set-SPOUser -Site $spoURL -LoginName $secondaryAdminUPN -IsSiteCollectionAdmin $false -ErrorAction:Continue
|
||||
Remove-SPOUser -Site $spoURL -LoginName $secondaryAdminUPN
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
# Retrive a list of all OneDrive for Business sites, check their size and reset it if it is less than the default
|
||||
#
|
||||
# Requires the Sharepoint Online PowerShell module to be installed
|
||||
#
|
||||
|
||||
# The name of your Office 365 organization
|
||||
# This can be found in your Sharepoint URL before the '-my', eg: https://thecompany-my.sharepoint.com/
|
||||
$spoTenantName=''
|
||||
|
||||
# Connect to Sharepoint Online
|
||||
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
|
||||
Connect-SPOService -Url ('https://' + $spoTenantName + '-admin.sharepoint.com')
|
||||
|
||||
# Create the common base URL for OneDrive for Business
|
||||
$spoBaseWildcard = 'https://' + $spoTenantName + '-my.sharepoint.com/personal/*'
|
||||
|
||||
# Get the default quota for the tenant
|
||||
$defaultQuota = (Get-SPOTenant).OneDriveStorageQuota
|
||||
|
||||
# Get a list of all 'personal' sites (e.g.: OneDrive for Business sites) within the tenant
|
||||
$usersToReset = Get-SPOSite -Limit all -IncludePersonalSite $true | Where-Object {$_.Url -like $spoBaseWildcard -and $_.StorageQuota -lt $defaultQuota}
|
||||
|
||||
# Get a list of all 'personal' sites (e.g.: OneDrive for Business sites) within the tenant
|
||||
foreach ($userToReset in $usersToReset) {
|
||||
Write-Output -InputObject ('Resetting user ' + $userToReset.Owner)
|
||||
Set-SPOSite -Identity $userToReset.Url -StorageQuotaReset
|
||||
}
|
||||
Reference in New Issue
Block a user