0 votes

Is there a way to have a powershell script write to the logs in Adaxes?

I have a powershell script that removes all groups from a user. This script is executed from within Adaxes. I would like to report or log exactly what the script has removed from the user to Adaxes logs. Currently, the script is writing to the %info% field in Active Directory and is adequate, but could be some much more useful if it reported to the Adaxes log.

Here is the information that is reported:
[Groups cleared (7/25/2014 10:35:22 AM): IT, Human Resources, Sales, Shipping]

Here is the script:

Import-Module Adaxes
$user = Get-AdmUser "%distinguishedName%" -Properties MemberOf
if ($user.MemberOf -ne $Null)
{
    foreach ($groupDN in $user.MemberOf)
    {
        $Group_collection = $groupDN.split('=')[1].split(',')[0] + ", $Group_collection"
        Remove-AdmGroupMember $groupDN -Members $user -Confirm:$False
    }
    $old_notes = "%info%"
    $Group_collection = "[Groups cleared (%datetime%): " + "$Group_collection" + "]" + "$old_notes"
    $Group_collection = $Group_collection.Replace(", ]","]")
    Set-Admuser -identity "%distinguishedName%" -Replace @{info=$Group_collection}
}
by (290 points)

1 Answer

0 votes
by (216k points)

Hello,

Have a look at Updating the Execution Log.

Related questions

0 votes
0 answers

We have a multiforest set up. One of the domains is a non hybrid. Whenever a user is created in that domain it gives an error saying- 'Property 'ms-exch-target- ... active Directory schema'. How can we write an exception while adding to that non-hybrid domain?

asked Oct 31, 2022 by Aishwarya Gavali (40 points)
0 votes
1 answer

This would seem like an easy setting since right now, it's causing so much logs because on the main screen, I have a few reports that are custom made and everytime a user ... . Below is a screenshot example of hoe it constantly can fill up the log. Thank You!

asked Jul 31, 2023 by Edogstraus00 (470 points)
0 votes
1 answer

Are the logs still accessable using the "logging" link in the administrator console? What about the web console? What is the recommended setting for local log ... function within ADAXES to cleanup remote logs after they are past our retention requirements?

asked Jul 12, 2023 by stevehalvorson (110 points)
0 votes
1 answer

When using the remove all groups script from your repository. https://www.adaxes.com/script-repository/remove-all-group-memberships-for-a-user-account-s33.htm I need to have adaxes log ... ", "Information") What I get in the log is: What am I doing wrong?

asked Jan 17, 2023 by mightycabal (1.0k points)
0 votes
1 answer

Hello, The report named Inactive users allowed to log in shows the Active Directory sign-in (Last-Logon-Timestamp) and Azure AD sign-in (Last Logon) but only for Active Directory ... updated by an Azure logic App. But we'd love to have this natively in Adaxes.

asked Dec 13, 2022 by Gavin.Raymen (40 points)
3,326 questions
3,025 answers
7,723 comments
544,675 users