Why can I execute the following code on PowerShell but not on PowerShell (x86) on the same computer?
Get-WmiObject -Namespace "root\Microsoft\SqlServer\ComputerManagement13" -Class ServerSettingsGeneralFlag -Filter "FlagName='ForceEncryption'"
Exception:
At line:1 char:1 + Get-WmiObject -Namespace "root\Microsoft\SqlServer\ComputerManagement ... + CategoryInfo : NotSpecified: (:) [Get-WmiObject], FileNotFoundException + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
function List-WmiNamespaces {Get-WmiObject -Namespace $args[0] -Class '__namespace' | ForEach-Object {$ns = '{0}\{1}' -f $_.__Namespace, $_.Name; $ns; List-WmiNamespaces $ns}}; List-WmiNamespaces 'root\microsoft'
, and the classes in a namespace like this:Get-WmiObject -Namespace 'root\Microsoft\SqlServer' -List | Select-Object -Expand Name
. – Ansgar Wiechers