Big progress.

This commit is contained in:
OriolFilter 2022-04-08 03:17:00 +02:00
parent e9ec9abffb
commit 07e5641e55

View File

@ -91,19 +91,19 @@ class VirtualizerManager{
[Array]$__connected_servers=@()
[Hashtable]$__found_host_dict=@{}
[Boolean] __log_in($url){
[String]::Format("-- {0}:",$url) | Write-Host
$status_message=""
$result=$false
try {
$result=Invoke-Command -ComputerName $url { $true }
}
catch [System.Management.Automation.Remoting.PSRemotingTransportException] {
Write-Host $url
Write-Error [String]::Format("Failed to log in to URL: {0}",$url)
Write-Debug [String]::Format("`tError {0}",$Error[0])
[String]::Format("Failed to log in to URL: {0}",$url) | Write-Warning
[String]::Format("{0}",$Error[0]) | Write-Debug
}
finally {
$message = [string]::Format(">> Status {0}",@("NotOK","OK"))
Write-Debug $message
$message = [string]::Format(">>`tStatus {0}",@("NotOK","OK"))
Write-Host $message
}
return $result
}
@ -224,23 +224,13 @@ function Main{
$vmhosts = Get-Hosts-From-File($HOSTS_FILE)
$manager.find_hosts($vmhosts)
}
function Test_Manager_Login{
$manager = [VirtualizerManager]::new()
load_scvmm($manager)
#$manager.load_hosts()
}
function Test_Auth_SCVM{
$hyperv_urls = Get-Hosts-From-File($SCVMM_FILE)
$hyperv = [SystemCenterVirtualMachineManager]::new()
$hyperv.url = $hyperv_urls[0]
$hyperv.check_login()
}
function Test_Auth_SCVM2{
$name="asdasd"
Invoke-Command -ComputerName $name { $true }
}
Main
# if file is empty -> Debug+warn + skipping message (returns empty array)
# add vmware support
# in scvmm check if vname stored are actually the whole object or just the name
# add middleware
# do menus
# store data into custom classes, that way one with custom methods can access the information one way or another, but it's there
# add a menu