Just having thought about how to extract the AIP File status from storage via PowerShell Scripting. Hope this helps. Do leave comments if you find some faulty or beside faulty.
*Note:
- This script doesn’t limit to what you want, you could modify it.
Assumption;
- Has AADRM module installed
- Has the Execution Policy modified
- Has PowerShell 3.0 above or Azure Module PowerShell console
Below is the script;
#Purpose: To export data of AIP labelled files from users devices
#You can do this into a GPO but beware of vulnerabilities and 50-50 percent chance that this could actually work
#If you want to run this in a GPO, you have to modify this script
#Connect to the aadrm service
$AADRM = Connect-AADRMService
if($AADRM){
#Please enter the path
$ReadPath = Read-Host -Prompt "Enter Path that you wish to check"
$ReadPath = $ReadPath.ToString()
$AIPFileStatus = Get-AIPFileStatus -Path "$ReadPath" | where-object {$_.IsLabeled -eq $true}
#Count number of AIP files inside the path
$CountFile = $AIPFileStatus.Count
Write-Host "There are total $CountFile AIP File(s)."
#Prompt for export
$a = Read-Host -Prompt "Do you want to export this data? (Yes/No)"
$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToString('MM-dd-yyyy_hh-mm-ss')
If ($a -eq "Yes" -Or $a -eq "yes"){
$Export = $AIPFileStatus | Export-Csv "AIPFileStatus_$CurrentDate.csv"
Write-Host "Successfully Exported!"
}
else{
Write-Host "End..."
}
}
else{
Write-Host "Fail to connect"
}
