forked from vipmike007/whql_powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Library_HCK_MachinePoolAPI.ps1
141 lines (114 loc) · 3.29 KB
/
Library_HCK_MachinePoolAPI.ps1
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
##/***************************************
## Copyright (c) All rights reserved
##
## File: Library_WHQL_ENV_Parsing.ps1
##
## Authors (s)
##
## Mike Cao <[email protected]>
##
## File name:
## Library_WHQL_HCK_MachinePoolAPI.ps1
##
## This file is used parsing HCK machinepool apis
##
## This work is licensed under the terms of the GNU GPL,Version 2.
##
##****************************************/
#$Library_WHQL_ENV_Parsing_Path = Split-Path $myInvocation.MyCommand.Path
#. (Join-Path $Library_WHQL_ENV_Parsing_Path Library_WHQL_ENV_Parsing.ps1)
#function local:GetScriptDirectory
#{
# $Invocation = (Get-Variable MyInvocation -Scope 1).Value
# Split-Path $Invocation.MyCommand.Path
#}
#. (Join-Path (GetScriptDirectory) "Library_WHQL_ENV_Parsing.ps1" )
function local:LoadObjectModel($Dllfile)
{
return [Reflection.Assembly]::LoadFrom($env:WTTSTDIO + $Dllfile)
}
function local:ConnectDataBaseManager($ControllerName)
{
new-object -typename Microsoft.Windows.Kits.Hardware.ObjectModel.DBConnection.DatabaseProjectManager -Args $ControllerName, DTMJobs
}
#Get Root Pool
function local:GetRootMachinePool($Manager)
{
$Manager.GetRootMachinePool()
}
#Get Default Machine Pool
function local:GetDefaultMachinePool($RootPool)
{
$RootPool.DefaultPool
}
#$RootPool
function local:IsMachinePoolExecutable($MachinePool)
{
$MachinePool.Executable
}
function local:IsRootPool($MachinePool)
{
$MachinePool.RootPool
}
#the name of this machine pool.
function local:GetMachinePoolName ($MachinePool)
{
$MachinePool.Name
}
#get machine pool path
function local:GetMachinePoolPath ($MachinePool)
{
$MachinePool.Path
}
##return Machine Pool
function DeleteChildMachinePool($FatherMachinePool , $ChildMachneName)
{
$FatherMachinePool.DeleteChildPool($ChildMachineName)
}
##return Machine Pool
function local:CreateChildMachinePool($FatherMachinePool , $ChildMachineName)
{
$FatherMachinePool.CreateChildPool($ChildMachineName)
}
##Function : Delete machine in the machine pool
##Return : none
function DeleteMachine($MachinePool , $MachineName)
{
$MachinePool.DeleteMachine($MachineName)
}
#Function : Machine Pool Equals Method
#Return :Returns Boolean, which has a value of true if the two OSPlatforms are equal, or a value of false if they are different.
function MachinePoolEqual($MachinePool ,$Othermachinepool)
{
$MachinePool.Equals($OtherMachinePool)
}
#Function :Object Equals Method
#Return: Return Balloon
function ObjectEqual($MachinePool ,$OtherMachinePool)
{
$MachinePool.Equals($OtherMachinePool)
}
#Function GetChildPools
#Return :Collection of MachinePools
function GetChildMachinePools($MachinePool )
{
$MachinePool.GetChildPools()
}
#function: GetMachines
#Return : a collection of machines in the machine pool
function GetMachines ($MachinePool)
{
$MachinePool.GetMachines()
}
#Function GetHashCode
#Return INT32 which is a unique number which is the MachineSet hash code
function GetHashCode ($MachinePool)
{
$MachinePool.GetHashCode()
}
#Function MoveMachineTo Method
#return none
function MoveMachineToMethod ($MachinePool ,$Machine , $OtherMachinePool)
{
$MachinePool.MoveMachineTo($Machine, $OtherMachinePool)
}