Add Get-CimInstance

Get-WmiObject is deprecated from powershell 3.0+
Commented out Get-WmiObject
Added Get-CimInstance
This commit is contained in:
Ultimate Luki 2020-04-06 14:32:55 +02:00 committed by GitHub
parent 744a9f997f
commit bc3603bf76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}
}
}
}