reading registry values on remote servers using a list of servers in PowerShell

Petr Dymacek 21 Reputation points
2021-01-13T19:17:40.257+00:00

I am a newbie to PowerShell and I need some help in writing a script. I have found out how to get the registry values from remote servers by the following reg query command:
reg query \servername\HKLM\SYSTEM\CurrentControlSet\Services\Disk

What I would like to do is the following:
Setup a server.txt file that I can populate with the names of remote servers I need to query the registry on from my laptop. Next I would like to read registry values for TimeOutValue that will display on the screen for different servers. I know this is probably elementary to the experts, but I would really appreciate any assistance.

Thank you

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 47,901 Reputation points
    2021-01-13T20:10:35.207+00:00

    If you're going to do this on multiple computers you might as well do it on a bunch of them at a time! Something like this:

    Invoke-Command -Computer (get-content c:\junk\servers.txt) -ScriptBlock {Get-ItemProperty -Path: HKLM:SYSTEM\CurrentControlSet\Services\Disk -Name TimeOutValue}
    

    The plain-text file "servers.txt" would hold the name of each server on a separate line.

    If you'll take a suggestion you won't regret, read this (it's downloadable and it's free): Windows-PowerShell-4


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.