Closed jpsider closed 7 years ago
Console output Before: Describing vCenter Configuration: NFC-UseSSL.Vester.ps1 Describing vCenter Configuration: SMTP-Port.Vester.ps1 [+] vCenter - SMTP Port 758ms
Console output after change: Describing vCenter Configuration: NFC-UseSSL.Vester.ps1 Describing vCenter Configuration: SMTP-Port.Vester.ps1 [+] vCenter 192.168.10.220 - SMTP Port 501ms
Same problem with the XML that is created, which I parse for XesterUI.
Thanks @jpsider! As we touched on in chat, I'll sit on this until we merge #115 (which is hopefully very soon now 🙂).
I could not get this to work :
'vCenter' { @{Name = $cfg.vcenter.vc} }
I tried several different ways to specify the name, but the main problem is that $cfg.vcenter.vc is not an object, it's just a string.
I was able to add 'name' to $cfg.vcenter, but that would require more changes mainly in the test files.
So I may have hit a middle ground with the following line:
'vCenter' {$global:DefaultVIServer | where-object {$_.name -like "$($cfg.vcenter.vc)"}}
It will set the object to the connected vcenter with the name from the string in the config file.
Results with :
Describing vCenter Configuration: SMTP-Port.Vester.ps1 [+] vCenter 192.168.2.200 - SMTP Port 192ms Describing VM Configuration: CDDrive-Host.Vester.ps1
I committed the changes, let me know your thoughts.
That works for me 🙂 Pending #115.
:shipit:
I chose to only update this in one location in this script. It will return the correct name in the console and xml output. The other areas with $cfg.vcenter.vc do not require this change to be functional.