In many scenario as an administrator task you want to know the
registry value from remote machine users in same network. Power Shell gave you
many way to get that value without disturbing
to users.
I like this logic to get that registry value from multiple machine.
And you can print those value in log file.
So here is the power shell script logic.
Please declare the remote machine name in this text file "C:\Temp\RegInfo.txt"
"C:\Temp\PS-Ping\Registry.log " file will give you all the remote machine registry info.
##################################Save Script As .PS1 ##############################
$ServerName = Get-Content "C:\Temp\RegInfo.txt"
foreach ($Server in $ServerName)
{
if (test-Connection -ComputerName $Server -Count 2 -Quiet )
{
"$Server is Pinging"
$SregistryInfo = Invoke-command -computer $Server {Get-ItemProperty -Path "HKLM:\HARDWARE\DESCRIPTION\System\BIOS\" | select SystemVersion} | Add-Content "C:\Temp\PS-Ping\Registry.log"
Write-host $SregistryInfo
Write-host $Server
#Invoke-command -computer BLR-P-CMSS01 {Get-ItemProperty HKLM:\Software\1E\NomadBranch\ | select SpecialNetShare,SigsFolder}
}
Else
{
"$Server not pinging"
}
}
foreach ($Server in $ServerName)
{
if (test-Connection -ComputerName $Server -Count 2 -Quiet )
{
"$Server is Pinging"
$SregistryInfo = Invoke-command -computer $Server {Get-ItemProperty -Path "HKLM:\HARDWARE\DESCRIPTION\System\BIOS\" | select SystemVersion} | Add-Content "C:\Temp\PS-Ping\Registry.log"
Write-host $SregistryInfo
Write-host $Server
#Invoke-command -computer BLR-P-CMSS01 {Get-ItemProperty HKLM:\Software\1E\NomadBranch\ | select SpecialNetShare,SigsFolder}
}
Else
{
"$Server not pinging"
}
}
#################################################################################
Note:- Please test script in your test environment before running in production directly.
No comments:
Post a Comment