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
}

 

原文地址:https://www.cnblogs.com/Lina-zhu/p/9077471.html

时间: 2024-10-15 04:39:26

Add the Multiple machines for the PVS Machine Catalog的相关文章

[XState] Invoke Child XState Machines from a Parent Machine

Trying to structure the state logic of an application as a single machine can begin to become unwieldy when we have too many states. It is often better to divide our app into smaller machines and invoke those machines as necessary. When we enter a st

Awesome Machine Learning

Awesome Machine Learning  A curated list of awesome machine learning frameworks, libraries and software (by language). Inspired by awesome-php. If you want to contribute to this list (please do), send me a pull request or contact me @josephmisiti Als

How to Evaluate Machine Learning Models, Part 4: Hyperparameter Tuning

How to Evaluate Machine Learning Models, Part 4: Hyperparameter Tuning In the realm of machine learning, hyperparameter tuning is a “meta” learning task. It happens to be one of my favorite subjects because it can appear like black magic, yet its sec

Methods and systems to control virtual machines

Methods and systems are provided to control the execution of a virtual machine (VM). A VM Monitor (VMM) accesses VM Control Structures (VMCS) indirectly through access instructions passed to a processor. In one embodiment, the access instructions inc

【转载】Boltzmann machine

Boltzmann machine Geoffrey E. Hinton (2007), Scholarpedia, 2(5):1668. doi:10.4249/scholarpedia.1668 revision #91075 [link to/cite this article] Post-publication activity Curator: Geoffrey E. Hinton Dr. Geoffrey E. Hinton, University of Toronto, CANAD

Virtualizing physical memory in a virtual machine system

A processor including a virtualization system of the processor with a memory virtualization support system to map a reference to guest-physical memory made by guest software executable on a virtual machine which in turn is executable on a host machin

Extended paging tables to map guest physical memory addresses from virtual memory page tables to host physical memory addresses in a virtual machine system

A processor including a virtualization system of the processor with a memory virtualization support system to map a reference to guest-physical memory made by guest software executable on a virtual machine which in turn is executable on a host machin

Running R jobs quickly on many machines(转)

As we demonstrated in “A gentle introduction to parallel computing in R” one of the great things about R is how easy it is to take advantage of parallel processing capabilities to speed up calculation. In this note we will show how to move from runni

[SQL in Azure] Provisioning a SQL Server Virtual Machine on Azure

http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-provision-sql-server/ Provisioning a SQL Server Virtual Machine on Azure The Azure virtual machine gallery includes several images that contain Microsoft SQL Server. You can sel