Syntax
Stop-VMHostService [-HostService] <HostService[]> [-WhatIf] [-Confirm] [<CommonParameters>]Related Commands
Online versionDetailed Description
Stops the host service specified by the Service parameter.Parameters
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
HostService | HostService[] | Specify the host services you want to stop. | true | true (ByValue) | |
Confirm | SwitchParameter | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. | false | false | $true |
WhatIf | SwitchParameter | Indicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | false |
Return Type
HostServiceNotes
Examples
-------------- Example 1 --------------
$vmHostService = Get-VmHostService -VMHost Host if ($vmHostService[0].Running -eq "False") { Start-VmHostService -Service $vmHostService[0] } else { Stop-VmHostService -Service $vmHostService[0] }
Gets a list of the services on the Host. For the first service of the list, if the service is not running, starts the service. Else, stops the service.