Skip to content

Instantly share code, notes, and snippets.

@dogukancagatay
Created February 17, 2022 16:12
Show Gist options
  • Save dogukancagatay/7fd0b1821d751a31b655f5008ebfe53c to your computer and use it in GitHub Desktop.
Save dogukancagatay/7fd0b1821d751a31b655f5008ebfe53c to your computer and use it in GitHub Desktop.
#!/bin/bash
# Name: kvm.sh
# Purpose : Control remote server/laptop/desktop using KVM and VNC client
# Author: nixCraft {https://www.cyberciti.biz/} under GPL v3.x
# ----------------------------------------------------------------------
xIP='192.168.2.88'
xPASSWORD='PasssordHere'
xVNC_PWD='In9t8el@' # random but must be 8 charter long
xVNC_PORT='5900'
wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h $xIP -P 16992 -u admin -p ${xPASSWORD} -k RFBPassword=${xVNC_PWD}
wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h $xIP -P 16992 -u admin -p ${xPASSWORD} -k Is5900PortEnabled=true
wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h $xIP -P 16992 -u admin -p ${xPASSWORD} -k OptInPolicy=false
wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h $xIP -P 16992 -u admin -p ${xPASSWORD} -k SessionTimeout=0
wsman invoke -a RequestStateChange http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_KVMRedirectionSAP -h ${xIP} -P 16992 -u admin -p ${xPASSWORD} -k RequestedState=2
echo "Open Linux vnc client. Use \"$xIP:$xVNC_PORT\" as host and when promoted enter \"$xVNC_PWD\" as password"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment