Skip to content

Instantly share code, notes, and snippets.

@PrateekKumarSingh
Last active June 20, 2017 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PrateekKumarSingh/5e3a9a4b59b1580d1a1170fadacaf751 to your computer and use it in GitHub Desktop.
Save PrateekKumarSingh/5e3a9a4b59b1580d1a1170fadacaf751 to your computer and use it in GitHub Desktop.
$domain= 'LABDOMAIN\Username'
$pass=ConvertTo-SecureString -String 'YourPassword' -AsPlainText -Force
$creds=New-Object System.Management.Automation.pscredential -ArgumentList $domain, $pass
(Get-Content D:\Servers.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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment