question

wilsonsyl avatar image
0 Votes"
wilsonsyl asked IvoMaas answered

How to set the AIP label in the Powershell script to send the email?

I wrote a Powershell script to get the local administrators accounts from the endpoints and then distribute to the endpoints by using intune, then send the results back to IT by email.
However, the Microsoft Azure Information Protection (AIP) prompt out and request to select a label. May I know how to set the AIP label in the script, thus that the endpoint can send the email silently?
Or any method to bypass the AIP?

$result = ${env:TEMP}+"\"+${env:computername}+".csv"
Get-LocalGroupMember -Group "Administrators" | Format-Table –AutoSize | Export-Csv -Path $result

create COM object named Outlook

$Outlook = New-Object -ComObject Outlook.Application

create Outlook MailItem named Mail using CreateItem() method

$Mail = $Outlook.CreateItem(0)

add properties as desired

$Mail.To = "xxxx@abc.com"
$Mail.Subject = ${env:computername}+" Local Administrators Account"
$Mail.Body = "IT Security Task"
$Mail.Attachments.Add($result);

send message

$Mail.Send()

azure-information-protection
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@wilsonsyl
Are you following any type of documentation when writing this PS script?
Can you provide the complete message that you're seeing when it prompts to select a label?


If you have any other questions, please let me know.
Thank you for your time!

0 Votes 0 ·

@wilsonsyl
I just wanted to check in and see if you required additional assistance or if you were able to resolve this issue?

As an additional note, you can also try reaching out to our AIP team via their Tech Community channel.


If you have any other questions, please let me know.
Thank you for your time!


If any reply/answer helped resolve your question, please remember to "mark as answer" so that others in the community facing similar issues can easily find the solution.


0 Votes 0 ·

30014-capture.jpg



The AIP label prompts out when sending the email. Any methods to add the AIP label when sending the email using Powershell?

0 Votes 0 ·
capture.jpg (78.1 KiB)

1 Answer

IvoMaas avatar image
0 Votes"
IvoMaas answered

Several options come in to mind.

However your AIP policy states that this type of emails need a label. So you could create an exclusion for this type of mails.
Or what you could do is set a default label for all mails. that way the default label is always chosen for each type of mail and people would have to switch to another label type if they need to do it manually (or it is autoappled (you need to configure this) when you have P2 licenses).

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.