Skip to content

Logging

Søren Granfeldt edited this page Mar 27, 2024 · 4 revisions

Using PowerShell Management Agent logging

Build 5.5.3508 and later

The PS MA extensively utilizes tracing throughout the code. You can get at this information using DebugView. When writing, configuring and testing scripts, you can use a tool like DebugView to catch tracing information from this MA.

TIP - for a more readable trace log in DebugView, you should remove the checkmark at "Force Carriage Returns" under Options in DebugView.

Other errors and script errors that are not caught by the MA and the logging mechanics can also be found in the Application Event Log.

To send general output from PSMA scripts to the Windows Application Event log, see this example.

Earlier versions

You can redirect logging information to a file. Create and specify the following registry key to set the file name for debugging information.

  • Registry Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Granfeldt\FIM\ManagementAgents\PowerShell
  • Key name (type REG_SZ): DebugLogFilename
  • Value: , for example C:\Temp\PSMA-{0:ddd}.log

Also, you can use date time format string to have multiple log files created, i.e. if you want a new log file to be started every day, you could specify the value of DebugLogFilename as C:\Temp\PSMA-{0:ddd}. For more information of specifying date formats, please refer to this article http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx. Make sure that you construct the date time format in a way that is a valid file name. If the registry key is not present, no log file will be created.

Other errors and script errors that are not caught by the MA and the logging mechanics can be found in the Application Event Log.

Clone this wiki locally