Update to the OneDrive for Business Admin Tool

Update to the OneDrive for Business Admin Tool

  •  
  •  
  •  
  •  
  •  
  •  

Today, I pressed in a little bit on exploring CSOM–at least as it relates to the OneDrive for Business Admin tool.

One of my peers asked if there was a command that we could use to check to see if a site had been put on a retention hold.  Man, wouldn’t that be the cat’s meow.

I think the cat has meowed.

Now, if you’re familiar with (and dug into) my Get-UserHoldPolicies script, you’ll remember that the I used the Get-RetentionCompliancePolicy to expose that information:

 If ($IncludeInheritedPolicies)
{
$InheritedPolicies = (Get-RetentionCompliancePolicy -DistributionDetail) | ? { $_.ExchangeLocation -match "All" -and $_.Enabled -eq $True -and $_.DistributionStatus -eq "Success" -and $_.Mode -eq "Enforce"}
} # End If $IncludeInheritedPolicies

You can also see this info in (Get-OrganizationConfig).InPlaceHolds.

Unfortunately, it’s a little more convoluted for SharePoint and OneDrive sites, as inherited policies aren’t really stamped anywhere that I’ve been able to find (yet).

However, when it comes to explicitly defined policies (such as a retention policy for a specific site or an eDiscovery case hold), those are stamped on the site.

We can see the explicit hold policies applied to a site here:

$ClientContextSource = New-Object Microsoft.SharePoint.Client.ClientContext($OD4BPath);

$ClientContextSource.Credentials = $Creds
$ClientContextSource.ExecuteQuery()

$personalWeb = $ClientContextSource.Web
$ClientContextSource.Load($personalWeb)
$ClientContextSource.ExecuteQuery()

$LibraryStatus = $personalWeb.AllProperties
$ClientContextSource.Load($LibraryStatus)
$ClientContextSource.ExecuteQuery()
[array]$holdstemp = $LibraryStatus.FieldValues.allwebholds -split ";"

The resulting array, $holdstemp, will show the Guids of the hold policies that have been stamped on the library.

Of course, this wouldn’t be very fun if you had to type it in each time you used it, which is why I’ve included it in the updated OneDrive for Business Admin tool.  To use it, just use the HoldStatus switch parameter:

Go get thee an update! https://aka.ms/OneDriveAdmin

 

Published by Aaron Guilmette

Helping companies conquer inferior technology since 1997. I spend my time developing and implementing technology solutions so people can spend less time with technology. Specialties: Active Directory and Exchange consulting and deployment, Virtualization, Disaster Recovery, Office 365, datacenter migration/consolidation, cheese.

Reader Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.