$domain= ”YOURDOMAIN”
$pass=ConvertTo-SecureString -String ‘YOURPASS’ -AsPlainText -Force
$creds=New-Object System.Management.Automation.pscredential -ArgumentList $domain, $pass
(Get-Content c:\server_list.txt| Foreach{Invoke-Command -ComputerName $_ -Verbose -ScriptBlock{get-windowsfeature |
Where-Object{$_.installed -eq $true -and $_.featuretype -eq ‘Role’} |
select name, installed -ExcludeProperty subfeatures} -Credential $creds}) | `
Format-Table -Property Name, Installed, @{name=’Server Name’;expression={$_.pscomputername}} -AutoSize