windows下virtual box虚拟机作为服务开机启动

网上很多介绍windows下开机启动virtual box虚拟的文章,都是通过将命令放在启动目录,或者作为开机计划任务来启动;这里介绍将virtual box 虚拟机作为系统服务器进行启动,即使用户未登录,也会启动虚拟机。

  1. 环境变量path添加 vb 的路径

    path
    C:\Program Files\Oracle\VirtualBox

  2. 创建一个配置文件

    如: d:\vb_work\cfg\autostart.cfg

    内容如下:

    # Default policy is to deny starting a VM, the other option is "allow".
    default_policy = allow
    
    # Bob is allowed to start virtual machines but starting them
    # will be delayed for 10 seconds
    window系统用户名称 = {
       allow = true
       startup_delay = 10
    }
    
  3. 添加一个环境变量

    VBOXAUTOSTART_CONFIG
    值为上面文件的路径 d:\vb_work\cfg\autostart.cfg

  4. 添加 vbox 的 windows 服务

    VBoxAutostartSvc install --user=window系统用户名称
    
    # delete
    VBoxAutostartSvc delete --user=window系统用户名称
    
  5. 运行 services.msc

    查看 virtual box 的 auto 服务,启动看看,密码有没有错;如果没有错误,服务应该可以启动成功。

  6. 指定自动启动的 vm

    VBoxManage modifyvm "vb虚拟机名称" --autostart-enabled on
    
    # close
    VBoxManage modifyvm “vb虚拟机名称” --autostart-enabled off
    
    

参考 vb 的帮助文件如下小节
9.21.4. Windows: Starting the Autostart Service

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值