Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-CMDB User creates user without SMTP notification (email) #477

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

pwahlmueller
Copy link

@pwahlmueller pwahlmueller commented Oct 16, 2023

  1. Since the SMTP notification was not in all cases unique, I added
    a. the domain
    b. a guid (to be absolute on the safe side)

  2. And I added error handling in case, somthing still fails.

Here in addition the scenario, which fails:

  1. Send email with patrick@mydomain.com which is not yet in CMDB -> notification newid gets patrick_SMTP
  2. Send email with patrick@myNEWdomain.com which is not yet in CMDB ->notification newid gets patrick_SMTP -> fails adding notification

@pwahlmueller pwahlmueller changed the title # Id should be unique New-CMDB User creates user without SMTP notification (email) Oct 16, 2023
@AdhocAdam AdhocAdam changed the base branch from primary to dev October 22, 2023 18:55
@AdhocAdam AdhocAdam self-assigned this Nov 6, 2023
@AdhocAdam AdhocAdam added this to the ??? milestone Nov 6, 2023
@AdhocAdam
Copy link
Owner

I feel like you are onto something here by forcing the ID to be unique with a GUID. But the thing is, I can't reproduce the scenario you're referring to above as the ID I'm seeing is still unique with the domain name + username.

I copied the New-CMDBUser function out, introduced a Write-Host for the $newID variable, and then ran it with both examples. In which case, that arguably becomes a question of "how is the email not being found which leads to incorrectly calling New-CMDBUser." I'm genuinely not sure if that's the issue as this whole thing has been hard to pin down. The last thing I recall in this space was the update made to Get-SCSMUserByEmailAddress wherein SMLets was incorrectly evaluating hyphens in email addresses.

result

In any case, the only way I can produce an error is if I don't delete those users from SCSM, and then run the example again. In which case, duplicate users are created with empty Notification Channels.

Note: Ignore the Problems 1 in the above screenshot. I have a few things open 😄

@pwahlmueller
Copy link
Author

pwahlmueller commented Dec 1, 2023

You are completly right, the id would be unique with domain name + username.
But in the actual script only the username was used, which causes the issue.
I wonder that you can add both users with the actual script - could you?
The main reason to add the guid was, that I'm absolut sure the id will be unique in the prod env of the customer.

But I can do a script in my test environment to double check it and provide it here, if this helps.

@AdhocAdam
Copy link
Owner

But in the actual script only the username was used, which causes the issue

Are you referring to the following line in New-CMDBUser? or somewhere else?

https://github.com/AdhocAdam/smletsexchangeconnector/blob/02be0b1aed028647848c982e19ae5779c7596822/smletsExchangeConnector.ps1#L2916C9-L2916C209

I wonder that you can add both users with the actual script - could you?

Sure. So add the two users via script and then?

The main reason to add the guid was, that I'm absolut sure the id will be unique in the prod env of the customer.
But I can do a script in my test environment to double check it and provide it here, if this helps.

Like I said, I am strongly inclined to agree with you here on this change. I just want to see it for myself is all 😁 but if you can validate that's helpful as well 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants