zoukankan      html  css  js  c++  java
  • Add the Multiple machines for the MCS Machine Catalog

    1. Create the MCS type machine catalog

    New-BrokerCatalog -name 'TestCatalog' -ProvisioningType 'MCS' -SessionSupport 'MuiltiSession' -PersistUserChanges 'onlocal'

    2. Add the machine to MCS machine catalog

    $password = "1qaz!QAZ"
    $securepassword = $Password | ConvertTo-SecureString -AsPlainText -Force
    $ADAccount = New-AcctADAccount -IdentityPoolName MCS_catalog2 -Count 180 -OutVariable result -ADUserName "xfadministrator" -ADPassword $SecurePassword
    $machines = $ADAccount.SuccessfulAccounts
    Foreach($machine in $machines)
    {
        $VMName = $machine | select ADAccountName       
        New-provVM -ProvisioningSchemeName "MCS_catalog2" -ADAccountName $VMName.ADAccountName    
        #$provVM = Get-provVM |select ADAccountName,VMId |Where-Object{$_.ADAccountName -like $VMName}    
        New-BrokerMachine -CatalogUid 6 -MachineName $VMName.ADAccountName 
    }
    

    3.Delete the machine from XenServer host

    for ($i=0; $i -le 3600000; $i++)
    {
            start-sleep -seconds 3
            $i
    Connect-XenServer -url "http://10.150.182.76" -UserName "root" -Password "9JdUl63w3Unf" -NoWarnCertificates -SetDefaultSession

    $myVms = Get-XenVM | select name_label| Where-Object {$_.name_label -like "fwmachine*"}
    for($j = 0; $j -lt $myVms.length-1; $j++){ 
            $number1 = $myVms[$j].name_label.substring(9)
            $number2 = $myVms[$myVms.length-1].name_label.substring(9)
            if ($number1 -lt $number2){
                $delVm = $myVms[$j].name_label      
            }else{
                $delVm = $myVms[$myVms.length-1].name_label
            }  
                 $delVm   
                 Remove-XenVM -Name $delVm
    
          }
                   
    }

     4.Delete the vdisk from xenserver

    Connect-XenServer -url "http://10.150.182.76" -UserName "root" -Password "9JdUl63w3Unf" -NoWarnCertificates -SetDefaultSession
    
    Get-XenVDI -Name fwmachine* | Remove-XenVDI
  • 相关阅读:
    input文本框输入限制(正则表达式)
    SQL Server通用型分页存储过程
    简单易学的数据图表
    HTML中input文本框只读不可编辑的方法
    SQL添加外键约束的方式
    +1 也要睁着眼
    博客园的自定义皮肤
    网站收集整理
    jQuery extend方法介绍
    HTML5本地存储
  • 原文地址:https://www.cnblogs.com/Lina-zhu/p/9115659.html
Copyright © 2011-2022 走看看