powershell on centos 7
[root@puppet ~]# sudo curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 193 100 193 0 0 78 0 0:00:02 0:00:02 --:--:-- 79
[packages-microsoft-com-prod]
name=packages-microsoft-com-prod
baseurl=https://packages.microsoft.com/rhel/7/prod/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
[root@puppet ~]# yum install -y powershell
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* centos-sclo-rh: mirrors.piconets.webwerks.in
* centos-sclo-sclo: mirrors.piconets.webwerks.in
* epel: ftp.jaist.ac.jp
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
packages-microsoft-com-prod | 2.9 kB 00:00:00
packages-microsoft-com-prod/primary_db | 218 kB 00:00:04
Resolving Dependencies
--> Running transaction check
---> Package powershell.x86_64 0:6.2.3-1.rhel.7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Installing:
powershell x86_64 6.2.3-1.rhel.7 packages-microsoft-com-prod 54 M
Transaction Summary
======================================================================================================================================================
Install 1 Package
Total download size: 54 M
Installed size: 54 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/packages-microsoft-com-prod/packages/powershell-6.2.3-1.rhel.7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Public key for powershell-6.2.3-1.rhel.7.x86_64.rpm is not installed
powershell-6.2.3-1.rhel.7.x86_64.rpm | 54 MB 00:00:50
Importing GPG key 0xBE1229CF:
Userid : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
From : https://packages.microsoft.com/keys/microsoft.asc
Running transaction check
Running transaction
Installing : powershell-6.2.3-1.rhel.7.x86_64 1/1
Verifying : powershell-6.2.3-1.rhel.7.x86_64 1/1
Installed:
powershell.x86_64 0:6.2.3-1.rhel.7
Complete!
[root@puppet ~]# pwsh
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /root> $PSVersionTable.PSVersion
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
6 2 3
PS /root> Set-PSRepository -Name "PSGallery" -InstallationPolicy "Trusted"
PS /root> Find-Module "VMware.PowerCLI" | Install-Module -Scope "CurrentUser" -AllowClobber
PS /root> Get-Module "VMware.PowerCLI" -ListAvailable | FT -Autosize Directory: /root/.local/share/powershell/Modules ModuleType Version Name PSEdition ExportedCommands ---------- ------- ---- --------- ---------------- Manifest 11.4.0.14413515 VMware.PowerCLI Desk
PS /root> Get-Module "VMware.*" -ListAvailable | FT -Autosize
Directory: /root/.local/share/powershell/Modules
ModuleType Version Name PSEdition ExportedCommands
Script 6.7.0.11233116 VMware.ImageBuilder Desk {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxImageProfile, Exp…
Manifest 11.4.0.14413515 VMware.PowerCLI Desk
Script 6.7.0.13964812 VMware.Vim Desk
Script 11.3.0.13964830 VMware.VimAutomation.Cis.Core Desk {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 11.0.0.10379994 VMware.VimAutomation.Cloud Desk {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, Get-Catalog…}
Script 11.3.0.13964816 VMware.VimAutomation.Common Desk
Script 11.3.0.13964826 VMware.VimAutomation.Core Desk {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost…
Script 11.4.0.14413360 VMware.VimAutomation.Hcx Desk {Connect-HCXServer, Disconnect-HCXServer, Get-HCXAppliance, Get-HCXComputeP…
Script 7.9.0.14170454 VMware.VimAutomation.HorizonView Desk {Connect-HVServer, Disconnect-HVServer}
Script 11.3.0.13990093 VMware.VimAutomation.License Desk Get-LicenseDataManager
Script 11.3.0.13964817 VMware.VimAutomation.Nsxt Desk {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtPolicyService, Get-Nsxt…
Script 11.3.0.13964823 VMware.VimAutomation.Sdk Desk Get-ErrorReport
Script 11.0.0.10380515 VMware.VimAutomation.Security Desk {Get-SecurityInfo, Get-VTpm, Get-VTpmCertificate, Get-VTpmCSR…}
Script 11.2.0.12483605 VMware.VimAutomation.Srm Desk {Connect-SrmServer, Disconnect-SrmServer}
Script 11.4.0.14293163 VMware.VimAutomation.Storage Desk {Add-KeyManagementServer, Add-VsanObjectToRepairQueue, Copy-VDisk, Export-S…
Script 1.3.0.0 VMware.VimAutomation.StorageUtility Desk Update-VmfsDatastore
Script 11.2.0.12483615 VMware.VimAutomation.Vds Desk {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Export-VDPortGroup…
Script 11.3.0.13964814 VMware.VimAutomation.Vmc Desk {Connect-Vmc, Disconnect-Vmc, Get-VmcSddcNetworkService, Get-VmcService…}
Script 10.0.0.7893921 VMware.VimAutomation.vROps Desk {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-OMAlertDefinition…}
Script 6.5.1.7862888 VMware.VumAutomation Desk {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Compliance…}
PS /root> Update-Module "VMware.PowerCLI"
WARNING: Please consider joining the VMware Customer Experience Improvement Program, so you can help us make PowerCLI a better product. You can join using the following command:
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
VMware's Customer Experience Improvement Program ("CEIP") provides VMware with information that enables VMware to improve its products and services, to fix problems, and to advise you on how best to deploy and use our products. As part of the CEIP, VMware collects technical information about your odoes not personally identify any individual.
For more details: type "help about_ceip" to see the related help article.
To disable this warning and set your preference use the following command and restart PowerShell:
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true or $false.
Import-Module : VMware.VimAutomation.License module is not currently supported on the Core edition of PowerShell.
At line:1 char:1
+ Import-Module "VMware.PowerCLI"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (VMware.VimAutomatio\u2026tion of PowerShell.:String) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : VMware.VimAutomation.License module is not currently supported on the Core edition of PowerShell.,Microsoft.PowerShell.Commands.ImportModuleCommand
PS /root> Import-Module : VMware.VimAutomation.License
Import-Module : A positional parameter cannot be found that accepts argument 'VMware.VimAutomation.License'.
At line:1 char:1
+ Import-Module : VMware.VimAutomation.License
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Import-Module], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PS /root> Connect-VIServer -Server 192.168.0.109
Specify Credential
Please specify server credential
Password for user root: ******
Connect-VIServer : 10/5/19 7:21:12 PM Connect-VIServer The SSL connection could not be established, see inner exception.
At line:1 char:1
+ Connect-VIServer -Server 192.168.0.109
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViError
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_SoapException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
PS /root> Set-PowerCLIConfiguration -InvalidCertificateAction "Ignore"
Perform operation?
Performing operation 'Update PowerCLI configuration.'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeout
Seconds
----- ----------- ------------------- ------------------------ -------------------------- -------------------
Session UseSystemProxy Multiple Ignore True 300
User Ignore
AllUsers
PS /root> Connect-VIServer -Server 192.168.0.109
Specify Credential
Please specify server credential
User: root
Password for user root: ******
Name Port User
---- ---- ----
192.168.0.109 443 root
PS /root> Get-Folder
Name Type
---- ----
Datacenters Datacenter
vm VM
network Network
host HostAndCluster
datastore Datastore
Discovered virtual machine VM
vm HostAndCluster
PS /root> PS /root> Get-VM | Select Name,
>> @{N="Path";E={Get-Path -Object $_}}
Name Path
---- ----
vCenter Infrastructure Navigator
livekde1
ans-nginx01
ans-nginx02
ans-db01
ans-db02
tempt
testvm
vCenter_Hyperic_Server
vFabric_vPostgres_DB
PS /root>
PS /root> Get-VMHost | % {Get-View $_.ID} | % {$_.name; $nics = $_.config.network.pnic; foreach ($nic in $nics){$nic.device}}
192.168.0.106
vmnic0
PS /root>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 193 100 193 0 0 78 0 0:00:02 0:00:02 --:--:-- 79
[packages-microsoft-com-prod]
name=packages-microsoft-com-prod
baseurl=https://packages.microsoft.com/rhel/7/prod/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
[root@puppet ~]# yum install -y powershell
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* centos-sclo-rh: mirrors.piconets.webwerks.in
* centos-sclo-sclo: mirrors.piconets.webwerks.in
* epel: ftp.jaist.ac.jp
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
packages-microsoft-com-prod | 2.9 kB 00:00:00
packages-microsoft-com-prod/primary_db | 218 kB 00:00:04
Resolving Dependencies
--> Running transaction check
---> Package powershell.x86_64 0:6.2.3-1.rhel.7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Installing:
powershell x86_64 6.2.3-1.rhel.7 packages-microsoft-com-prod 54 M
Transaction Summary
======================================================================================================================================================
Install 1 Package
Total download size: 54 M
Installed size: 54 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/packages-microsoft-com-prod/packages/powershell-6.2.3-1.rhel.7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Public key for powershell-6.2.3-1.rhel.7.x86_64.rpm is not installed
powershell-6.2.3-1.rhel.7.x86_64.rpm | 54 MB 00:00:50
Importing GPG key 0xBE1229CF:
Userid : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
From : https://packages.microsoft.com/keys/microsoft.asc
Running transaction check
Running transaction
Installing : powershell-6.2.3-1.rhel.7.x86_64 1/1
Verifying : powershell-6.2.3-1.rhel.7.x86_64 1/1
Installed:
powershell.x86_64 0:6.2.3-1.rhel.7
Complete!
[root@puppet ~]# pwsh
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /root> $PSVersionTable.PSVersion
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
6 2 3
PS /root> Set-PSRepository -Name "PSGallery" -InstallationPolicy "Trusted"
PS /root> Find-Module "VMware.PowerCLI" | Install-Module -Scope "CurrentUser" -AllowClobber
PS /root> Get-Module "VMware.PowerCLI" -ListAvailable | FT -Autosize Directory: /root/.local/share/powershell/Modules ModuleType Version Name PSEdition ExportedCommands ---------- ------- ---- --------- ---------------- Manifest 11.4.0.14413515 VMware.PowerCLI Desk
PS /root> Get-Module "VMware.*" -ListAvailable | FT -Autosize
Directory: /root/.local/share/powershell/Modules
ModuleType Version Name PSEdition ExportedCommands
Script 6.7.0.11233116 VMware.ImageBuilder Desk {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxImageProfile, Exp…
Manifest 11.4.0.14413515 VMware.PowerCLI Desk
Script 6.7.0.13964812 VMware.Vim Desk
Script 11.3.0.13964830 VMware.VimAutomation.Cis.Core Desk {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 11.0.0.10379994 VMware.VimAutomation.Cloud Desk {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, Get-Catalog…}
Script 11.3.0.13964816 VMware.VimAutomation.Common Desk
Script 11.3.0.13964826 VMware.VimAutomation.Core Desk {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost…
Script 11.4.0.14413360 VMware.VimAutomation.Hcx Desk {Connect-HCXServer, Disconnect-HCXServer, Get-HCXAppliance, Get-HCXComputeP…
Script 7.9.0.14170454 VMware.VimAutomation.HorizonView Desk {Connect-HVServer, Disconnect-HVServer}
Script 11.3.0.13990093 VMware.VimAutomation.License Desk Get-LicenseDataManager
Script 11.3.0.13964817 VMware.VimAutomation.Nsxt Desk {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtPolicyService, Get-Nsxt…
Script 11.3.0.13964823 VMware.VimAutomation.Sdk Desk Get-ErrorReport
Script 11.0.0.10380515 VMware.VimAutomation.Security Desk {Get-SecurityInfo, Get-VTpm, Get-VTpmCertificate, Get-VTpmCSR…}
Script 11.2.0.12483605 VMware.VimAutomation.Srm Desk {Connect-SrmServer, Disconnect-SrmServer}
Script 11.4.0.14293163 VMware.VimAutomation.Storage Desk {Add-KeyManagementServer, Add-VsanObjectToRepairQueue, Copy-VDisk, Export-S…
Script 1.3.0.0 VMware.VimAutomation.StorageUtility Desk Update-VmfsDatastore
Script 11.2.0.12483615 VMware.VimAutomation.Vds Desk {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Export-VDPortGroup…
Script 11.3.0.13964814 VMware.VimAutomation.Vmc Desk {Connect-Vmc, Disconnect-Vmc, Get-VmcSddcNetworkService, Get-VmcService…}
Script 10.0.0.7893921 VMware.VimAutomation.vROps Desk {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-OMAlertDefinition…}
Script 6.5.1.7862888 VMware.VumAutomation Desk {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Compliance…}
PS /root> Update-Module "VMware.PowerCLI"
WARNING: Please consider joining the VMware Customer Experience Improvement Program, so you can help us make PowerCLI a better product. You can join using the following command:
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
VMware's Customer Experience Improvement Program ("CEIP") provides VMware with information that enables VMware to improve its products and services, to fix problems, and to advise you on how best to deploy and use our products. As part of the CEIP, VMware collects technical information about your odoes not personally identify any individual.
For more details: type "help about_ceip" to see the related help article.
To disable this warning and set your preference use the following command and restart PowerShell:
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true or $false.
Import-Module : VMware.VimAutomation.License module is not currently supported on the Core edition of PowerShell.
At line:1 char:1
+ Import-Module "VMware.PowerCLI"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (VMware.VimAutomatio\u2026tion of PowerShell.:String) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : VMware.VimAutomation.License module is not currently supported on the Core edition of PowerShell.,Microsoft.PowerShell.Commands.ImportModuleCommand
PS /root> Import-Module : VMware.VimAutomation.License
Import-Module : A positional parameter cannot be found that accepts argument 'VMware.VimAutomation.License'.
At line:1 char:1
+ Import-Module : VMware.VimAutomation.License
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Import-Module], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PS /root> Connect-VIServer -Server 192.168.0.109
Specify Credential
Please specify server credential
Password for user root: ******
Connect-VIServer : 10/5/19 7:21:12 PM Connect-VIServer The SSL connection could not be established, see inner exception.
At line:1 char:1
+ Connect-VIServer -Server 192.168.0.109
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViError
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_SoapException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
PS /root> Set-PowerCLIConfiguration -InvalidCertificateAction "Ignore"
Perform operation?
Performing operation 'Update PowerCLI configuration.'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeout
Seconds
----- ----------- ------------------- ------------------------ -------------------------- -------------------
Session UseSystemProxy Multiple Ignore True 300
User Ignore
AllUsers
PS /root> Connect-VIServer -Server 192.168.0.109
Specify Credential
Please specify server credential
User: root
Password for user root: ******
Name Port User
---- ---- ----
192.168.0.109 443 root
PS /root> Get-Folder
Name Type
---- ----
Datacenters Datacenter
vm VM
network Network
host HostAndCluster
datastore Datastore
Discovered virtual machine VM
vm HostAndCluster
PS /root> PS /root> Get-VM | Select Name,
>> @{N="Path";E={Get-Path -Object $_}}
Name Path
---- ----
vCenter Infrastructure Navigator
livekde1
ans-nginx01
ans-nginx02
ans-db01
ans-db02
tempt
testvm
vCenter_Hyperic_Server
vFabric_vPostgres_DB
PS /root>
PS /root> Get-Cluster $clusters | Get-VMHost
Name ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz MemoryUsageGB MemoryTotalGB Version
---- --------------- ---------- ------ ----------- ----------- ------------- ------------- -------
192.168.0.106 Connected PoweredOn 2 553 4588 1.127 1.999 5.5.0
Name ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz MemoryUsageGB MemoryTotalGB Version
---- --------------- ---------- ------ ----------- ----------- ------------- ------------- -------
192.168.0.106 Connected PoweredOn 2 553 4588 1.127 1.999 5.5.0
PS /root> Get-Datacenter | get-folder
Name Type
---- ----
vm VM
network Network
datastore Datastore
Discovered virtual machine VM
vm HostAndCluster
PS /root> get-datastore
Name FreeSpaceGB CapacityGB
---- ----------- ----------
datastore1 19.002 32.500
PS /root> get-datastore | get-vm
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
tempt PoweredOff 1 0.500
ans-nginx02 PoweredOff 1 0.250
ans-nginx01 PoweredOff 1 0.250
livekde1 PoweredOff 1 1.023
ans-db02 PoweredOff 1 1.102
ans-db01 PoweredOff 1 0.500
PS /root> Get-Datacenter | get-inventory
Name Type Id
---- ---- --
vm Folder Folder-group-v3
network Folder Folder-group-n6
host Folder Folder-group-h4
datastore Folder Folder-group-s5
vCenter Hyperic VApp VirtualApp-res…
Discovered virtual machine Folder Folder-group-v…
cluster Cluster ClusterCompute…
vm Folder Folder-group-h…
tempt VirtualMachine VirtualMachine…
ans-db02 VirtualMachine VirtualMachine…
ans-db01 VirtualMachine VirtualMachine…
ans-nginx02 VirtualMachine VirtualMachine…
ans-nginx01 VirtualMachine VirtualMachine…
livekde1 VirtualMachine VirtualMachine…
Resources ResourcePool ResourcePool-r…
192.168.0.106 VMHost HostSystem-hos…
PS /root> Get-ResourcePool
Name CpuSharesL CpuReserva CpuLimitMH MemSharesL MemReservationG MemLimitGB
evel tionMHz z evel B
---- ---------- ---------- ---------- ---------- --------------- ----------
Resources Normal 2707 2707 Normal 0.080 0.080
PS /root> Get-ResourcePool | get-view
Summary : VMware.Vim.ResourcePoolSummary
Runtime : VMware.Vim.ResourcePoolRuntimeInfo
Owner : ClusterComputeResource-domain-c321
resourcePool : {VirtualApp-resgroup-v334}
Vm : {VirtualMachine-vm-346, VirtualMachine-vm-345, VirtualMachine-vm-344, VirtualMachine-vm-347…}
Config : VMware.Vim.ResourceConfigSpec
ChildConfiguration : {VMware.Vim.ResourceConfigSpec, VMware.Vim.ResourceConfigSpec, VMware.Vim.ResourceConfigSpec, VMware.Vim.ResourceConfigSpec…}
LinkedView :
Parent : ClusterComputeResource-domain-c321
CustomValue : {}
OverallStatus : green
ConfigStatus : green
ConfigIssue : {}
EffectiveRole : {-1}
Permission : {}
Name : Resources
DisabledMethod : {CreateChildVM_Task, RegisterChildVM_Task}
RecentTask : {}
DeclaredAlarmState : {alarm-10.resgroup-322, alarm-11.resgroup-322, alarm-2.resgroup-322, alarm-23.resgroup-322…}
TriggeredAlarmState : {}
AlarmActionsEnabled : True
Tag : {}
Value : {}
AvailableField : {}
MoRef : ResourcePool-resgroup-322
Client : VMware.Vim.VimClientImpl
PS /root>
PS /root> Get-vm | Select-Object @{ Name="Status"; Expression={(Get-FloppyDrive -VM $_).ConnectionState.Connected}}, @{ Name="Name"; Expression={$_.Name}} | ft
Status Name
------ ----
False livekde1
False ans-nginx01
False ans-nginx02
False ans-db01
False ans-db02
tempt
PS /root>
PS /root> Get-View (Get-VM ans-db01).Id
Capability : VMware.Vim.VirtualMachineCapability
Config : VMware.Vim.VirtualMachineConfigInfo
Layout : VMware.Vim.VirtualMachineFileLayout
LayoutEx : VMware.Vim.VirtualMachineFileLayoutEx
Storage : VMware.Vim.VirtualMachineStorageInfo
EnvironmentBrowser : EnvironmentBrowser-envbrowser-346
ResourcePool : ResourcePool-resgroup-322
ParentVApp :
ResourceConfig : VMware.Vim.ResourceConfigSpec
Runtime : VMware.Vim.VirtualMachineRuntimeInfo
Guest : VMware.Vim.GuestInfo
Summary : VMware.Vim.VirtualMachineSummary
Datastore : {Datastore-datastore-342}
Network : {Network-network-343}
Snapshot :
RootSnapshot : {}
GuestHeartbeatStatus : gray
LinkedView :
Parent : Folder-group-v21
CustomValue : {}
OverallStatus : green
ConfigStatus : green
ConfigIssue : {}
EffectiveRole : {-1}
Permission : {}
Name : ans-db01
DisabledMethod : {MakePrimaryVM_Task, TerminateFaultTolerantVM_Task, RevertToCurrentSnapshot_Task, RemoveAllSnapshots_Task…}
RecentTask : {}
DeclaredAlarmState : {alarm-10.vm-346, alarm-11.vm-346, alarm-2.vm-346, alarm-23.vm-346…}
TriggeredAlarmState : {}
AlarmActionsEnabled : True
Tag : {}
Value : {}
AvailableField : {}
MoRef : VirtualMachine-vm-346
PS /root> get-vmhost 192.168.0.106 | Get-Inventory
Name Type Id
---- ---- --
ans-db01 VirtualMachine VirtualMachine…
ans-nginx01 VirtualMachine VirtualMachine…
livekde1 VirtualMachine VirtualMachine…
ans-db02 VirtualMachine VirtualMachine…
tempt VirtualMachine VirtualMachine…
ans-nginx02 VirtualMachine VirtualMachine…
vCenter Hyperic VApp VirtualApp-res…
PS /root>
Client : VMware.Vim.VimClientImpl
PS /root>
192.168.0.106
vmnic0
PS /root>
PS /root> Get-Cluster $cluster | Get-VM | Get-HardDisk
CapacityGB Persistence Filename
---------- ----------- --------
10.000 Persistent [datastore1] ans-db01/ans-db01_4.vmdk
10.000 Persistent [datastore1] ans-nginx01/ans-nginx01.vmdk
10.000 Persistent [datastore1] livekde1/livekde1_2.vmdk
10.000 Persistent [datastore1] ans-db02/ans-db02.vmdk
10.000 Persistent [datastore1] tempt/tempt.vmdk
10.000 Persistent [datastore1] ans-nginx02/ans-nginx02.vmdk
Comments
Post a Comment