Oct 05 2020 08:22 AM
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
$Outlook = New-Object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = "xxxx@abc.com"
$Mail.Subject = ${env:computername}+" Local Administrators Account"
$Mail.Body = "IT Security Task"
$Mail.Attachments.Add($result);
$Mail.Send()
Oct 06 2020 06:28 AM
Hi @wilsonsyl,
I don't think there is a simple solution to your problem. I would suggest to find a way to bypass AIP. Maybe uploading the file to a share or something similar instead of sending it via mail.
BR,
Mattia