Created
March 21, 2019 00:08
-
-
Save tabs-not-spaces/4b7351eed8244d1d62c4f325e4d3fd7b to your computer and use it in GitHub Desktop.
Connect to iDrac console from PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Connect-iDrac { | |
[CmdletBinding()] | |
param ( | |
[IPAddress]$dracHost, | |
$dracUser | |
) | |
try { | |
$cred = Get-Credential -UserName $dracUser -Message "Please enter iDrac credentials.." -Title "Connect-iDrac" | |
$jrePath = "C:\bin\jre1.7.0_80" #set to your jre binaries root folder. | |
$kvmJar = "$jrePath\avctKVM.jar" | |
if (!(Test-Path $kvmJar)) { | |
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} | |
$WebClient = New-Object System.Net.WebClient | |
$WebClient.DownloadFile("http://$dracHost/software/avctKVM.jar", "$kvmJar") | |
} | |
$proc = Start-Process -FilePath cmd -ArgumentList "/c `"$jrePath\bin\java.exe -cp avctKVM.jar -Djava.library.path=.\lib com.avocent.idrac.kvm.Main ip=$dracHost kmport=5900 vport=5900 user=$dracUser passwd=$($cred.GetNetworkCredential().Password) apcp=1 version=2 vmprivilege=true 'helpurl=https://%drachost%:443/help/contents.html'`"" -WorkingDirectory $jrePath -PassThru | |
return $proc | |
} | |
catch { | |
Write-Warning $_.Exception.Message | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment