Thursday, June 7, 2018
Get regkey value on a batch of computers remotely.
Here's a Powershell script I created to get value in the registry on a batch of computers remotely. Very handy if you have many computers to check. Will output 'Offline' if the computer is turned off.
$strMachineName = Get-Content computer_name.txt
foreach ($line in $strMachineName)
{
try{
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $line)
$regkey = $reg.OpenSubkey("<registry path>")
$serialkey = $regkey.GetValue("LicenseInformation")
if ($serialkey -eq ""){
write-host $line
}
}
catch{
write-host $line ----- "Offline"
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Thank you for your comment.