From f2fc193f8fdfd40a401c87804173274f972b06f1 Mon Sep 17 00:00:00 2001 From: Chris Thompson <30671833+Mayyhem@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:45:39 -0400 Subject: [PATCH] Update SmsProviderWmi.cs Fix case matching issue --- lib/SmsProviderWmi.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/SmsProviderWmi.cs b/lib/SmsProviderWmi.cs index ab4cc9d..04cadea 100644 --- a/lib/SmsProviderWmi.cs +++ b/lib/SmsProviderWmi.cs @@ -1037,14 +1037,18 @@ public static ManagementObject NewCollectionMember(ManagementScope wmiConnection { foreach (ManagementObject member in collectionMembers) { - if ((!string.IsNullOrEmpty(deviceName) && (string)member.GetPropertyValue("Name") == deviceName) || - (!string.IsNullOrEmpty(userName) && member.GetPropertyValue("Name").ToString().Contains(userName)) || + if ((!string.IsNullOrEmpty(deviceName) && member.GetPropertyValue("Name").ToString().ToLower() == deviceName.ToLower()) || + (!string.IsNullOrEmpty(userName) && member.GetPropertyValue("Name").ToString().ToLower().Contains(userName.ToLower())) || (!string.IsNullOrEmpty(resourceId) && (uint)member.GetPropertyValue("ResourceID") == Convert.ToUInt32(resourceId))) { Console.WriteLine($"[+] Successfully added {matchingResource["Name"]} ({matchingResource["ResourceID"]}) to {(!string.IsNullOrEmpty(collectionName) ? collectionName : collectionId)}"); memberAvailable = true; collectionMember = collectionMembers.Cast().First(); } + else + { + Console.WriteLine($"[+] Member {member.GetPropertyValue("Name").ToString()} did not match the specified resource"); + } } } else