Invoke-Command -cn fredray2 -ScriptBlock {Get-ItemProperty HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | select DisplayName, DisplayVersion }
$computers =get-adcomputer -filter * | Select-Object dnshostname
foreach($computer in $computers) {
$testcomputer = $computer.dnshostname
if(Test-NetConnection -ComputerName $testcomputer -InformationLevel Quiet ) {
write-host ("$testcomputer is Alive")
#
# insert your invoke command here
#
}
else{
write-host ("$testcomputer is not responding" ) -ForegroundColor Yellow -BackgroundColor Black
}
}
ASKER
Invoke-Command -cn $testcomputer -ScriptBlock {Get-ItemProperty HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | select-Object DisplayName, DisplayVersion | Where-Object displayName -like "*GOLD*" | Sort-Object -Property displayname}
The actual Registry content in the referenced Uninstall list has DisplayName and DisplayVersion appearing in this order:ASKER
Get-ADComputer -Filter 'operatingsystem -notlike "*server*" -and enabled -eq "true"' `
-Properties Name,Operatingsystem,OperatingSystemVersion,IPv4Address |`
Sort-Object -Property Name | Sort-Object -Property OperatingsystemVersion | `
Select-Object -Property Name,Operatingsystem,OperatingSystemVersion,IPv4Address | Tee-Object -file "\\NASHVILLE\Exec1\6 IT Docs and Downloads\_Documents\Windows Versions\WindowsVersions.txt"
Thank you very much!!
Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.
TRUSTED BY
Open in new window
Open in new window
Open in new window