# adjust this to a remote computer of your choice # (or multiple computers, comma-separated) # PowerShell remoting needs to be enabled on that computer # and you need to have local Admin privileges on that computer $ComputerName = 'pc01'
# execute this code remotely on the machine(s) $code = { # read the given registry value... Get-ItemProperty-Path hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | # and show the reg values with the names below Select-Object DisplayName, DisplayVersion, UninstallString }
# "beam" the code over to the target computer(s), and retrieve # the result, then show it in a grid view window Invoke-Command-ScriptBlock$code-ComputerName$ComputerName | Out-GridView
$ComputerName = 'pc01' # NOTE: RemoteRegistry Service needs to run on a target system! $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName) $key = $reg.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall')
$key.GetSubKeyNames() | ForEach-Object { $subkey = $key.OpenSubKey($_) [PSCustomObject]@{ Name = $subkey.GetValue(‘DisplayName’) Version = $subkey.GetValue(‘DisplayVersion’) } $subkey.Close() }
# this is where the PowerShell operational log stores its settings $Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\winevt\Channels\Microsoft-Windows-PowerShell/Operational"
# get the default SDDL security definition for the classic security log $sddlSecurity = ((wevtutil gl security) -like'channelAccess*').Split(' ')[-1]
# get the current SDDL security for the PowerShell log $sddlPowerShell = (Get-ItemProperty-Path$Path).ChannelAccess
# store the current SDDL security (just in case you want to restore it later) $existsBackup = Test-Path-Path$Path if (!$existsBackup) { Set-ItemProperty-Path$Path-Name ChannelAccessBackup -Value$sddlPowerShell }
# set the hardened security to the PowerShell operational log Set-ItemProperty-Path$Path-Name ChannelAccess -Value$sddlSecurity
# restart the service to take effect Restart-Service-Name EventLog -Force