String :-)
asked on
Powershell - combine output from get-vm and get-adcomputer into the same CSV.
Wondering how to combine output from get-vm and get-adcomputer into the same CSV.
I am doing a project where I need to update VMWare Tools, but only dev domain joined Windows servers.
I am hoping to combine the outputs from get-vm and get-adcomputer into a master list, and matches records based on "Name".
For example:
$ADServers = Get-ADComputer -Filter {(OperatingSystem -like "*windows*server*") -and (Enabled -eq "True")}
$VMs = get-vm
CSV includes $VMs.Name, $ADServers.Name, $ADServers.DistinguishedNa me, $VMs.PowerState
$ADServers.Name and $VMs.Name should match in theory, however not all VMS will be joined to the domain so $ADServers.Name and $ADServers.DistinguishedNa me may be empty on some records.
Is this possible?.
Cheers
String :-)
I am doing a project where I need to update VMWare Tools, but only dev domain joined Windows servers.
I am hoping to combine the outputs from get-vm and get-adcomputer into a master list, and matches records based on "Name".
For example:
$ADServers = Get-ADComputer -Filter {(OperatingSystem -like "*windows*server*") -and (Enabled -eq "True")}
$VMs = get-vm
CSV includes $VMs.Name, $ADServers.Name, $ADServers.DistinguishedNa
$ADServers.Name and $VMs.Name should match in theory, however not all VMS will be joined to the domain so $ADServers.Name and $ADServers.DistinguishedNa
Is this possible?.
Cheers
String :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear oBdA, thanks for the help again mate you really are a life saver. This script worked a treat, Currently half way through Jeff Hicks month of lunches book, so Im hoping Ill be able create my own hash tables and arrays soon :-)
Dear Sebastian, thanks for the tip - useful to know!
Cheers
Tom