Link to home
Start Free TrialLog in
Avatar of cwstad2
cwstad2Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Powershell list OS against txt file list

Hi guys, im trying to get the following list from a txt file i have but it returns all of the ad computers instead of the ones in the file. Any ideas?

thanks

$computers = Get-Content -Path C:\it\computers.txt
Get-ADComputer -Filter * -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion -Wrap -Auto
Avatar of SreRaj
SreRaj
Flag of India image

Hi,

It should be like,

ForEach($Computer in Get-Content C:\it\computers.txt){Get-ADComputer $Computer | Format-Table Name,SID -Wrap -Auto}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Raheman M. Abdul
Raheman M. Abdul
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cwstad2

ASKER

perfect works great
Above post beat me to it.