samples/vm-extensions.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
[
    {
        "MemberType": "ScriptProperty",
        "MemberName": "TestVHD",
        "Value": "\n if ($this.HardDrives) {\n #test if there are any false results\n if ( ($this | Get-VMHardDiskDrive | Test-Path) -contains $False ) {\n $False\n }\n else {\n $True\n }\n }\n else {\n #no hard drive files configured\n $false\n } \n",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "ConfigurationFile",
        "Value": "Join-path -Path \"$($this.configurationLocation)\\Virtual Machines\" -ChildPath \"$($this.vmid).vmcx\" -Resolve ",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "DiskPath",
        "Value": "$this.Harddrives.path",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "Running",
        "Value": "if ($this.state -eq 'Running') {$True} else { $False}",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "SizeGB",
        "Value": " \r\n $stat = Get-VMHardDiskDrive -VMName $this.vmname | Get-Item | Measure-Object -Property length -sum\r\n [math]::Round($stat.sum/1GB,2)\r\n ",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "MemoryMB",
        "Value": "$this.MemoryAssigned/1mb",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "MemoryDemandMB",
        "Value": "$this.MemoryDemand/1mb",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "HasSnapshot",
        "Value": " if ($this.parentSnapshotName) { $True } else { $False}",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "IPAddress",
        "Value": "($this | Get-VMNetworkAdapter).IPAddresses | where {$_ -match \"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\"}",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
        "MemberType": "ScriptProperty",
        "MemberName": "Runtime",
        "Value": "\"{0}.{1:00}:{2:00}:{3:00}\" -f $this.uptime.Days,$this.uptime.Hours,$this.uptime.Minutes,$this.uptime.Seconds",
        "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    },
    {
    "MemberType": "ScriptProperty",
    "MemberName": "VMSwitch",
    "Value": "($this | Get-VMNetworkAdapter).SwitchName",
    "TypeName": "Microsoft.HyperV.PowerShell.VirtualMachine"
    }
 
]