powershell - Remote Registry List of PCs -


i trying remote registry values oeminformation key list of computers, cant seem work. error:

exception calling "openremotebasekey" "2" argument(s): "the network path not found"

what missing?

$strmachinename = import-csv c:\temp\pcs.txt foreach ($line in $strmachinename) {     try {         $reg = [microsoft.win32.registrykey]::openremotebasekey('localmachine', $computer) $regkey=$reg.opensubkey('software\microsoft\windows\currentversion\oeminformation')  'model:{0}  manufactured by:"{1}"' -f $regkey.getvalue('model'),$regkey.getvalue('manufacturer')  }     catch{            write-host "$_"  -fore red      }  } $results|export-csv c:\temp\pcs-results.csv -notype 

the $computer-variable referring in following line, doesn't exist.

[microsoft.win32.registrykey]::openremotebasekey('localmachine', $computer) 

does content of txt-file have header? ex:

computer machine1 machine2 

then try

[microsoft.win32.registrykey]::openremotebasekey('localmachine', $line.computer) 

if txt-file contains 1 machinename per line , no headers, replace import-csv get-content , try

[microsoft.win32.registrykey]::openremotebasekey('localmachine', $line) 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -