Monitor-ADGroupMembership icon indicating copy to clipboard operation
Monitor-ADGroupMembership copied to clipboard

Failure during email generation

Open CTDhelpdesk opened this issue 4 years ago • 6 comments

Using the latest revision of the script, I get this error when it gets to the point of actually creating / sending the email:

C:\Scripts\Backend\ChangeHistory\example.org_Administrators-ChangeHistory.csv VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] Administrators - Change History Process Completed VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] Administrators - Save Changes to a ChangesHistory File VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] Administrators - Preparing the notification email... WARNING: [Monitor-ADGroupMemberShip.ps1][Process] Something went wrong WARNING: Object reference not set to an instance of an object. VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] Group: CSAdministrator... VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] Active Directory Module VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] Extracting Domain Name from example.org/Users/CSAdministrator VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] Group: CSAdministrator - Querying Membership (AD Module) VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] CSAdministrator - The following file exists: example.org_CSAdministrator-membership.csv VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] CSAdministrator - Comparing Current and Before VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] CSAdministrator - Compare Block Done! VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] CSAdministrator - No Change VERBOSE: [Monitor-ADGroupMemberShip.ps1][End] Script Completed

Not sure what Object Reference not set to an instance of an object means...

Love the script though, thanks for all your hard work!

CTDhelpdesk avatar Feb 02 '21 23:02 CTDhelpdesk

Same issue for us, mail server paramters are fine and tested via telnet.

Kofl avatar Feb 05 '21 14:02 Kofl

for me when i manually try to execute script, it prompt for port number. Once enter the port number get same error

VERBOSE: [Monitor-ADGroupMemberShip.ps1][Process] Administrators - Preparing the notification email... WARNING: [Monitor-ADGroupMemberShip.ps1][Process] Something went wrong

Please help here

gvndverma787 avatar Feb 11 '21 07:02 gvndverma787

Did anyone already solved this issue? I also have the same problem:

VERBOSE: [Monitor-ADGroupMembership.ps1][Process] Domain Admins - Preparing the notification email...
WARNING: [Monitor-ADGroupMembership.ps1][Process] Something went wrong
WARNING: Object reference not set to an instance of an object.
VERBOSE: [Monitor-ADGroupMembership.ps1][Process] Group: Enterprise Admins...

This is when i start the script manually with "-EmailPort 25" is added as parameter.

Raffytje avatar Mar 01 '21 11:03 Raffytje

Nope. With some deeper debugging it worked out, if I only specified on group to monitor. But as soon as the group had none member, the error came back.

Kofl avatar Mar 01 '21 11:03 Kofl

I have the same issue with version 2.0.7 Using version 2.0.3 as work around. https://www.powershellgallery.com/packages/Monitor-ADGroupMemberShip/2.0.3.0/Content/Monitor-ADGroupMemberShip.ps1

tyrfa avatar Mar 01 '21 14:03 tyrfa

Just in case this was your problem... I'm using a slightly older SMTP server and am NOT sending out of house. The SMTP server doesn't support SSL so there were 2 lines in the file of: Send-MailMessage @mailParam -UseSsl -BodyAsHtml I remmed them out and changed to
Send-MailMessage @mailParam -BodyAsHtml All good now on that front. BUT, SSL should really be used from a security standpoint!

searnhardt avatar Dec 31 '21 15:12 searnhardt