locked
AD Computer Registry Search RRS feed

  • Question

  • Hi,

    I'm trying to search the registry of all the computers in my domain for a specific string and return the values in a CSV file with "Computer Name" & "Serial." with the following and can't seem to get it working:

    get-adcomputer | select dnshostname | get-ItemProperty -path HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PKWARE\SN\0x9E0 -name "serial"
    out-File serial.csv -append

    Any help works

    ty

    Michael

    Wednesday, October 17, 2018 9:09 PM

All replies

  • Get-ItemProperty can only search the local system.

    I suggest first learning basic PowerShell before guessing.

    Look in the Gallery for scripts that can search the registry.


    \_(ツ)_/

    Wednesday, October 17, 2018 10:09 PM
  • Welcome to the Windows Powershell forum.
    Please format your code as code here in the forum. Use the according buttons provided in the edit bar of the post editor.

    You will have to create a foreach loop to "access" the remote computers like this:

    Get-ADComputer | 
    Select-Object -Property dnshostname | 
        ForEach-Object {
            Invoke-Command -ComputerName $_.dnshostname {Get-ItemProperty -Path 'HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PKWARE\SN\0x9E0' -Name 'serial'} |
                Export-Csv -Path serial.csv -Append
        }

    (untested)
    If you want to create a CSV file you should use Export-CSV instead of Out-File.Of course you should be aware of that not all computers will be available for remote access .... so you should either test before or add some kind of error handling.

    You might do a little step back and start with learning the very basics of Powershell. I'm sure it will pay off for you in the future.


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''



    Wednesday, October 17, 2018 10:10 PM
  • Hi Micheal,

    Thanks for your question.

    I agree with Jrv and Bofh.

    "Foreach-object", "Export-Csv" cmdlets can help you solve your problem.

    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/foreach-object?view=powershell-6

    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-csv?view=powershell-6

    Also you can download PSRemoteRegistry module to help you.

    Import-Module PSRemoteRegistry
    Get-RegValue -ComputerName $Computer1 -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PKWARE\SN\0x9E0' -Name 'serial'

    Best Regards,

    Lee


    Just do it.

    Thursday, October 18, 2018 2:48 AM
  • Thank you...
    Thursday, October 18, 2018 1:57 PM
  • Thank you...this is a better start
    Thursday, October 18, 2018 1:57 PM
  • Thank you
    Thursday, October 18, 2018 1:59 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    Best Regards,

    Lee



    Just do it.

    Wednesday, November 7, 2018 7:48 AM