Last active
October 17, 2016 07:19
-
-
Save vannmangel/41f5eb5bd935f9245335 to your computer and use it in GitHub Desktop.
Fetches all servers in AD, filters only VMware nodes and writes the computer names to a text file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ADComputer -Filter {OperatingSystem -like "*Server*"} -properties * -OutVariable nodes | |
foreach ($node in $nodes.Name) | |
{ | |
if (Test-Connection -Quiet -Count 1 -ComputerName $node) | |
{ | |
if ((gwmi Win32_BIOS -ComputerName $node).serialnumber -match "VMware") | |
{ | |
Add-Content "\\path-to-txt\txt.txt" "`r$node is running VMmware" -PassThru | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment