I am running a server inventory script for all networking info and I have this snippet
$keyname = 'HKLM\System\CurrentControlSet\Services\TCPIP\Parameters'
foreach($server in (gc c:\input\bulk.txt)){
$w32reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',$server )
$keypath = 'System\CurrentControlSet\Services\TCPIP\Parameters'
$productKey = $w32reg.OpenSubKey($keypath)
$productVersion = $productKey.GetValue('SearchList')
$server,$productVersion
}
This does fine for screen output but all my attempts to put all the info in an array and output to csv have been failed attempts. I am trying to get 1 col with servername and the second with reginfo from the query.