在WinPE上執行VMware!
阿新 • • 發佈:2019-01-07
PE為了精簡及更加有效的執行目的功能,會對很多東西進行精簡
你看下VM綠色版本的綠化程式就知道了。。。。
--很顯然為了執行VM,需要讓PE進行很多倒退
@shift 1
@echo off
CLS
color 0a
echo.
echo VMware Workstation 6.0.2.59824 綠色精簡版
echo.
echo.
echo 即將進行安裝,是否要繼續......
echo.
echo ---------------------------------------------------------------------------
echo.
"%cd%/choice.exe" /C YN /N /M "請輸入 Y (繼續安裝)或 N (退出安裝):"
IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 GOTO st
IF ERRORLEVEL 2 IF NOT ERRORLEVEL 3 GOTO ex
PAUSE
:ST
:regdll
echo 正在註冊所需的DLL檔案....
regsvr32 /s "%cd%/vmappcfg.dll"
regsvr32 /s "%cd%/vmappsdk.dll"
regsvr32 /s "%cd%/vmdbCOM.dll"
regsvr32 /s "%cd%/vmhwcfg.dll"
:addreg
echo 正在添加註冊表專案...
reg delete "HKEY_LOCAL_MACHINE/SOFTWARE/VMware, Inc." /f
set regadd=reg add "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Setup
%regadd%" /v "SourcePath" /d "%systemroot%/inf" /f
set regadd=reg add "HKEY_LOCAL_MACHINE/SOFTWARE/VMware, Inc.
%regadd%" /v Core /d "VMware Workstation" /f
set regadd=%regadd%/VMware Workstation
%regadd%" /v "InstallPath" /d "%cd%" /f
set regadd=%regadd%/License.ws.6.0.200907
%regadd%" /v "StartFields" /d "Cpt, ProductID, LicenseVersion, LicenseType, Epoch" /f
%regadd%" /v "Cpt" /d "COPYRIGHT (c) VMware, Inc. 1999-2007" /f
%regadd%" /v "ProductID" /d "VMware Workstation for Win32" /f
%regadd%" /v "LicenseVersion" /d "6.0" /f
%regadd%" /v "LicenseType" /d "User" /f
%regadd%" /v "Epoch" /d "2009-7-1" /f
%regadd%" /v "Hash" /d "6b3d34d9-b34f898e-2600b82e-9f65a272-44f2afe8" /f
%regadd%" /v "Serial" /d "ERHUD-2RGAC-X01FZ-4MRN2" /f
%regadd%" /v "Name" /d "User" /f
%regadd%" /v "CompanyName" /d "@China" /f
@reg add "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Cdrom" /v "Autorun" /d "0" /f
:adduser
echo 開始建立 __vmware_user__ 賬戶 ...
net user __vmware_user__ /add /comment:"VMware User" /fullname:"__vmware_user__"
net localgroup __vmware__ /add /comment:"VMware User Group" >nul
net localgroup users __vmware_user__ /del >nul
net localgroup __vmware__ __vmware_user__ /add >nul
:Start VM basic service
echo 裝載虛擬機器需要基本服務 ...
sc create vmx86 type= kernel start= auto binpath= "%cd%/drivers/vmx86.sys" displayname= "VMware Virtualization Driver"
net start vmx86
sc create VMnetuserif type= kernel start= auto binpath= "%cd%/drivers/vmnetuserif.sys" displayname= "VMware Network Application Interface"
net start VMnetuserif
echo 初始化完成,即將啟動服務安裝....
choice /t 5 /c e /n /d e
CALL "!)服務.cmd"
@ECHO OFF
CLS
color 0a
GOTO MENU
:MENU
ECHO.
ECHO. =-=-=-=-=請選擇要啟動的服務專案=-=-=-=-=
ECHO.
ECHO. 1 啟動-本機網路服務(橋接,直接連線外網)
ECHO.
ECHO. 2 啟動-USB和COM服務
ECHO.
ECHO. 3 啟動-DHCP和NAT服務(共享上網,預設安裝虛擬網絡卡8)
ECHO.
ECHO. 4 啟動-使用者許可權服務
ECHO.
ECHO. 5 安裝-本地網路
ECHO.
ECHO. 6 安裝-虛擬磁碟對映
ECHO.
ECHO. 7 退 出
ECHO.
ECHO.
ECHO.
"%cd%/choice.exe" /C 123456789 /N /M 請輸入選擇專案的序號:
IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 GOTO SERVICE1
IF ERRORLEVEL 2 IF NOT ERRORLEVEL 3 GOTO SERVICE2
IF ERRORLEVEL 3 IF NOT ERRORLEVEL 4 GOTO SERVICE3
IF ERRORLEVEL 4 IF NOT ERRORLEVEL 5 GOTO SERVICE4
IF ERRORLEVEL 5 IF NOT ERRORLEVEL 6 GOTO SERVICE5
IF ERRORLEVEL 6 IF NOT ERRORLEVEL 7 GOTO SERVICE6
IF ERRORLEVEL 7 GOTO END
PAUSE
:SERVICE1
"%cd%/netcfg.exe" -l "%cd%/drivers/netbridge.inf" -c s -i vmware_bridge
net start VMNETBRIDGE
GOTO MENU
:SERVICE2
sc create hcmon type= kernel start= auto binpath= "%cd%/drivers/hcmon.sys" displayname= "VMware hcmon"
net start hcmon
SC CREATE Vmparport TYPE= KERNEL BINPATH= "%cd%/drivers/VMPARPORT.SYS" GROUP= "EXTENDED BASE" DISPLAYNAME= "VMware VMparport"
net start Vmparport
GOTO MENU
:SERVICE3
sc create "VMware NAT Service" start= auto binpath= "%cd%/vmnat.exe" depend= "VMnetuserif" displayname= "VMware NAT Service"
set regadd=reg add "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/VMware NAT Service/Parameters
%regadd%" /v "ConfigPath" /d "%cd%" /f
sc create VMnetDHCP start= auto binpath= "%cd%/VMnetDHCP.exe" depend= "VMnetuserif" displayname= "VMware DHCP Service"
set regadd=reg add "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/VMnetDHCP/Parameters
%regadd%" /v "ConfFile" /d "%cd%/vmnetdhcp.conf" /f
%regadd%" /v "LeaseFile" /d "%cd%/vmnetdhcp.leases" /f
"%cd%/devcon.exe" -R INSTALL "%cd%/drivers/netadapter.inf" *VMnetAdapter8
start /wait vnetlib -- add dhcp vmnet8
start /wait vnetlib -- add nat vmnet8
start /wait vnetlib -- stop nat
start /wait vnetlib -- set vnet vmnet8 addr 192.168.203.0
start /wait vnetlib -- stop dhcp
start /wait vnetlib -- update dhcp vmnet8
start /wait vnetlib -- start dhcp
start /wait vnetlib -- update nat vmnet8
start /wait vnetlib -- start nat
start /wait vnetlib -- update adapter vmnet8
GOTO MENU
:SERVICE4
sc create VMAuthdService start= auto binpath= "%cd%/vmware-authd.exe" depend= "vmx86" displayname= "VMware Authorization Service"
net start VMAuthdService
GOTO MENU
:SERVICE5
sc create VMnetDHCP start= auto binpath= "%cd%/VMnetDHCP.exe" depend= "VMnetuserif" displayname= "VMware DHCP Service"
set regadd=reg add "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/VMnetDHCP/Parameters
%regadd%" /v "ConfFile" /d "%cd%/vmnetdhcp.conf" /f
%regadd%" /v "LeaseFile" /d "%cd%/vmnetdhcp.leases" /f
"%cd%/devcon.exe" -R INSTALL "%cd%/drivers/netadapter.inf" *VMnetAdapter1
start /wait vnetlib -- add dhcp vmnet1
start /wait vnetlib -- set vnet vmnet1 addr 10.10.10.0
start /wait vnetlib -- stop dhcp
start /wait vnetlib -- update dhcp vmnet1
start /wait vnetlib -- start dhcp
start /wait vnetlib -- update adapter vmnet1
GOTO MENU
:SERVICE6
sc create vstor2 type= kernel start= auto binpath= "%cd%/VMMount/vstor2.sys" displayname= "Vstor2 Virtual Storage Driver"
net start vstor2
sc create vstor2-ws60 type= kernel start= demand binpath= "%cd%/VMMount/vstor2-ws60.sys" displayname= "Vstor2 WS60 Virtual Storage Driver"
net start vstor2-ws60
sc create vmount2 start= demand binpath= "%cd%/VMMount/vmount2.exe" depend= "RpcSs" displayname= "VMware Virtual Mount Service Extended"
"%cd%/VMMount/vmount2.exe" /service
net start vmount2
GOTO MENU
:END
你看下VM綠色版本的綠化程式就知道了。。。。
--很顯然為了執行VM,需要讓PE進行很多倒退
@shift 1
@echo off
CLS
color 0a
echo.
echo VMware Workstation 6.0.2.59824 綠色精簡版
echo.
echo.
echo 即將進行安裝,是否要繼續......
echo.
echo ---------------------------------------------------------------------------
echo.
"%cd%/choice.exe" /C YN /N /M "請輸入 Y (繼續安裝)或 N (退出安裝):"
IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 GOTO st
IF ERRORLEVEL 2 IF NOT ERRORLEVEL 3 GOTO ex
PAUSE
:ST
:regdll
echo 正在註冊所需的DLL檔案....
regsvr32 /s "%cd%/vmappcfg.dll"
regsvr32 /s "%cd%/vmappsdk.dll"
regsvr32 /s "%cd%/vmdbCOM.dll"
regsvr32 /s "%cd%/vmhwcfg.dll"
:addreg
echo 正在添加註冊表專案...
reg delete "HKEY_LOCAL_MACHINE/SOFTWARE/VMware, Inc." /f
set regadd=reg add "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Setup
%regadd%" /v "SourcePath" /d "%systemroot%/inf" /f
set regadd=reg add "HKEY_LOCAL_MACHINE/SOFTWARE/VMware, Inc.
%regadd%" /v Core /d "VMware Workstation" /f
set regadd=%regadd%/VMware Workstation
%regadd%" /v "InstallPath" /d "%cd%" /f
set regadd=%regadd%/License.ws.6.0.200907
%regadd%" /v "StartFields" /d "Cpt, ProductID, LicenseVersion, LicenseType, Epoch" /f
%regadd%" /v "Cpt" /d "COPYRIGHT (c) VMware, Inc. 1999-2007" /f
%regadd%" /v "ProductID" /d "VMware Workstation for Win32" /f
%regadd%" /v "LicenseVersion" /d "6.0" /f
%regadd%" /v "LicenseType" /d "User" /f
%regadd%" /v "Epoch" /d "2009-7-1" /f
%regadd%" /v "Hash" /d "6b3d34d9-b34f898e-2600b82e-9f65a272-44f2afe8" /f
%regadd%" /v "Serial" /d "ERHUD-2RGAC-X01FZ-4MRN2" /f
%regadd%" /v "Name" /d "User" /f
%regadd%" /v "CompanyName" /d "@China" /f
@reg add "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Cdrom" /v "Autorun" /d "0" /f
:adduser
echo 開始建立 __vmware_user__ 賬戶 ...
net user __vmware_user__ /add /comment:"VMware User" /fullname:"__vmware_user__"
net localgroup __vmware__ /add /comment:"VMware User Group" >nul
net localgroup users __vmware_user__ /del >nul
net localgroup __vmware__ __vmware_user__ /add >nul
:Start VM basic service
echo 裝載虛擬機器需要基本服務 ...
sc create vmx86 type= kernel start= auto binpath= "%cd%/drivers/vmx86.sys" displayname= "VMware Virtualization Driver"
net start vmx86
sc create VMnetuserif type= kernel start= auto binpath= "%cd%/drivers/vmnetuserif.sys" displayname= "VMware Network Application Interface"
net start VMnetuserif
echo 初始化完成,即將啟動服務安裝....
choice /t 5 /c e /n /d e
CALL "!)服務.cmd"
@ECHO OFF
CLS
color 0a
GOTO MENU
:MENU
ECHO.
ECHO. =-=-=-=-=請選擇要啟動的服務專案=-=-=-=-=
ECHO.
ECHO. 1 啟動-本機網路服務(橋接,直接連線外網)
ECHO.
ECHO. 2 啟動-USB和COM服務
ECHO.
ECHO. 3 啟動-DHCP和NAT服務(共享上網,預設安裝虛擬網絡卡8)
ECHO.
ECHO. 4 啟動-使用者許可權服務
ECHO.
ECHO. 5 安裝-本地網路
ECHO.
ECHO. 6 安裝-虛擬磁碟對映
ECHO.
ECHO. 7 退 出
ECHO.
ECHO.
ECHO.
"%cd%/choice.exe" /C 123456789 /N /M 請輸入選擇專案的序號:
IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 GOTO SERVICE1
IF ERRORLEVEL 2 IF NOT ERRORLEVEL 3 GOTO SERVICE2
IF ERRORLEVEL 3 IF NOT ERRORLEVEL 4 GOTO SERVICE3
IF ERRORLEVEL 4 IF NOT ERRORLEVEL 5 GOTO SERVICE4
IF ERRORLEVEL 5 IF NOT ERRORLEVEL 6 GOTO SERVICE5
IF ERRORLEVEL 6 IF NOT ERRORLEVEL 7 GOTO SERVICE6
IF ERRORLEVEL 7 GOTO END
PAUSE
:SERVICE1
"%cd%/netcfg.exe" -l "%cd%/drivers/netbridge.inf" -c s -i vmware_bridge
net start VMNETBRIDGE
GOTO MENU
:SERVICE2
sc create hcmon type= kernel start= auto binpath= "%cd%/drivers/hcmon.sys" displayname= "VMware hcmon"
net start hcmon
SC CREATE Vmparport TYPE= KERNEL BINPATH= "%cd%/drivers/VMPARPORT.SYS" GROUP= "EXTENDED BASE" DISPLAYNAME= "VMware VMparport"
net start Vmparport
GOTO MENU
:SERVICE3
sc create "VMware NAT Service" start= auto binpath= "%cd%/vmnat.exe" depend= "VMnetuserif" displayname= "VMware NAT Service"
set regadd=reg add "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/VMware NAT Service/Parameters
%regadd%" /v "ConfigPath" /d "%cd%" /f
sc create VMnetDHCP start= auto binpath= "%cd%/VMnetDHCP.exe" depend= "VMnetuserif" displayname= "VMware DHCP Service"
set regadd=reg add "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/VMnetDHCP/Parameters
%regadd%" /v "ConfFile" /d "%cd%/vmnetdhcp.conf" /f
%regadd%" /v "LeaseFile" /d "%cd%/vmnetdhcp.leases" /f
"%cd%/devcon.exe" -R INSTALL "%cd%/drivers/netadapter.inf" *VMnetAdapter8
start /wait vnetlib -- add dhcp vmnet8
start /wait vnetlib -- add nat vmnet8
start /wait vnetlib -- stop nat
start /wait vnetlib -- set vnet vmnet8 addr 192.168.203.0
start /wait vnetlib -- stop dhcp
start /wait vnetlib -- update dhcp vmnet8
start /wait vnetlib -- start dhcp
start /wait vnetlib -- update nat vmnet8
start /wait vnetlib -- start nat
start /wait vnetlib -- update adapter vmnet8
GOTO MENU
:SERVICE4
sc create VMAuthdService start= auto binpath= "%cd%/vmware-authd.exe" depend= "vmx86" displayname= "VMware Authorization Service"
net start VMAuthdService
GOTO MENU
:SERVICE5
sc create VMnetDHCP start= auto binpath= "%cd%/VMnetDHCP.exe" depend= "VMnetuserif" displayname= "VMware DHCP Service"
set regadd=reg add "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/VMnetDHCP/Parameters
%regadd%" /v "ConfFile" /d "%cd%/vmnetdhcp.conf" /f
%regadd%" /v "LeaseFile" /d "%cd%/vmnetdhcp.leases" /f
"%cd%/devcon.exe" -R INSTALL "%cd%/drivers/netadapter.inf" *VMnetAdapter1
start /wait vnetlib -- add dhcp vmnet1
start /wait vnetlib -- set vnet vmnet1 addr 10.10.10.0
start /wait vnetlib -- stop dhcp
start /wait vnetlib -- update dhcp vmnet1
start /wait vnetlib -- start dhcp
start /wait vnetlib -- update adapter vmnet1
GOTO MENU
:SERVICE6
sc create vstor2 type= kernel start= auto binpath= "%cd%/VMMount/vstor2.sys" displayname= "Vstor2 Virtual Storage Driver"
net start vstor2
sc create vstor2-ws60 type= kernel start= demand binpath= "%cd%/VMMount/vstor2-ws60.sys" displayname= "Vstor2 WS60 Virtual Storage Driver"
net start vstor2-ws60
sc create vmount2 start= demand binpath= "%cd%/VMMount/vmount2.exe" depend= "RpcSs" displayname= "VMware Virtual Mount Service Extended"
"%cd%/VMMount/vmount2.exe" /service
net start vmount2
GOTO MENU
:END