Get list of hyper-vs and computers in windows active directory

Published on Author JFLeave a comment

Here are a couple handy powershell command line scripts to get lists of computers:

Get list of virtual machines on a Hyper-V:

get-cm > machines.csv

Get list of all machines in an Active Directory (second one is delimited):

First, install the AD module in powershell:

Import-module ActiveDirectory

Then:

Get-ADComputer -Filter * -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion -Wrap –Auto
Get-ADComputer -Filter * -Property * | Select Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion | Export-CSV -delimiter "`t" -Path c:\Computers.txt

References:

Inventorying Computers with AD PowerShell

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.