You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -247,7 +256,7 @@ public string GetPrimaryUser()
247
256
if(!string.IsNullOrEmpty(processId))
248
257
{
249
258
// Now get the process creation date
250
-
usingvarprocessSearcher=newManagementObjectSearcher($@"\\{_computerName}\root\cimv2",$"SELECT CreationDate FROM Win32_Process WHERE ProcessID = '{processId}'");
259
+
usingvarprocessSearcher=newManagementObjectSearcher(GetNamespacePath("root\\cimv2"),$"SELECT CreationDate FROM Win32_Process WHERE ProcessID = '{processId}'");
// Use query like PowerShell: 'SELECT ContentLocation FROM CCM_UpdateSource'
331
-
usingvarsearcher=newManagementObjectSearcher($@"\\{_computerName}\root\ccm\SoftwareUpdates\WUAHandler","SELECT ContentLocation FROM CCM_UpdateSource");
340
+
usingvarsearcher=newManagementObjectSearcher(GetNamespacePath("root\\ccm\\SoftwareUpdates\\WUAHandler"),"SELECT ContentLocation FROM CCM_UpdateSource");
usingvarsearcher=newManagementObjectSearcher($@"\\{_computerName}\root\CCM\SoftMgmtAgent","SELECT * FROM CacheConfig");
356
+
usingvarsearcher=newManagementObjectSearcher(GetNamespacePath("root\\CCM\\SoftMgmtAgent"),"SELECT * FROM CacheConfig");
348
357
usingvarresults=searcher.Get();
349
358
350
359
foreach(ManagementObjectobjinresults)
@@ -484,7 +493,7 @@ private string GetDNSSuffix()
484
493
try
485
494
{
486
495
// Use correct namespace like PowerShell: 'root\ccm\policy\machine\actualconfig'
487
-
usingvarsearcher=newManagementObjectSearcher($@"\\{_computerName}\root\ccm\policy\machine\actualconfig","SELECT * FROM CCM_Logging_GlobalConfiguration");
496
+
usingvarsearcher=newManagementObjectSearcher(GetNamespacePath("root\\ccm\\policy\\machine\\actualconfig"),"SELECT * FROM CCM_Logging_GlobalConfiguration");
0 commit comments