Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Get-CimInstance for Array of Computer Objects

$
0
0

Hi Folks,

Relatively new to PowerShell and am most of the way through Ed Wilson's 'First Steps' book. I'm attempting to use Get-CimInstance; I expect I'm doing something that's very blatantly wrong.

I've used Get-ADComputer to get several computer objects which I've placed into an array called $itcomputers. I'd like to see the InstallDate from win32_bios for all of these computers. When typing in the names manually, it works fine, but when it's supplied with the variable to -ComputerName I'm shown an error.

Even changing the objects to string using Out-String doesn't seem to work. Do you have any thoughts on what I'm doing wrong? I expect perhaps I'm just simply going the wrong way about getting this cimcmdlet to get the information from an array. In regards to the below script, $itcomputers is populated at this stage already.

foreach ($computer in $itcomputers)
{
    Get-CimInstance -ClassName win32_bios -Property InstallDate -ComputerName $computer
}

The error says the below, with the Distinguished Name as the value:

Get-CimInstance : WS-Management could not connect to the specified destination:

Many thanks.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>