본문 바로가기
Vmware

[Vmware]Vmware Start & Stop Batch File

by aws-evan 2022. 4. 14.
반응형

자체 구축 환경을 위해 Vmware Workstation , Oracle VirutalBox를 통해 구축 테스트를 대부분 진행을 할 것으로 확인됩니다. 초기에 구축 및 운영하기가 편한 Vmware WorkStaion을 통해서 테스트를 많이 진행하는데

간혹 여러개를 동시에 키겨나 중지할때 자동화를 하고 싶기에 테스트 해봤습니다.

 

환경

  1. MacBook(개인용 노트북)

  2. Vmware Workstation 설치된 데스크탑

 

작업 방법(Start & Stop)

 1. MacBook -> Vmware Workstation SSH(Open SSH설치 필요) 접속

 2. Batch 파일 실행

 3. 확인

 

 

1. Open SSH 설치 방법 (Mircrosoft Document)

 - https://docs.microsoft.com/ko-kr/windows-server/administration/openssh/openssh_install_firstuse

설치 명령어(PowerShell)
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

#OpenSSH Service Start
# Start the sshd service
Start-Service sshd

# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'

# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
    Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
    New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
    Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}

 

2. Vmware WorkStation 배치 파일 생성

  - Vmware WorkStation 구성

     > 대상 VM : 008.VDI , 050_Docker 

#Vmware Start Batch#

cd C:\Program Files (x86)\VMware   //Vmware 설치 경로

#Example : vmrun.exe start|stop vmware설치 파일\vmware.xmx파일#

##Start
vmrun.exe start D:\008_VDI\008_VDI.vmx
vmrun.exe start D:\050_Docker\050_Docker.vmx

##Stop
vmrun.exe stop D:\008_VDI\008_VDI.vmx
vmrun.exe stop D:\050_Docker\050_Docker.vmx

2.1. Vmware 상태

2.2 Vmware SSH 접속

2.3 Vmware Start,Start 명령어 실행

반응형