|
Size: 2252
Comment:
|
Size: 2262
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 9: | Line 9: |
| get-host |
Contents
Install
Windows 2008R2
NetFramework4.5.2 or later
- Windows Management Framework 5.1
get-host 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
