azurepowershelloffice365azure-powershelluipath

PowerShell script for Azure Information Protection labeling


I need to retrieve privacy labels of O365 files. I'm able to achieve that with this script:

$Status = (Get-AipFileStatus -Path 'C:\Users\User\Downloads\test.xlsx')
$ReportLine = [PSCustomObject]@{
         IsLabeled   = $Status.IsLabeled
         LabelId     = $Status.MainLabelId
     Label       = $Status.MainLabelName}


$Status.MainLabelId

Due to UiPath bugs, I need to target Powershell 64-bit. While I can achieve that, I'm facing an issue where I can't retrieve any output that I could use further in my RPA process. Could someone please suggest how I can fix this script and be able to get the output $Status.MainLabelId?


$powershell32 = $env:SystemRoot + '\SysWOW64\WindowsPowerShell\v1.0\powershell.exe'
& $powershell32 Get-AipFileStatus -Path 'C:\Users\User\Downloads\test.xlsx'
$ReportLine = [PSCustomObject]@{
         IsLabeled   = $Status.IsLabeled
         LabelId     = $Status.MainLabelId
     Label       = $Status.MainLabelName}

Solution

  • Found solution.

    $powershell32 = $env:SystemRoot + '\SysWOW64\WindowsPowerShell\v1.0\powershell.exe' & $powershell32 Get-AipFileStatus -Path 'C:\Users\User\Downloads\test.xlsx' | ConvertTo-Json