When I was developing the code to define an initial password for new accounts that were due to be provisioned, I needed a way of seeing the password string that was generated.
I found it quite difficult to pick through the documentation around the subject (logging) in order to get this working, so have provided a generic example below.
I ended up using the logging dll throughout the project, to record certain anomalies.
The log will be written to the MAData folder of the MA that the code resides in. The documentation states that the file location can be changed, but I never got it to work. I’m happy with the default it is written to anyway.
Note that you need to add the logging dll to the project before you make use of it:
'Within the "Public Class MAExtensionObject" section, add:
'Date & Logginglevel variables for logging files:
Dim dtDateNowDay As Integer = Date.Now.Day
Dim dtDateNowMonth As Integer = Date.Now.Month
Dim dtDateNowYear As Integer = Date.Now.Year
Dim loggingLevel As Integer = 0
'With the Sub or Function that you want logging - e.g. "Public Sub MapAttributesForImport"
Dim dtFileTime As DateTime
'Define Logfile Name then setup the logfile
Dim logFileName As String = dtDateNowDay & "-" & dtDateNowMonth & "-" & dtDateNowYear & "_MyMA_Import.log"
'Within a sync rule, where you want to log something - e.g. what the UPN is going to be set to:
Logging.Log("Some informational string," & csentry("samAccountName").Value & ",UPN," & csentry("mail").Value, True, 0)