Var tmpInfo: String; Const ctOutputCsv = 'C:\Test\RuleList.csv'; Begin psExitCode:= 0; // ... add your code here (* Function psExportRuleDataAsCSV(Const aFile, aData, aDelimiter: String): String; aFile = Output Csv file, e.g. 'C:\Temp\RuleList.csv' aData = a ; seperated list of items you want to add ( When empty string we'll use '1;2;3;4' ) 1 = RuleID 2 = DisplayName 3 = Source 4 = Destination 7 = Information aDelimiter = csv delimiter used in the csv outputfile *) // Export to CSV tmpInfo := psExportRuleDataAsCSV(ctOutputCsv, '1;2;3;4', ','); // Debug If tmpInfo = '' Then Begin psExitCode := 1; psLogWriteStr('Successful export or Rules to: ' + ctOutputCsv); End Else psLogWriteStr('Error during export or Rules to: ' + ctOutputCsv + ', Info: ' + tmpInfo); End.