Get list of installed features and roles on all domain servers - Powershell
Get-ADComputer -Filter 'operatingsystem -like "server" -and enabled -eq "true"' `
-Properties Name,Operatingsystem,OperatingSystemVersion,IPv4Address |
Sort-Object -Property Operatingsystem |
Select-Object -Property Name,Operatingsystem,OperatingSystemVersion,IPv4Address|Export-Csv c:\temp\allservers.csv -NoTypeInformation
above command is giving servers name, which looks good but when i run below command it gives me only one computer (last name in allservers.csv) role and feature info , i need all servers list of installed features and roles
$lists=Import-Csv c:\temp\allservers1.csv
foreach($list in $lists){
Get-WindowsFeature -ComputerName $list.name | Where-Object {$_. installstate -eq "installed"} |
select Name,Installstate | export-csv c:\temp\pelicanservers1-roles.csv -NoTypeInformation
}
above command should give role and feature info for all servers which is mentioned in allservers.csv and export file pelicanservers1-roles.csv should have servers name as well for which role and feature is associated with.
Thanks in advance for help!