Skip to content

Commit

Permalink
Improved criteria check for Reset Machines method
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyts committed Sep 24, 2020
1 parent 50c7838 commit 60fa626
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions SelfServiceSessionReset/Controllers/CtxSessionController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Version 1.4
// Version 1.5
// Written by Jeremy Saunders ([email protected]) 13th June 2020
// Modified by Jeremy Saunders ([email protected]) 11th September 2020
// Modified by Jeremy Saunders ([email protected]) 24th September 2020
//
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -777,14 +777,16 @@ public IHttpActionResult RestartMachinesByMachineName([FromBody]CtxSessionsToAct
string username = GetLoggedOnUser();
string[] machinearray = restartinfo.MachineNames.ToArray();
string result = string.Empty;
// Create a new array by verifying that each machine meets the following criteria.
// Create a new array by verifying that each machine meets the following criteria.
// - OSType contains Windows
// AND
// - OSType does not contain 20 for Windows 2008 R2, 2012 R2, 2016, 2019, etc
// AND
// - SessionSupport must be SingleSession
List<string> CriteriaMetList = new List<string>();
foreach (string machinename in machinearray)
{
CtxSession[] sessionArray = GetCurrentSessions(sitename, deliverycontroller, username).Where<CtxSession>(c => c.MachineName.Contains(machinename) && !c.OSType.Contains("20") && c.SessionSupport == "SingleSession").ToArray<CtxSession>();
CtxSession[] sessionArray = GetCurrentSessions(sitename, deliverycontroller, username).Where<CtxSession>(c => c.MachineName.Contains(machinename) && c.OSType.Contains("Windows") && !c.OSType.Contains("20") && c.SessionSupport == "SingleSession").ToArray<CtxSession>();
if (sessionArray.Length == 1)
{
CriteriaMetList.Add(machinename);
Expand Down

0 comments on commit 60fa626

Please sign in to comment.