Add the Multiple machines for the PVS Machine Catalog

Posted Lina

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Add the Multiple machines for the PVS Machine Catalog相关的知识,希望对你有一定的参考价值。

1. Create the PVS machine catalog:

New-BrokerCatalog -AllocationType Random -CatalogKind PVS -Description "PVS Catalog Desc" -Name "PVS Catalog Name" -PvsAddress "[email protected]" -PvsDomain "xf.com" -PvsForVM $($farmGuid:$schemeGuid) -MachinesArePhysical $false

For the Server OS(MultiSession Support) as below:

New-BrokerCatalog  -Name "PVS_catalog" -Description "PVS_catalog" -AllocationType "Random" -IsRemotePC $False -MachinesArePhysical $false -ProvisioningType "PVS" -SessionSupport "MultiSession"  -PvsAddress "[email protected]" -PvsDomain "xf.local" -PersistUserChanges "onLocal"

2. Insert the machines data of devices in database:

DECLARE @i INT,
@num INT
set @i=0
set @num=1000
while @i<@num
BEGIN
    insert into ProvisioningServices.dbo.Device(
      [collectionId]
      ,[deviceName]
      ,[deviceMac]
      ,[port]
      ,[bootFrom]
      ,[authentication]
      ,[adTimestamp]
      ,[adSignature]
      ,[enabled]
      ,[domainName]
      ,[domainObjectSID]
      ,[domainControllerName]
      ,[domainTimeCreated]
      ,[type]
      ,[virtualHostingPoolId]
    )
values (EE8C7139-5175-4DF2-80EB-D8265198C630,
        BaseNameTest+CONVERT(varchar,@i),
        777+CONVERT(varchar,@i),

6901,
1,
0,
1526453339,
29094,
1,
xf.local,
S-1-5-21-4210597930-2839431311-553421094-2616,
W2K12R2-FU40LTO.xf.local,
2018-05-16 06:49:02.450,
0,
F8922DC7-7828-4796-B4C7-2FA81D64FE33
        );
        SET @i=@i+1;
END

3. Import the machines id and name columns from database:

#配置信息  
$Database   = ProvisioningServices  
$Server     = xfPVSSERVER77  
$UserName   = sa
$Password   = 1qaz!QAZ
 
#创建连接对象
$SqlConn = New-Object System.Data.SqlClient.SqlConnection
 
#使用账号连接MSSQL
$SqlConn.ConnectionString = "Data Source=$Server;Initial Catalog=$Database;user id=$UserName;pwd=$Password"

# 确认状态
$SqlConn.state; 

#打开数据库连接  
$SqlConn.open()  

# 确认状态-again  
$SqlConn.State;  
  
  
# 确认切换到指定的数据库  
$SqlConn.Database;  

#查询显示
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.connection = $SqlConn
$SqlCmd.commandtext = "select deviceid,devicename from ProvisioningServices.dbo.device where devicename like BaseNameSer%"
Write-Host $SqlCmd.commandtext
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$set = New-Object data.dataset
$SqlAdapter.Fill($set)
$path = "$env:USERPROFILE\Desktop\machines.txt"
$set.Tables[0] | Format-Table -Auto |Out-File -FilePath  $path
$set.Tables[0] | Export-Csv "$env:USERPROFILE\Desktop\machines_500.csv"

#Write-Host "Just try"
#foreach ($machine in $set.Tables[0])
#{
#    $machine.DeviceId
#    $machine.DeviceName
#    break
#}
#
#foreach ($machine in $set.Tables[0]) {
#        New-BrokerMachine -CatalogUid 1009 -MachineName $machine.DeviceName -HypervisorConnectionUid  1 -HostedMachineId $machine.DeviceId        
#}




4. New-BrokerMachine command to add the machines for the machine catalog:

$machines = Import-Csv -Path $env:USERPROFILE\Desktop\machines.csv
foreach ($machine in $machines)
{
    $machine.DeviceId
    $machine.DeviceName
    break
}

foreach ($machine in $machines) {
        New-BrokerMachine -CatalogUid 1003 -MachineName $machine.DeviceName -HypervisorConnectionUid  1 -HostedMachineId $machine.DeviceId        
}



 

 

 

以上是关于Add the Multiple machines for the PVS Machine Catalog的主要内容,如果未能解决你的问题,请参考以下文章

React Leaflet Routing Machine:onClick to add Marker after all the waypoints are removed仅在第二次单击后触发

Leaning ROS: Running ROS across multiple machines

add nodes to the swarm

[Machine Learning for Trading] {ud501} Lesson 3: 01-02 Working with multiple stocks

[Machine Learning] 多变量线性回归(Linear Regression with Multiple Variable)-特征缩放-正规方程

ZOJ 1530 - Find The Multiple