Script per svuotare il cestino di onedrive. Necessita installare in powershell il seguente modulo con il comando:
Install-Module -Name PnP.PowerShellCreiamo un file con la cifratura della password:
"Password" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "C:\Temp\Password.txt"
Creiamo un file empty_onedrive.ps1
$OneDriveSiteURL="https://domain.com-my.sharepoint.com/personal/domain.com_onmicrosoft_com/" #Get Credentials to connect $username="email@domain.com" $encpassword = Get-Content "C:\Temp\Password.txt" | ConvertTo-SecureString $Cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $encpassword #Connect to OneDrive for Business Site Connect-PnPOnline $OneDriveSiteURL -Credentials $Cred #empty recycle bin onedrive for business powershell Clear-PnPRecycleBinItem -All -force