PowerShell – Disable Office Graph per user (opt out)

The code below will disable Graph for each individual user by clearing flags in the User Profile Application (UPA).   This allows organization to enable the Graph feature overall and Delve App, while avoiding document discovery.  Mitigates concern of accidental over sharing  (i.e. confidential data with wide open permissions).  Cheers!   shades_smile

User Profile Service Application (UPA) shows two properties which manage the delve features:

  • OfficeGraphEnabled   (ex = True/False)
  • DelveFlags  (ex = 2048/Null)

Code

Connect-MsolService
$users = Get-MsolUser
$total = $user.Count
foreach ($u in $users) {
	$upn = $u.UserPrincipalName
	$i++
	Write-Progress –Activity "Update User" –Status $upn –PercentComplete ($i/$total)
	Set-PnPUserProfileProperty -Account $upn -PropertyName "DelveFlags" -Value $null
	Set-PnPUserProfileProperty -Account $upn -PropertyName "OfficeGraphEnabled" -Value $null
}
Write-Host "DONE" –Fore Green

Screenshots

image

image

image

image

image

image

Reference

Return to Top ▲Return to Top ▲