0 votes

Hi

Just starting to trial Adaxes and so far so good. Haven't quite grasped the PowerShell v ADSI features and was hoping someone could assist with my PS script.

Basically I am creating a scheduled task to send out a monthly report of our Office 365 subscriptions, I have the code for tyhis to work and know how to email this out via PS but was wondering if there is a cleanber way of doing with Adaxes.

Script:

{
    $objectId = [Guid]$Context.TargetObject.Get("adm-O365ObjectId")
}

$scriptBlock = {
    param($credential)
    Import-Module MSOnline
    Connect-MsolService -Credential $credential
    Get-MSOLUser -All | Where-Object {$_.licenses[0].AccountSku.SkuPartNumber -ne “STANDARDWOFFPACK” -and $_.IsLicensed -eq $True} | select displayname,userprincipalname,Department,Office | Export-Csv C:\TEMP\O365_E3_License_Report.csv
}

# Get credentials for the tenant where the user's Office 365 account is hosted
$o365Credential = $Context.GetOffice365Credential()

# Start Windows PowerShell as a separate process and run the script block in that process
$job = Start-Job -ScriptBlock $scriptBlock -ArgumentList $o365Credential
$job | Wait-Job -Timeout 540
if ($job -eq $NULL)
{
    return
}

I could add some PS code to email out the report but that would make the script quite long, just wondering if I can somehow use the Adaxes ADSI to make it better.

Thanks

by (20 points)

Please log in or register to answer this question.

Related questions

0 votes
1 answer

Hello, is there a way to save powershell variable to axases attribute and send it via "send email notification" in Scheduled task? for example, check if Office 2016 ... .name) installed"} ` then add $customattrib value to Send email notification. Thank you

asked Feb 13, 2020 by vheper (20 points)
0 votes
1 answer

I have a number of custom Powershell commands that run during user onboarding, and while the Powershell script runs successfully, the Adaxes execution log for the command will ... Adaxes when this happens so the command doesn't show that it ran successfully?

asked Dec 16 by cwyant-hfg (40 points)
0 votes
1 answer

I am trying to find a way to get an hourly report on locked out user accounts to only be sent if the total amout of locked out account exceeds 10 users. Is this possible in ... a way to setup the logic to check to see how many items are returned in a report.

asked Jun 12 by Vertigo (50 points)
0 votes
1 answer

My security team is looking to do a security review and would like the vendor to fill out a questionnaire.

asked Aug 25, 2023 by LarrySargent (20 points)
0 votes
1 answer

During a copy user action, I have a business rule to send an email which will contain the account password. Which property would I use to send it to recipient/requestor? Would %mail% look at the source user of the copy action or the newly created account?

asked Mar 24, 2023 by GronTron (320 points)
3,589 questions
3,278 answers
8,303 comments
548,155 users