Suspend notification to manager?
Hi!
Is there a way to automatically notify a suspended users manager with a text saying that the account now is suspended etc etc? Eventually with links to the users home folder and OneDrive site.
Best regards
Niklas
-
Hi Niklas,
To automatically notify a suspended users manager you should add this code into "To" field: $(GetMailPropertyByDn -ObjectDN $FoundObject.manager).
To add a path to a user home folder, use this code: $FoundObject.homeDirectory
Can you please explain, link to OneDrive site - you mean user personal site or the sites list where this user is an owner?
Here is the message example:
{
$managerName = "Manager"
if($FoundObject.manager -ne $Null){
$mgr = Get-ADUser -Identity $FoundObject.manager -Properties * -ErrorAction Ignore
if($mgr -ne $Null){
$managerName = $mgr.DisplayName
}
}$header =
"
Dear $managerName<br/><br/>
This account was suspended: $($FoundObject.givenName) $($FoundObject.sn).<br/><br/>
"$body =
"
User home directory: $($FoundObject.homeDirectory)<br/>
"$message = $header + $body
$message
}.InvokeReturnAsIs()Tatiana
-
Hi, Tatiana!
This solution works very well.
But would it be possible to handle an empty manager attribute in the To: field?
$(GetMailPropertyByDn -ObjectDN $FoundObject.manager)
I get an error when the manager attribute is empty and my colleagues don't think that the Suspend worked for such an account.
Best regards
Niklas
-
Hi Niklas,
You can add to TO field administrator email, for example. In this case, you always will have To field not empty and won't get the error:
$((GetMailPropertyByDn -ObjectDN $FoundObject.manager),"admin@domain.com")
Please let me know if it works for you.
Tatiana
-
Hi Tatiana!
I have an additional question to this case as well. Sorry!
This setup works really well and we use it to send an email to our Helpdesk system that in turn uses the email to create a helpdesk case with a bunch of related escalated child cases.
Now to my question; IF I want to schedule the suspend I need the email to be sent on the date I have scheduled the actual suspend. In short, I want the email to be scheduled as well. Is this possible?
Best regards
Niklas
-
Hi, I just came across this post and I'm trying to accomplish something very similar.
Tatiana Golubovich - in your last post you mentioned this was an enhancement request to allow for a scheduled suspend operation to send this automated email at the time of the suspension-- was that ever taken up/completed? I'm trying to figure out a way enable scheduled suspends and have the email go out to the user's manager at the time the suspension occurs, rather than immediately upon scheduling it.
-
Hi Jesse,
We do not have any specific date for this enhancement request.
This enhancement request will be regularly reviewed for possible inclusion into a future version or product. Due to many factors including the popularity of the request, the complexity of the request, and other business drivers - Cayosoft cannot guarantee this request will be included in any specific product or version.
You can use the tracking number 4547 to check for the feature in our release notes and when you contact Cayosoft about the current status of the request.
Tatiana
-
I just came across this post and it helped me with several things
Tatiana Golubovich I seem to be having an issue with $(GetMailPropertyByDn -ObjectDN $FoundObject.manager). It never returns a value even when I know that they have a manager assigned.
Derek
Please sign in to leave a comment.
Comments
20 comments