26 lines
698 B
PowerShell

Import-Module 'IntelvPro'
Add-Type -Path # Path of the VNCViewer dll (RealVNC.VNCViewerSDK.dll)
$kvmLib = New-Object Intel.Management.Redirection.KVMRedirection
$result = $kvmLib.Init()
if($result -eq 0)
{
$viewer = [RealVNC.VNCViewerSDK.VNCViewerSDK]::CreateViewer($true)
# Fill the connection information.
$kvmLib.Host = "192.168.0.1"
$kvmLib.UserName = "myUser"
$kvmLib.Password = "P@ssw0rd"
$kvmLib.Port = 16994
$proxyPort = 0
# Open the KVM session via redirection port.
$result = $kvmLib.Start([ref]$proxyPort)
if($result -eq 0)
{
$viewer.Start("127.0.0.1:" + $proxyPort)
}
# Close the session.
$result = $kvmLib.Stop()
# Close the library.
$result = $kvmLib.Deinit()
}