| 1 | # SessionSettings |
| 2 | |
| 3 | Configures a session before `Session.Start()`. |
| 4 | |
| 5 | ```csharp |
| 6 | public sealed class SessionSettings |
| 7 | { |
| 8 | public SessionSettings(string name, string storagePath); |
| 9 | |
| 10 | public string Name { get; set; } |
| 11 | public string StoragePath { get; set; } |
| 12 | public uint? CpuCount { get; set; } |
| 13 | public uint? MemorySizeInMB { get; set; } |
| 14 | public TimeSpan? Timeout { get; set; } |
| 15 | public VhdOptions VhdRequirements { get; set; } |
| 16 | public bool EnableGpu { get; set; } |
| 17 | } |
| 18 | ``` |
| 19 | |
| 20 | Notes: |
| 21 | |
| 22 | - `Name` is the name of the session to be created. |
| 23 | - `StoragePath` is the path to where the session storage should be written. If the path doesn't exist, it will be created. |
| 24 | - `CpuCount`, `MemorySizeInMB`, and `Timeout` are optional nullable values. |
| 25 | - `Timeout` must be positive and must fit in a `uint32` millisecond count. |
| 26 | - `VhdRequirements` is optional. |
| 27 | |
| 28 | Session names serve both as display names and as machine-wide keys used to identify sessions. If a session with the same name already exists, session creation will fail with `ERROR_ALREADY_EXISTS`. |
| 29 | |
| 30 | Also note that the following information about a session is visible to all users on the machine: |
| 31 | |
| 32 | - The session's name |
| 33 | - The SID of the user that created the session |
| 34 | - The PID of the process that created the session |
| 35 | |
| 36 | Do not put credentials or other sensitive information in the session's name. |
| 37 | |
| 38 | Example: |
| 39 | |
| 40 | ```csharp |
| 41 | var sessionSettings = new SessionSettings("demo-session", @"C:\WslcData") |
| 42 | { |
| 43 | CpuCount = 4, |
| 44 | MemorySizeInMB = 4096, |
| 45 | Timeout = TimeSpan.FromMinutes(5), |
| 46 | EnableGpu = true |
| 47 | }; |
| 48 | ``` |