From bc3603bf762bae8f69d5533819dfd72f5b5a03eb Mon Sep 17 00:00:00 2001 From: Ultimate Luki Date: Mon, 6 Apr 2020 14:32:55 +0200 Subject: [PATCH] Add Get-CimInstance Get-WmiObject is deprecated from powershell 3.0+ Commented out Get-WmiObject Added Get-CimInstance --- WmiExplorer/WmiExplorer.Functions.Designer.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/WmiExplorer/WmiExplorer.Functions.Designer.cs b/WmiExplorer/WmiExplorer.Functions.Designer.cs index 9b8ccd8..bf30b0f 100644 --- a/WmiExplorer/WmiExplorer.Functions.Designer.cs +++ b/WmiExplorer/WmiExplorer.Functions.Designer.cs @@ -1217,8 +1217,14 @@ namespace WmiExplorer script.Append("Write-Output \"CLASS : $classname \"").AppendLine(); script.Append("Write-Output \"=====================================\"").AppendLine(); script.AppendLine(); - script.Append("Get-WmiObject -Class $classname -ComputerName $computer -Namespace $namespace |").AppendLine(); - script.Append(" Select-Object * -ExcludeProperty PSComputerName, Scope, Path, Options, ClassPath, Properties, SystemProperties, Qualifiers, Site, Container |").AppendLine(); + script.Append("# Powershell 2.0+ Deprecated from 3.0+").AppendLine(); + script.Append("# Get-WmiObject -Class $classname -ComputerName $computer -Namespace $namespace |").AppendLine(); + script.Append("# Select-Object * -ExcludeProperty PSComputerName, Scope, Path, Options, ClassPath, Properties, SystemProperties, Qualifiers, Site, Container |").AppendLine(); + script.Append("# Format-List -Property [a-z]*").AppendLine(); + script.AppendLine(); + script.Append("# Powershell 3.0+").AppendLine(); + script.Append("Get-CimInstance -ClassName $classname -ComputerName $computer -Namespace $namespace |").AppendLine(); + script.Append(" Select-Object * -ExcludeProperty PSComputerName, PSShowComputerName, CimClass, CimInstanceProperties, CimInstanceProperties, CimSystemProperties |").AppendLine(); script.Append(" Format-List -Property [a-z]*").AppendLine(); textBoxScript.Text = script.ToString(); @@ -2779,4 +2785,4 @@ namespace WmiExplorer toolStripLabelUpdateNotification.Tag = bUpdateAvailable; } } -} \ No newline at end of file +}