Skip to content

Commit ce7135e

Browse files
committed
Add "Start-VMwareWorkstationServices.ps1" script
1 parent 3344fc7 commit ce7135e

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#requires -version 2
2+
<#
3+
.SYNOPSIS
4+
Show a menu to easily check and start VMware Workstation services
5+
6+
.DESCRIPTION
7+
Show a menu to easily check and start VMware Workstation services. Type a number from 0 to 4 to launch and action.
8+
9+
.INPUTS
10+
<None>
11+
12+
.OUTPUTS
13+
<None>
14+
15+
16+
.NOTES
17+
Version: 0.1
18+
Author: ALBERT Jean-Marc
19+
Creation Date: 23/04/2016 (DD/MM/YYYY)
20+
Purpose/Change: 1.0 - 2016.04.23 - ALBERT Jean-Marc - Initial script development
21+
22+
23+
.SOURCES
24+
<None>
25+
26+
27+
.EXAMPLE
28+
<None>
29+
30+
#>
31+
32+
#---------------------------------------------------------[Initialisations]--------------------------------------------------------
33+
Set-StrictMode -version Latest
34+
35+
#Set Error Action to Silently Continue
36+
$ErrorActionPreference = "SilentlyContinue"
37+
38+
#----------------------------------------------------------[Declarations]----------------------------------------------------------
39+
40+
$ScriptName = [System.IO.Path]::GetFileName($ScriptFile)
41+
$ScriptPath = Split-Path $MyInvocation.InvocationName
42+
$ScriptFilePath = $ScriptPath + "\$ScriptName.ps1"
43+
$ScriptVersion = "0.1"
44+
45+
#-----------------------------------------------------------[Functions]------------------------------------------------------------
46+
47+
function Show-Menu
48+
{
49+
param (
50+
[string]$selection
51+
)
52+
53+
Clear-Host
54+
Write-Host "================ $Title ================"
55+
56+
Write-Host "1: List VMmware services (with status)"
57+
Write-Host "2: Start System services (Authorization and USB Arbitration)"
58+
Write-Host "3: Start Network services (DHCP and NAT)"
59+
Write-Host "4: Start Remote Administration service (Workstation Server)"
60+
Write-Host "0: Exit"
61+
}
62+
63+
function Get-VMwareServicesStatus
64+
{
65+
Get-Service | Where-Object {$_.DisplayName -Like "VMware*"} | Sort-Object Status,Name,DisplayName | %{
66+
if ( $_.Status -eq "Stopped")
67+
{
68+
Write-Host $_.Status "|" $_.Name "|" $_.DisplayName -ForegroundColor red
69+
}
70+
elseif ( $_.Status -eq "Running")
71+
{
72+
Write-Host $_.Status "|" $_.Name "|" $_.DisplayName -ForegroundColor green}
73+
}
74+
}
75+
76+
#----------------------------------------------------------[Execution]----------------------------------------------------------
77+
78+
#Show menu
79+
do
80+
{
81+
Show-Menu
82+
$selection = Read-Host "Please make a selection"
83+
switch ($selection)
84+
{
85+
'1' {
86+
Clear-Host
87+
Get-VMwareServicesStatus
88+
}
89+
'2' {
90+
Start-Service "VMAuthdService"
91+
Start-Service "VMUSBArbService"
92+
Get-VMwareServicesStatus
93+
}
94+
'3' {
95+
Start-Service "VMnetDHCP"
96+
Start-Service "VMware NAT Service"
97+
Get-VMwareServicesStatus
98+
}
99+
'4' {
100+
Start-Service "VMwareHostd"
101+
Get-VMwareServicesStatus
102+
}
103+
'0' {
104+
Exit
105+
}
106+
}
107+
pause
108+
}
109+
until ($selection -ceq '0')
110+
111+
Exit

0 commit comments

Comments
 (0)