Hi,
I would like your help with a script that I wont to create that will run ones a day and check if all my vm's are powered on and there nic cards is connected.
Can some one help me with the script?
Moderator: Thread moved to the PowerCLI area.
You could do something like this
ForEach-Object -Process {
Get-NetworkAdapter -VM $vm |
Select @{N='VM';E={$vm.Name}},
@{N='PowerState';E={$vm.PowerState}},
@{N='NIC';E={$_.Name}},ConnectionState
} | where{$_.PowerState -ne 'PoweredOn' -or $_.ConnectionState -ne 'Connected'}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you for your help.
If I have a cupule of servers that I would like that if its powered off that the script will power them on and connect the nic card.
You seem to be adding additional requirements to your original request.
Sorry, I stopped answering those.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference