Sha256: f0050d180cf2bc89a3c9f59be64229ccd17377aad89d788c8c52bd01b62f7bc0
Contents?: true
Size: 636 Bytes
Versions: 7
Compression:
Stored size: 636 Bytes
Contents
param ( [string]$VmId = $(throw "-VmId is required.") ) # Include the following modules $presentDir = Split-Path -parent $PSCommandPath $modules = @() $modules += $presentDir + "\utils\write_messages.ps1" forEach ($module in $modules) { . $module } try { $vm = Hyper-V\Get-VM -Id $VmId -ErrorAction "stop" Hyper-V\Start-VM $vm -ErrorAction "stop" $state = $vm.state $status = $vm.status $name = $vm.name $resultHash = @{ state = "$state" status = "$status" name = "$name" } $result = ConvertTo-Json $resultHash Write-Output-Message $result } catch { Write-Error-Message "Failed to start a VM $_" }
Version data entries
7 entries across 7 versions & 2 rubygems