Hello i wonder why the first command delivers desired output but the second doesn't. is there any technical explanation for this issue?
1st command:
PS C:\>IPConfig | Select-String-Pattern'IPV4'
output: IPv4 Address. . . . . . . . . . . : 10.1.1.1
2nd set of commands:
# none of the following commands generates output !!!!
(Get-WmiObject Win32_OperatingSystem) | Select-String-Pattern'version'
#or
Get-WmiObject Win32_OperatingSystem | Select-String-Pattern'version'
#or
[string]$var=Get-WmiObject win32_operatingSystem
$var | Select-String-Pattern'version'
#or
[Array]$var=Get-WmiObject win32_operatingSystem
$var | Select-String-Pattern'version'
#or
Get-WmiObject Win32_OperatingSystem | Select-String-Pattern'version'
#or
[string]$var=Get-WmiObject win32_operatingSystem
$var | Select-String-Pattern'version'
#or
[Array]$var=Get-WmiObject win32_operatingSystem
$var | Select-String-Pattern'version'
what can be the reason?
( i do know that there are lots of workarounds to achieve that, for example redirecting Get-WmiObject win32_operatingSystem to a text file & the Get-content that text file piped into select string. but i need to know the reason about above examples since the mechanism is the same ! )
thanks in advanced