Hello,
I'm new to powershell and I'm trying to write a script that gets installed apps from registry (32 and 64) and print them with hostname:
$hostname = Read-Host "Enter WK name:" cls Invoke-Command -cn $hostname -ScriptBlock { Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName,DisplayVersion,InstallDate | ft } Invoke-Command -cn $hostname -ScriptBlock { Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName,DisplayVersion,InstallDate | ft -HideTableHeaders }
I can't print the machine name because it's not present on the registry key, I've tried using the code bellow but no success:
@{label="MachineName";Expression={$hostname}}
Can you guys help me?