Forum Discussion
wilsonsyl
Oct 05, 2020Copper Contributor
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 = "mailto:xxxx@abc.com"
$Mail.Subject = ${env:computername}+" Local Administrators Account"
$Mail.Body = "IT Security Task"
$Mail.Attachments.Add($result);
#send message
$Mail.Send()
1 Reply
Sort By