Skip to content

Instantly share code, notes, and snippets.

@tabs-not-spaces
Created March 21, 2019 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tabs-not-spaces/4b7351eed8244d1d62c4f325e4d3fd7b to your computer and use it in GitHub Desktop.
Save tabs-not-spaces/4b7351eed8244d1d62c4f325e4d3fd7b to your computer and use it in GitHub Desktop.
Connect to iDrac console from PowerShell
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