static void PrintTranscriptPS() { try { Beaprint.MainPrint("PS default transcripts history"); Beaprint.InfoPrint("Read the PS history inside these files (if any)"); string drive = Path.GetPathRoot(Environment.SystemDirectory); string transcriptsPath = drive + @"transcripts\"; string usersPath = $"{drive}users"; var users = Directory.EnumerateDirectories(usersPath, "*", SearchOption.TopDirectoryOnly); string powershellTranscriptFilter = "powershell_transcript*"; var colors = new Dictionary <string, string>() { { "^.*", Beaprint.ansi_color_bad }, }; var results = new List <string>(); var dict = new Dictionary <string, string>() { // check \\transcripts\ folder { transcriptsPath, "*" }, }; foreach (var user in users) { // check the users directories dict.Add($"{user}\\Documents", powershellTranscriptFilter); } foreach (var kvp in dict) { var path = kvp.Key; var filter = kvp.Value; if (Directory.Exists(path)) { try { var files = Directory.EnumerateFiles(path, filter, SearchOption.TopDirectoryOnly).ToList(); foreach (var file in files) { var fileInfo = new FileInfo(file); var humanReadableSize = MyUtils.ConvertBytesToHumanReadable(fileInfo.Length); var item = $"[{humanReadableSize}] - {file}"; results.Add(item); } } catch (UnauthorizedAccessException) { } catch (PathTooLongException) { } catch (DirectoryNotFoundException) { } } } if (results.Count > 0) { Beaprint.ListPrint(results, colors); } } catch (Exception ex) { Beaprint.PrintException(ex.Message); } }