Differences between revisions 5 and 7 (spanning 2 versions)
Revision 5 as of 2019-05-29 04:06:03
Size: 1504
Editor: localhost
Comment:
Revision 7 as of 2019-09-09 08:57:57
Size: 2252
Editor: 192
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
<<TableOfContents()>>
Line 19: Line 20:
Line 21: Line 23:
}}}

=== PowerCLI to quickly retrieve the time setting on all the hosts managed by specific vCenter instances ===
{{{
foreach ($esx in (get-vmhost)) {$esx.Name + " -> " + (get-view $esx.ExtensionData.ConfigManager.DateTimeSystem).QueryDateTime().ToLocalTime()}
Line 29: Line 36:
}}}

=== Deploy VMs from template PowerCLI Script ===
  * https://communities.vmware.com/thread/582052
{{{
Name IP SUBNET GATEWAY DNS1 DNS2 vmhost template cluster csm datastore
testVM1 192.168.1.2 255.255.240.0 192.168.1.1 192.168.1.7 192.168.1.8 testVMHost.domain.local testVMTemplate test VM Cluster testCustomizationSpec test Datastore
testVM2 192.168.1.3 255.255.240.0 192.169.1.1 192.168.1.7 192.168.1.8 testVMHost.domain.local testVMTemplate

Install

Windows 2008R2

Install-Module VMware.PowerCLI -Scope CurrentUser

Configration

Set-ExecutionPolicy RemoteSigned
Set-PowerCLIConfiguration -ProxyPolicy NoProxy
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

Use

Connect-VIServer -server 192.168.25.60 -Protocol https -Username 'administrator@vsphere.local'

PowerCLI to quickly retrieve the time setting on all the hosts managed by specific vCenter instances

foreach ($esx in (get-vmhost)) {$esx.Name + " -> " + (get-view $esx.ExtensionData.ConfigManager.DateTimeSystem).QueryDateTime().ToLocalTime()}

Script to list VM Network Adapter Type, exporting issue

Get-VM | Get-NetworkAdapter | 
Where-object {$_.Type -ne "Vmxnet3"} | 
Select @{N="VM";E={$_.Parent.Name}},Name,Type |
export-Csv  c:\Network_Interface.csv -NoTypeInformation

Deploy VMs from template PowerCLI Script

Name    IP      SUBNET  GATEWAY DNS1    DNS2    vmhost  template        cluster csm     datastore
testVM1 192.168.1.2     255.255.240.0   192.168.1.1     192.168.1.7     192.168.1.8     testVMHost.domain.local testVMTemplate  test VM Cluster testCustomizationSpec   test Datastore
testVM2 192.168.1.3     255.255.240.0   192.169.1.1     192.168.1.7     192.168.1.8     testVMHost.domain.local testVMTemplate

Get/Change CPUID

Winodws script

http://vknowledge.net/2014/04/17/how-to-fake-a-vms-guest-os-cpuid/

  • Enable excution

PS C:\Users\Administrator> Get-ExecutionPolicy
Restricted

PS C:\Users\Administrator>   set-executionpolicy remotesigned

执行策略更改
执行策略可以防止您执行不信任的脚本。更改执行策略可能会使您面临 about_Execution_Policies
帮助主题中所述的安全风险。是否要更改执行策略?
[Y] 是(Y)  [N] 否(N)  [S] 挂起(S)  [?] 帮助 (默认值为“Y”):
  • Get cpuid

PS C:\Users\Administrator> Get-WmiObject Win32_Processor | select ProcessorId

ProcessorId
-----------
0FABFBFF000106A5
0FABFBFF000006A5
  • convert HEX to ascii

désert/VMware/PowerCLI (last edited 2020-07-24 15:03:34 by localhost)