Working with minor errors.
This commit is contained in:
parent
cdd1ea752d
commit
5e200d10c0
2
Notes.md
2
Notes.md
@ -42,6 +42,8 @@ $arry = @("a", "b", "c")
|
||||
|
||||
[MS documentation](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_hash_tables?view=powershell-7.2)
|
||||
|
||||
https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-powershell-1.0/ee692803(v=technet.10)?redirectedfrom=MSDN
|
||||
|
||||
```ps
|
||||
[ordered]@{ <name> = <value>; [<name> = <value> ] ...}
|
||||
```
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Author: Oriol Filter
|
||||
# Date: 06/04/2022
|
||||
# Date: 07/04/2022
|
||||
|
||||
|
||||
$DebugPreference = "Continue"
|
||||
@ -112,7 +112,6 @@ class VirtualizerManager{
|
||||
$server.load_hosts()
|
||||
foreach ($vhost in $server.get_host_list())
|
||||
{
|
||||
# $item.name | Write-Host
|
||||
$this.append_vhost($vhost,$server.url)
|
||||
}
|
||||
}
|
||||
@ -121,7 +120,7 @@ class VirtualizerManager{
|
||||
if ($this.__found_host_dict[$vhost.Name] -isnot [Hashtable]){
|
||||
$this.__found_host_dict[$vhost.Name]=@{}
|
||||
}
|
||||
$this.__found_host_dict[$vhost.Name.ToLower()][$source_url]=$vhost
|
||||
$this.__found_host_dict[$vhost.Name][$source_url]=$vhost
|
||||
}
|
||||
append_vhost($vhost,$source_url){
|
||||
$this.__append_vhost($vhost,$source_url)
|
||||
@ -131,35 +130,21 @@ class VirtualizerManager{
|
||||
if ($hosts_to_find -isnot [Array]){
|
||||
$hosts_to_find=@("$hosts_to_find")
|
||||
}
|
||||
# Find hosts
|
||||
foreach ($hostname in $hosts_to_find) {
|
||||
$lhostname=$hostname.ToLower()
|
||||
$entry_from_list=$this.__found_host_dict[$lhostname]
|
||||
$entry_from_list=$this.__found_host_dict[$hostname]
|
||||
[String]::Format("`t{0}:",$hostname) | Write-Host
|
||||
# $item_from_list |Write-Host
|
||||
# foreach ($a in $item_from_list) {Write-Host $a}
|
||||
# $this.found_host_dict[$vhostname.ToString()].Lenght | Write-Host
|
||||
#
|
||||
# $item_from_list.Length | Write-Host
|
||||
$entry_from_list.Length | Write-Host
|
||||
Write-Host "IF"
|
||||
if ($entry_from_list.Length > 0)
|
||||
if ($entry_from_list.Length -gt 0)
|
||||
{
|
||||
Write-Host "Inner IF"
|
||||
## Not being executed?
|
||||
Write-Host "IF"
|
||||
Write-Host "!!"
|
||||
foreach ($server_location in $entry_from_list) {
|
||||
{
|
||||
$server_location | Write-Host
|
||||
$vm = $this.__found_host_dict[$lhostname][$server_location]
|
||||
#$vm | Write-Host
|
||||
[String]::Format("{0}:",$server_location) | Write-Host
|
||||
}
|
||||
}
|
||||
else {
|
||||
[String]::Format("---- Couldn't be found") | Write-Host
|
||||
foreach ($entry_from_dict in $entry_from_list.GetEnumerator())
|
||||
{
|
||||
$server_location = $entry_from_dict.Name
|
||||
$vm = $entry_from_dict.Value
|
||||
[String]::Format("`t`tFound in '{0}'", $server_location) | Write-Host
|
||||
}
|
||||
Write-Host "`-----------`n"
|
||||
}
|
||||
else {
|
||||
[String]::Format("`----------- Couldn't be found`n") | Write-Host
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,12 +203,6 @@ function Main{
|
||||
load_scvmm($manager)
|
||||
$manager.load_hosts()
|
||||
$vmhosts = Get-Hosts-From-File($HOSTS_FILE)
|
||||
|
||||
# $manager.get_found_host_dict()
|
||||
# foreach ($hostname in $manager.get_found_host_dict()){
|
||||
# Write-Output $hostname.Name
|
||||
# }
|
||||
$manager.__found_host_dict.Lenght
|
||||
$manager.find_hosts($vmhosts)
|
||||
}
|
||||
|
||||
@ -235,5 +214,4 @@ function Test_VCSMM{
|
||||
$x.get_host_list()
|
||||
|
||||
}
|
||||
#Test_VCSMM
|
||||
Main
|
||||
|
Loading…
x
Reference in New Issue
Block a user