1 00:00:02,340 --> 00:00:04,330 Once Inbox Accounting has been enabled, 2 00:00:04,330 --> 00:00:09,530 it's really crucial that we perform some maintenance tasks right off the bat. 3 00:00:09,530 --> 00:00:14,420 To begin, we need to run the command, Optimize‑InboxAccountingDatabase. 4 00:00:14,420 --> 00:00:21,990 Running this command simply makes a change to the database that is helpful for, 5 00:00:21,990 --> 00:00:23,660 usually for busier deployments, 6 00:00:23,660 --> 00:00:27,080 but I like to do this on all deployments just for good measure. 7 00:00:27,080 --> 00:00:29,440 Essentially, the Inbox Accounting database, 8 00:00:29,440 --> 00:00:31,750 as I'd mentioned before, is a SQL database. 9 00:00:31,750 --> 00:00:37,090 It's actually missing a crucial index on one of the tables that can 10 00:00:37,090 --> 00:00:40,480 cause performance issues and memory‑consumption issues, 11 00:00:40,480 --> 00:00:43,570 and also high CPU‑utilization issues. 12 00:00:43,570 --> 00:00:45,630 This command, Optimize‑InboxAccountingDatabase, 13 00:00:45,630 --> 00:00:48,890 adds that index back to that table, 14 00:00:48,890 --> 00:00:51,450 and then you won't have this problem in the future. 15 00:00:51,450 --> 00:00:52,080 By the way, 16 00:00:52,080 --> 00:00:56,270 this affects, all versions of Windows all the way back to Windows Server 2012, 17 00:00:56,270 --> 00:00:58,640 all the way through Windows Server 2022, 18 00:00:58,640 --> 00:01:02,640 this is still a problem, and so if you're going to enable Inbox Accounting, 19 00:01:02,640 --> 00:01:05,160 I would strongly encourage you to run this command so that 20 00:01:05,160 --> 00:01:07,030 you don't have those challenges and issues. 21 00:01:07,030 --> 00:01:09,300 So a couple of other commands that I want to point out, 22 00:01:09,300 --> 00:01:11,690 you can actually view the size of the database by 23 00:01:11,690 --> 00:01:13,930 running Get‑InboxAccountingDatabaseSize, 24 00:01:13,930 --> 00:01:19,630 and here, you'll see that the default is about 12+MB. 25 00:01:19,630 --> 00:01:22,880 Now, again, this database contains no data, 26 00:01:22,880 --> 00:01:28,500 but you'll notice that if I run the Compress‑InboxAccountingDatabase command, 27 00:01:28,500 --> 00:01:33,500 immediately, I recover nearly 10MB, 9MB of data here. 28 00:01:33,500 --> 00:01:37,350 So you can see that this database is terribly inefficient. 29 00:01:37,350 --> 00:01:41,470 This command, I would encourage you to run on a regular basis, 30 00:01:41,470 --> 00:01:43,310 probably run it as a scheduled task. 31 00:01:43,310 --> 00:01:43,880 That way, 32 00:01:43,880 --> 00:01:46,520 you know that your database is always consuming the 33 00:01:46,520 --> 00:01:50,040 least amount of disk space possible. 34 00:01:50,040 --> 00:01:53,310 The next command I want to demonstrate is actually backing up the database. 35 00:01:53,310 --> 00:01:56,820 So we want to do this periodically as well because if we lose a server, 36 00:01:56,820 --> 00:01:59,630 we don't want to lose this valuable user activity 37 00:01:59,630 --> 00:02:01,280 data that we've been recording. 38 00:02:01,280 --> 00:02:04,030 The command to do that is just simply 39 00:02:04,030 --> 00:02:09,000 Backup‑InboxAccountingDatabase. And when you run this command by default, 40 00:02:09,000 --> 00:02:18,310 it just places it in the default folder of C:\Windows\DirectAccess\db\. 41 00:02:18,310 --> 00:02:27,190 And there, you see our file backup. 42 00:02:27,190 --> 00:02:29,160 Also to better demonstrate reporting, 43 00:02:29,160 --> 00:02:33,380 I'm going to import a database that has more user data in it. 44 00:02:33,380 --> 00:02:37,140 So we'll run the command, Restore‑InboxAccountingDatabase, 45 00:02:37,140 --> 00:02:43,710 and we'll specify the backup file. 46 00:02:43,710 --> 00:02:47,700 And then once that's complete, 47 00:02:47,700 --> 00:02:51,240 I should be able to generate a report for historical data. 48 00:02:51,240 --> 00:02:54,740 So I'm going to set my start date to something a little bit older. 49 00:02:54,740 --> 00:02:56,790 Let's go back to February or so. 50 00:02:56,790 --> 00:03:00,150 Let's see who was accessing for the month of February. 51 00:03:00,150 --> 00:03:06,540 So I'll choose that and the 28, so from the 1st to the 28th. 52 00:03:06,540 --> 00:03:08,340 We'll click Generate, and here, 53 00:03:08,340 --> 00:03:12,200 you'll see I have all kinds of data in this database. 54 00:03:12,200 --> 00:03:14,630 Now, this is my lab so it's not really exciting. 55 00:03:14,630 --> 00:03:18,470 There are only one or two different users in here, but you get the idea. 56 00:03:18,470 --> 00:03:22,900 I can go back and look at a connection and see historical data, 57 00:03:22,900 --> 00:03:26,370 so what was the user accessing, who was the user, 58 00:03:26,370 --> 00:03:27,270 and various information. 59 00:03:27,270 --> 00:03:31,870 And once again, much like I demonstrated in the previous lesson, 60 00:03:31,870 --> 00:03:33,880 you can add and remove columns here. 61 00:03:33,880 --> 00:03:37,990 So you can always regain some space by taking some columns that 62 00:03:37,990 --> 00:03:41,850 you don't need and adding more important information for 63 00:03:41,850 --> 00:03:43,930 columns that you do want to display. 64 00:03:43,930 --> 00:03:46,350 One of the things that I like about this as well is 65 00:03:46,350 --> 00:03:50,840 that you can also do a search, and the search is actually on the reported data. 66 00:03:50,840 --> 00:03:53,720 So I've generated a report for this month of February, 67 00:03:53,720 --> 00:03:58,900 and I want to see all the users who are Rick Deckard here, 68 00:03:58,900 --> 00:04:02,350 and so then I can hit Enter and see all of the 69 00:04:02,350 --> 00:04:04,600 sessions that this user had generated. 70 00:04:04,600 --> 00:04:08,300 And again, I can see detailed information down here in the lower panes, 71 00:04:08,300 --> 00:04:12,300 or I can double‑click on a connection and gather this information as well. 72 00:04:12,300 --> 00:04:13,160 So as you saw, 73 00:04:13,160 --> 00:04:17,500 the default location for the DirectAccess database is in on the C:\ drive, 74 00:04:17,500 --> 00:04:20,930 so that's probably okay for smaller deployments, 75 00:04:20,930 --> 00:04:24,290 but if you're expecting a lot of concurrent connections, 76 00:04:24,290 --> 00:04:28,470 a lot of sessions, and you want to store data for extended periods of time, 77 00:04:28,470 --> 00:04:32,460 perhaps having the database on the C:\ drive is less than ideal. 78 00:04:32,460 --> 00:04:37,180 Now, as I'd mentioned before, we can relocate the database using my tools, 79 00:04:37,180 --> 00:04:41,840 but it is not formally supported by Microsoft so once again use caution here. 80 00:04:41,840 --> 00:04:46,030 Now, what I'm going to do is just run the command, Move‑InboxAccountingDatabase. 81 00:04:46,030 --> 00:04:51,370 The source path does not have to be specified because by default, 82 00:04:51,370 --> 00:04:54,800 it will find the original files in the original location. 83 00:04:54,800 --> 00:04:56,510 So if this is the first time you're moving it, 84 00:04:56,510 --> 00:04:57,940 it's going to be in the default location, 85 00:04:57,940 --> 00:05:02,770 so you don't need ‑SourcePath, but you do have to specify a destination path. 86 00:05:02,770 --> 00:05:03,510 And in this case, 87 00:05:03,510 --> 00:05:06,180 I'm going to put it on the D:\ drive, and I'm going to use the 88 00:05:06,180 --> 00:05:13,240 same folder structure as we use on the C:\ drive. 89 00:05:13,240 --> 00:05:14,340 Once that's done, 90 00:05:14,340 --> 00:05:18,610 my database has been moved to the D volume, and of course, now I'm going to 91 00:05:18,610 --> 00:05:31,000 have better performance and obviously have much more disk space so that I can increase my storage times if I need to do that.