invoke-command -scriptblock { #using script block to bypass Execution Policy massage #install VMware.PowerCLI follow below steps #run powershell as admin #run the command to intall #Install-Module -Name VMware.PowerCLI #Install-Module VMware.PowerCLI -Scope CurrentUser #Set-executionpolicy remotesign #Import-Module VMware.PowerCLI #Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false #now install steps over restart powershell #To disable this warning and set your preference use the following command and restart PowerShell Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true -Confirm:$false #Connect to vCenter $Server = Connect-VIServer -Server 192.168.12.97 -User xxx@vsphere.local -Password xxxxxxxxxx #Gets the list of all Hosts in a specific folder $vmHosts = Get-VMHost -Location Singapore Foreach($vmHost in $vmHosts) { $vmHost.name $vms = Get-vmhost -name $vmHost.name | Get-VM | where { $_.PowerState -eq "PoweredOn"} Foreach ($vm in $vms){ #use condition if want to suspend specific vm if($vm.Name -eq "xx-xxx-Win2016-DevVM" -or $vm.Name -eq "xx-xxx-Win2016-TGS" -or $vm.Name -eq "xx-xxxx-Win10-HP") { Suspend-VM $vm -Confirm:$false -RunAsync sleep -Seconds 5 } } } Disconnect-VIServer -Server $Server -Confirm:$false read-host “Press ENTER to continue...” }
Disabled few selected items inside dropdown list based on model data Model return object list and By using template do the disable and on click false for selected items @(Html.Kendo().DropDownList() .Name("DateRange") .DataTextField("RangeNameDefault") .DataValueField("ID") .BindTo(Model.dashboardDateRangeList) .HtmlAttributes(new { style = "width: 100%" }) .Events(e => e.Change("DateRangeChange")) .Template( "<span class=\"#: !data.IsDataReady ? 'k-state-disabled': ''#\" onclick=\"#: !data.IsDataReady ? 'return false': ''#\"> #: data.RangeNameDefault #</span>"))
Comments
Post a Comment