Sha256: b1719151f91d24c77a4513f22c9dda341b1d96ac2c1b853ec183736a4fe8ddbd
Contents?: true
Size: 736 Bytes
Versions: 6
Compression:
Stored size: 736 Bytes
Contents
Param( [Parameter(Mandatory=$true)] [string]$VmId ) # Include the following modules $Dir = Split-Path $script:MyInvocation.MyCommand.Path . ([System.IO.Path]::Combine($Dir, "utils\write_messages.ps1")) if($PSVersionTable.PSVersion.Major -le 4) { $ExceptionType = [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException] } else { $ExceptionType = [Microsoft.HyperV.PowerShell.VirtualizationException] } try { $VM = Get-VM -Id $VmId -ErrorAction "Stop" $State = $VM.state $Status = $VM.status } catch $ExceptionType { $State = "not_created" $Status = $State } $resultHash = @{ state = "$State" status = "$Status" } $result = ConvertTo-Json $resultHash Write-Output-Message $result
Version data entries
6 entries across 6 versions & 2 rubygems