Powershell - Pulling multiple attributes for computer objects

Hi guys

I am using the search criteria below to pull some simple information for computer objects.
Is there a way to also pull what patches are installed and if SolidCore is installed and any other HIPS ?

Get-Content Servers.txt | Get-ADComputer -Properties ipv4Address,OperatingSystem, OperatingSystemServicePack,CanonicalName | Select name, ipv4*,IPV6*,oper*,CanonicalName | Export-CSV quickie.csv
LVL 2
MilesLoganAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SubsunCommented:
Patch report will be huge and I am not sure if someone go through the entire list.. :-)

Following code I written sometime back to collect the software information from remote computers.. check and see if it works for you..
$PClist = "C:\temp\computers.txt"
$SoftList=@()
GC $PClist | % {
$MachineName = $_
Try {
	$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::'LocalMachine', $MachineName)
	Write-Host "Collecting information from Computer $MachineName" -ForegroundColor Green
	
	#connect to the needed key :

	$regKey= $reg.OpenSubKey("software\Microsoft\Windows\currentversion\uninstall\")

	#and list the properties :

	$programs = $regkey.GetSubKeyNames()
	foreach ($program in $programs)
	{
	    $Soft = ($regKey.OpenSubKey($program)).GetValue("DisplayName")
			If ($Soft -notmatch "Update" -and $Soft -ne $null){
	    $SoftList +=  New-Object PSObject -Property @{
			Computer = $MachineName
			Software = $Soft
				}
			}
		}
	}
	Catch [Exception]{
	Write-Host "Collecting information from Computer $MachineName - Error : $($_.Exception.Message)" -ForegroundColor Red
		$SoftList += New-Object PSObject -Property @{
		Computer = $MachineName
		Software = "Error : $($_.Exception.Message.Trim())"
		}
	}
}
$SoftList | Select Computer,Software | Export-Csv C:\temp\SoftList.csv -NoTypeInformation

Open in new window

0
MilesLoganAuthor Commented:
Hi Subsun .. this is awesome .. can have your script also output the info below ?
OperatingSystem,OperatingSystemServicePack,CanonicalName

Also.. can you give me a quick run down on what exactly it is pulling ? it list all installed applications and all hotfix or  ?
0
SubsunCommented:
The script will collect all installed application details from server, it will not collect any patch/hotfix information..
Import-Module Activedirectory
$PClist = "C:\temp\computers.txt"

GC $PClist | % {
$MachineName = $_
$cmp = Get-ADComputer $MachineName -Properties ipv4Address,OperatingSystem, OperatingSystemServicePack,CanonicalName
Try {
	$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::'LocalMachine', $MachineName)
	Write-Host "Collecting information from Computer $MachineName" -ForegroundColor Green
	
	#connect to the needed key :

	$regKey= $reg.OpenSubKey("software\Microsoft\Windows\currentversion\uninstall\")

	#and list the properties :

	$programs = $regkey.GetSubKeyNames()
		foreach ($program in $programs)
		{
		    $Soft = ($regKey.OpenSubKey($program)).GetValue("DisplayName")
		    If ($Soft -notmatch "Update" -and $Soft -ne $null){
		    $cmp | Select *,@{N="Computer";E={$MachineName}},@{N="Software";E={$Soft}}
		}
	    }
	}
	Catch [Exception]{
		Write-Host "Collecting information from Computer $MachineName - Error : $($_.Exception.Message)" -ForegroundColor Red
		$cmp | Select *,@{N="Computer";E={$MachineName}},@{N="Software";E={"Error : $($_.Exception.Message.Trim())"}}
		
	}
} | Select Computer,ipv4*,IPV6*,oper*,CanonicalName,Software | Export-Csv C:\temp\SoftList.csv -NoTypeInformation

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MilesLoganAuthor Commented:
Thank you so much !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.