ADD the multiple machines for the PVS machine Catalog

Source: Internet
Author: User

1. Create The PVS Machine catalog:

" PVS Catalog Desc " " PVS Catalog Name " " [email protected] " " xf.com " -PVSFORVM $ ($farmGuid:$schemeGuid$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 INTSet @i=0Set @num= + while @i<@numBEGIN    Insert  intoProvisioningServices.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=The Data Source=$Server; Initial Catalog=$Database;UserId=$UserName;P WD=$Password "# Confirm status $sqlconn.state; #打开数据库连接 $SqlConn.Open() # Confirm Status-again $SqlConn. State; # confirm the switch to the specified database $SqlConn.Database; #查询显示 $SQLCMD=New-Object system.data.sqlclient.sqlcommand$sqlcmd.connection=$SqlConn $sqlcmd.commandtext="SelectDeviceid,devicename fromProvisioningServices.dbo.devicewhereDeviceName like 'basenameser%'the 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 ($machineinch$Set. Tables[0]) #{# $machine. deviceid# $machine. devicename# Break#}# #foreach ($machineinch$Set. Tables[0]) {# New-Brokermachine-Cataloguid1009 -MachineName $machine. DeviceName-Hypervisorconnectionuid1 -Hostedmachineid $machine. DeviceId #}

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

$machines= Import-csv-path$env: UserProfile\desktop\machines.csvforeach($machine inch $machines){    $machine. DeviceId$machine. DeviceName Break}foreach($machine inch $machines) {New-brokermachine-cataloguid 1003-machinename$machine. Devicename-hypervisorconnectionuid 1-hostedmachineid$machine. DEVICEID}

 

ADD the multiple machines for the PVS machine Catalog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.