├── .github └── workflows │ ├── docker-image-push.yml │ └── docker-image.yml ├── .gitignore ├── Dockerfile ├── LICENSE.txt ├── README.md ├── RELEASE.md └── docs ├── builddocs.ps1 ├── cmd_add.rst ├── cmd_connect.rst ├── cmd_copy.rst ├── cmd_disconnect.rst ├── cmd_dismount.rst ├── cmd_export.rst ├── cmd_format.rst ├── cmd_get.rst ├── cmd_import.rst ├── cmd_install.rst ├── cmd_invoke.rst ├── cmd_mount.rst ├── cmd_move.rst ├── cmd_new.rst ├── cmd_open.rst ├── cmd_remove.rst ├── cmd_restart.rst ├── cmd_set.rst ├── cmd_start.rst ├── cmd_stop.rst ├── cmd_suspend.rst ├── cmd_test.rst ├── cmd_update.rst ├── cmd_wait.rst ├── docker_install.rst ├── faq.rst ├── index.rst ├── intro.rst ├── known_issues.rst ├── launch.rst ├── linux_install.rst └── mac_install.rst /.github/workflows/docker-image-push.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | tags: 4 | - v* 5 | 6 | name: Dockerhub Push 7 | 8 | jobs: 9 | dockerhub-push: 10 | runs-on: ubuntu-22.04 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | - name: Build the Docker image 16 | run: | 17 | tagVer=$(basename "${{ github.ref }}") 18 | semVer=${tagVer:1} 19 | docker build . --file Dockerfile --tag vmware/powerclicore:${semVer} 20 | 21 | - name: Dockerhub push 22 | run: | 23 | tagVer=$(basename "${{ github.ref }}") 24 | semVer=${tagVer:1} 25 | docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} 26 | docker tag vmware/powerclicore:${semVer} vmware/powerclicore:latest 27 | docker push vmware/powerclicore:${semVer} 28 | docker push vmware/powerclicore:latest 29 | -------------------------------------------------------------------------------- /.github/workflows/docker-image.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | 11 | build: 12 | 13 | runs-on: ubuntu-22.04 14 | 15 | steps: 16 | - uses: actions/checkout@v2 17 | - name: Build the Docker image 18 | run: docker build . --file Dockerfile --tag powerclicore:$(date +%s) 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.vs 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/powershell:lts-ubuntu-20.04 2 | 3 | LABEL authors="atanas-dimitrov.atanasov@broadcom.com" 4 | 5 | # Set PowerShell Gallery Repository 6 | 7 | RUN pwsh -c 'Set-PSRepository -Name PSGallery -InstallationPolicy Trusted' 8 | 9 | 10 | # Add Commuunity Examples 11 | # Note: VMware.vSphere.SsoAdmin is removed and later installed from the PowerShell Gallery. 12 | 13 | WORKDIR /root 14 | 15 | ENV TZ=Etc/UTC 16 | RUN apt-get update && \ 17 | DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata 18 | 19 | RUN apt-get update && \ 20 | apt-get install -y --no-install-recommends git dnsutils && \ 21 | git clone https://github.com/vmware/PowerCLI-Example-Scripts.git && \ 22 | mkdir --parents /usr/local/share/powershell/Modules && \ 23 | mv ./PowerCLI-Example-Scripts/Modules/* /usr/local/share/powershell/Modules/ && \ 24 | rm -rf /usr/local/share/powershell/Modules/VMware.vSphere.SsoAdmin && \ 25 | apt-get remove -y git 26 | 27 | 28 | # Install PowerShell Modules 29 | ## Invoke-DscResource is no longer an experimental feature starting with PSDesiredStateConfiguration version 2.0.6 30 | 31 | RUN pwsh -c "Install-Module PSDesiredStateConfiguration -MinimumVersion 2.0.6" && \ 32 | pwsh -c "\$ProgressPreference = \"SilentlyContinue\"; Install-Module -Name VMware.PowerCLI" && \ 33 | pwsh -c "\$ProgressPreference = \"SilentlyContinue\"; Install-Module -Name VMware.vSphereDSC" && \ 34 | pwsh -c "\$ProgressPreference = \"SilentlyContinue\"; Install-Module -Name VMware.CloudServices" && \ 35 | pwsh -c "\$ProgressPreference = \"SilentlyContinue\"; Install-Module -Name VMware.vSphere.SsoAdmin" && \ 36 | pwsh -c "\$ProgressPreference = \"SilentlyContinue\"; Install-Module -Name PowerVCF" && \ 37 | pwsh -c "\$ProgressPreference = \"SilentlyContinue\"; Install-Module -Name PowerNSX" && \ 38 | pwsh -c "\$ProgressPreference = \"SilentlyContinue\"; Install-Module -Name PowervRA" && \ 39 | find / -name "net45" | xargs rm -rf 40 | 41 | 42 | # Install VMware.DeployAutomation dependencies 43 | 44 | RUN apt-get update && \ 45 | apt-get install -y --no-install-recommends wget build-essential libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.6 libgdm-dev libdb4o-cil-dev libpcap-dev && \ 46 | cd /usr/src && \ 47 | wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz && \ 48 | tar xzf Python-3.7.9.tgz && \ 49 | cd Python-3.7.9 && \ 50 | ./configure && \ 51 | make && \ 52 | make install 53 | 54 | # Install required pip modules and set python path 55 | RUN pip3 install six psutil lxml pyopenssl && \ 56 | pwsh -c "Set-PowerCLIConfiguration -PythonPath /usr/local/bin/python3 -Scope AllUsers -Confirm:\$false" 57 | 58 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | Copyright 2014 Docker, Inc. 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PowerCLI Core 2 | 3 | ## Overview 4 | 5 | A container image for VMware PowerCLI and supporting modules, community modules, and community script examples. 6 | 7 | This image includes the following components: 8 | 9 | Component | Description 10 | ---------|---------- 11 | [`VMware.PowerCLI`][vmware-powercli] | A collection of PowerShell modules for managing and automating VMware products. 12 | [`VMware.vSphereDSC`][vmware-vsphere-dsc] | PowerShell module for vSphere desired state configuration. 13 | `VMware.CloudServices` | PowerShell module for VMware Cloud Services. 14 | `VMware.vSphere.SsoAdmin` | PowerShell module for vCenter Single Sign-on. 15 | [`PowerVCF`][powervcf] | PowerShell module for VMware Cloud Foundation. 16 | [`PowerNSX`][powernsx] | PowerShell module for VMware NSX for vSphere. 17 | [PowerCLI Examples][powercli-examples] | A collection of community contributed PowerShell modules and scripts. 18 | 19 | ## Get Started 20 | 21 | Run the following to download the latest container [from Docker Hub][powerclicore-docker-hub]: 22 | 23 | ```bash 24 | docker pull vmware/powerclicore:latest 25 | ``` 26 | 27 | Run the following to download a specific version from Docker Hub: 28 | 29 | ```bash 30 | docker pull vmware/powerclicore:x.y.z 31 | ``` 32 | 33 | Open an interactive terminal: 34 | 35 | ```bash 36 | docker run --rm -it vmware/powerclicore 37 | ``` 38 | 39 | Run a local script: 40 | docker run --rm --entrypoint="/usr/bin/pwsh" -v ${PWD} 41 | ```bash 42 | docker run --rm --entrypoint="/usr/bin/pwsh" -v ~/scripts:/tmp/scripts vmware/powerclicore /tmp/scripts/example.ps1 43 | ``` 44 | 45 | Where `~/scripts` is the local directory path for your PowerShell scripts. 46 | 47 | For more methods, read [5 ways to a run PowerCLI script using the PowerCLI Docker Container][community-wlam-powerclicore] by William Lam. 48 | 49 | [powerclicore-docker-hub]: https://hub.docker.com/r/vmware/powerclicore 50 | [vmware-powercli]: https://developer.vmware.com/web/tool/vmware-powercli 51 | [vmware-vsphere-dsc]: https://github.com/vmware/dscr-for-vmware 52 | [powervcf]: https://vmware.github.io/powershell-module-for-vmware-cloud-foundation 53 | [powernsx]: https://powernsx.github.io 54 | [powervra]: https://github.com/jakkulabs/PowervRA 55 | [powercli-examples]: https://github.com/vmware/PowerCLI-Example-Scripts 56 | [community-wlam-powerclicore]: https://williamlam.com/2016/10/5-different-ways-to-run-powercli-script-using-powercli-core-docker-container.html 57 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # PowerCLI Core 2 | We publish this docker image on docker hub tagging a new version with `latest` and `` tags 3 | 4 | We use the PowerCLI version for the docker images to recognize what is the installed PowerCLI version on the docker image. 5 | 6 | To create and publish a new version, do: 7 | 1. Update Dockerfile if needed with a merge request. 8 | 2. Push a git tag on the master branch with name `v..` 9 | 3. The github action named `Dockerhub Push` will take care to build and push the new docker image with both `latest` and `..` tags 10 | -------------------------------------------------------------------------------- /docs/builddocs.ps1: -------------------------------------------------------------------------------- 1 | 2 | Get-Module -Listavailable PowerCLI* | Import-Module -Force 3 | $verbs = (Get-Command -Module PowerCLI*).Verb | Select-Object -Unique 4 | 5 | foreach ($verb in $verbs) 6 | { 7 | $data = @() 8 | $data += "$verb Commands" 9 | $data += '=========================' 10 | $data += '' 11 | $data += "This page contains details on **$verb** commands." 12 | $data += '' 13 | foreach ($help in (Get-Command -Module PowerCLI* | Where-Object -FilterScript { 14 | $_.name -like "$verb-*" 15 | })) 16 | { 17 | $data += $help.Name 18 | $data += '-------------------------' 19 | $data += '' 20 | $data += Get-Help -Name $help.name -Detailed 21 | $data += '' 22 | } 23 | 24 | $data | Out-File -FilePath "$PSScriptRoot\cmd_$($verb.ToLower()).rst" -Encoding utf8 25 | Write-Host " cmd_$($verb.ToLower())" 26 | } -------------------------------------------------------------------------------- /docs/cmd_add.rst: -------------------------------------------------------------------------------- 1 | Add Commands 2 | ========================= 3 | 4 | This page contains details on **Add** commands. 5 | 6 | Add-PassthroughDevice 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Add-PassthroughDevice 12 | 13 | SYNOPSIS 14 | This cmdlet attaches pass-through devices to the specified virtual machine. 15 | 16 | 17 | SYNTAX 18 | Add-PassthroughDevice [-VM] [-PassthroughDevice] [-Server ] [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet attaches pass-through devices to the specified virtual machine. Note that the value of the ControllerKey property of the returned device might not be up to date, if a new 23 | SCSI controller creation process is running in the background. 24 | 25 | 26 | PARAMETERS 27 | -VM 28 | Specifies the virtual machine to which you want to attach the passthrough devices. 29 | 30 | -PassthroughDevice 31 | Specifies the passthrough devices you want to add to the virtual machine. 32 | 33 | -Server 34 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 35 | about default servers, see the description of Connect-VIServer. 36 | 37 | -WhatIf 38 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 39 | 40 | -Confirm 41 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 42 | 43 | 44 | This cmdlet supports the common parameters: Verbose, Debug, 45 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 46 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 47 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 48 | 49 | -------------- Example 1 -------------- 50 | 51 | C:\PS>$scsiDeviceList = Get-PassthroughDevice -VMHost Host -Type Scsi 52 | 53 | Add-PassthroughDevice -VM $vm -PassthroughDevice $scsiDeviceList[0] 54 | 55 | Adds the first SCSI passthrough device of the Host host to the $vm virtual machine. 56 | 57 | 58 | 59 | 60 | REMARKS 61 | To see the examples, type: "get-help Add-PassthroughDevice -examples". 62 | For more information, type: "get-help Add-PassthroughDevice -detailed". 63 | For technical information, type: "get-help Add-PassthroughDevice -full". 64 | For online help, type: "get-help Add-PassthroughDevice -online" 65 | 66 | Add-VDSwitchPhysicalNetworkAdapter 67 | ------------------------- 68 | 69 | NAME 70 | Add-VDSwitchPhysicalNetworkAdapter 71 | 72 | SYNOPSIS 73 | This cmdlet adds host physical network adapters to a vSphere distributed switch. 74 | 75 | 76 | SYNTAX 77 | Add-VDSwitchPhysicalNetworkAdapter [-VMHostPhysicalNic] [-DistributedSwitch] [-VirtualNicPortgroup ] [-VMHostVirtualNic 78 | ] [-Server ] [-WhatIf] [-Confirm] [] 79 | 80 | 81 | DESCRIPTION 82 | This cmdlet adds host physical network adapters to a vSphere distributed switch. 83 | 84 | 85 | PARAMETERS 86 | -VMHostPhysicalNic 87 | Specifies the host physical network adapters that you want to add or migrate to the vSphere distributed switch. 88 | 89 | -DistributedSwitch 90 | Specifies the vSphere distributed switch to which you want to add the host physical network adapter. 91 | 92 | -VirtualNicPortgroup 93 | Specifies the port groups to which to attach the host virtual network adapters. Accepts either one port group, or the same number of port groups as the number of virtual network 94 | adapters specified. If one port group is specified, all adapters are attached to that port group. If the same number of port groups as the number of virtual network adapters are 95 | specified, the first adapter is attached to the first port group, the second adapter - to the second port group, and so on. 96 | 97 | -VMHostVirtualNic 98 | Specifies the host virtual network adapters to be migrated along with the physical adapter, so that their connectivity is preserved. 99 | 100 | -Server 101 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 102 | default servers, see the description of Connect-VIServer. 103 | 104 | -WhatIf 105 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 106 | 107 | -Confirm 108 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 109 | 110 | 111 | This cmdlet supports the common parameters: Verbose, Debug, 112 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 113 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 114 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 115 | 116 | -------------- Example 1 -------------- 117 | 118 | C:\PS>$vmhostNetworkAdapter = Get-VMHost "MyVMHost" | Get-VMHostNetworkAdapter -Physical -Name vmnic2 119 | Get-VDSwitch "MyVDSwitch" | Add-VDSwitchPhysicalNetworkAdapter -VMHostPhysicalNic $vmhostNetworkAdapter 120 | 121 | Retrieves the specified physical network adapter from the specified host and adds it to the specified vSphere distributed switch. 122 | 123 | 124 | 125 | 126 | -------------- Example 2 -------------- 127 | 128 | C:\PS>$myVMHost = Get-VMHost "MyVMHost" 129 | $physicalNic = Get-VMHostNetworkAdapter -VMHost $myVMHost -Name "vmnic0" 130 | $virtualNic = Get-VMHostNetworkAdapter -VMHost $myVMHost -Name "vmk0" 131 | Get-VDSwitch -Name "MyVDSwitch" | Add-VDSwitchPhysicalNetworkAdapter -VMHostPhysicalNic $physicalNic -VMHostVirtualNic $virtualNic -VirtualNicPortgroup 'MyVDPortGroup' 132 | 133 | Migrates a host physical network adapter and a virtual network adapter to a vSphere distributed switch. 134 | 135 | 136 | 137 | 138 | REMARKS 139 | To see the examples, type: "get-help Add-VDSwitchPhysicalNetworkAdapter -examples". 140 | For more information, type: "get-help Add-VDSwitchPhysicalNetworkAdapter -detailed". 141 | For technical information, type: "get-help Add-VDSwitchPhysicalNetworkAdapter -full". 142 | For online help, type: "get-help Add-VDSwitchPhysicalNetworkAdapter -online" 143 | 144 | Add-VDSwitchVMHost 145 | ------------------------- 146 | 147 | NAME 148 | Add-VDSwitchVMHost 149 | 150 | SYNOPSIS 151 | This cmdlet adds hosts to the specified vSphere distributed switch. 152 | 153 | 154 | SYNTAX 155 | Add-VDSwitchVMHost -VDSwitch -VMHost [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 156 | 157 | 158 | DESCRIPTION 159 | This cmdlet adds hosts to the specified vSphere distributed switch. The physical network adapters of the hosts are not connected to the vSphere distributed switch. 160 | 161 | 162 | PARAMETERS 163 | -VDSwitch 164 | Specifies the vSphere distributed switch to which you want to add one or more hosts. 165 | 166 | -VMHost 167 | Specifies the hosts that you want to add to the vSphere distributed switch. 168 | 169 | -Server 170 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 171 | default servers, see the description of Connect-VIServer. 172 | 173 | -RunAsync 174 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 175 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 176 | 177 | -WhatIf 178 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 179 | 180 | -Confirm 181 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 182 | 183 | 184 | This cmdlet supports the common parameters: Verbose, Debug, 185 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 186 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 187 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 188 | 189 | -------------- Example 1 -------------- 190 | 191 | C:\PS>Get-VDSwitch -Name "MyDistributedSwitch" | Add-VDSwitchVMHost -VMHost "VMHost1", "VMHost2" 192 | 193 | Adds two hosts to the specified vSphere distributed switch. 194 | 195 | 196 | 197 | 198 | REMARKS 199 | To see the examples, type: "get-help Add-VDSwitchVMHost -examples". 200 | For more information, type: "get-help Add-VDSwitchVMHost -detailed". 201 | For technical information, type: "get-help Add-VDSwitchVMHost -full". 202 | For online help, type: "get-help Add-VDSwitchVMHost -online" 203 | 204 | Add-VirtualSwitchPhysicalNetworkAdapter 205 | ------------------------- 206 | 207 | NAME 208 | Add-VirtualSwitchPhysicalNetworkAdapter 209 | 210 | SYNOPSIS 211 | This cmdlet adds a host physical NIC to a standard virtual switch. 212 | 213 | 214 | SYNTAX 215 | Add-VirtualSwitchPhysicalNetworkAdapter [-VMHostPhysicalNic] [-VirtualSwitch] [-VirtualNicPortgroup ] [-VMHostVirtualNic 216 | ] [-Server ] [-WhatIf] [-Confirm] [] 217 | 218 | 219 | DESCRIPTION 220 | This cmdlet adds a host physical NIC to a standard virtual switch. If VMHost virtual network adapters are specified, the cmdlet migrates them to the virtual switch as well. 221 | 222 | Note: If VMHost virtual network adapters are specified, the cmdlet migrates them to the respective port groups or creates new ones if VirtualNicPortgroup is not specified. 223 | 224 | 225 | PARAMETERS 226 | -VMHostPhysicalNic 227 | Specifies the host physical network adapters that you want to add or migrate to the standard virtual switch. 228 | 229 | -VirtualSwitch 230 | Specifies the standard virtual switch to which you want to migrate physical or virtual network adapters. 231 | 232 | -VirtualNicPortgroup 233 | Specifies the port groups to which to attach the host virtual network adapters. Accepts the same number of port groups as the number of virtual network adapters specified. The first 234 | adapter is attached to the first port group, the second adapter - to the second port group, and so on. 235 | 236 | -VMHostVirtualNic 237 | Specifies the host virtual network adapters to be migrated along with the physical adapter, so that their connectivity is preserved. 238 | 239 | -Server 240 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 241 | default servers, see the description of Connect-VIServer. 242 | 243 | -WhatIf 244 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 245 | 246 | -Confirm 247 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 248 | 249 | 250 | This cmdlet supports the common parameters: Verbose, Debug, 251 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 252 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 253 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 254 | 255 | -------------- Example 1 -------------- 256 | 257 | C:\PS>$myVMHostNetworkAdapter = Get-VMhost "MyVMHost" | Get-VMHostNetworkAdapter -Physical -Name vmnic2 258 | Get-VirtualSwitch "MyVirtualSwitch" | Add-VirtualSwitchPhysicalNetworkAdapter -VMHostPhysicalNic $myVMHostNetworkAdapter 259 | 260 | Adds a VMHost physical network adapter to the specified distributed switch. 261 | 262 | 263 | 264 | 265 | -------------- Example 2 -------------- 266 | 267 | C:\PS>$myVMHost = Get-VMHost 'MyVMHost' 268 | $myVDSwitch = Get-VDSwitch 'MyVDSwitch' 269 | $physicalNic = Get-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -Name 'vmnic0' 270 | $virtualNic = Get-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -Name 'vmk0' 271 | $myStandardSwitch = Get-VirtualSwitch -VMHost $myVMHost -Name 'vSwitch0' 272 | Add-VirtualSwitchPhysicalNetworkAdapter -VirtualSwitch $myStandardSwitch -VMHostPhysicalNic $physicalNic -VMHostVirtualNic $virtualNic 273 | 274 | Migrates VMHost physical and virtual network adapters from a distributed virtual switch to a standard virtual switch. 275 | 276 | 277 | 278 | 279 | REMARKS 280 | To see the examples, type: "get-help Add-VirtualSwitchPhysicalNetworkAdapter -examples". 281 | For more information, type: "get-help Add-VirtualSwitchPhysicalNetworkAdapter -detailed". 282 | For technical information, type: "get-help Add-VirtualSwitchPhysicalNetworkAdapter -full". 283 | For online help, type: "get-help Add-VirtualSwitchPhysicalNetworkAdapter -online" 284 | 285 | Add-VMHost 286 | ------------------------- 287 | 288 | NAME 289 | Add-VMHost 290 | 291 | SYNOPSIS 292 | This cmdlet adds a host to be managed by a vCenter Server system. 293 | 294 | 295 | SYNTAX 296 | Add-VMHost [-Name] [-Port ] [-Location] [-Credential ] [-User ] [-Password ] [-Force] [-RunAsync] [-Server ] 297 | [-WhatIf] [-Confirm] [] 298 | 299 | 300 | DESCRIPTION 301 | This cmdlet adds a host to be managed by a vCenter Server system. The host is added to the datacenter or folder specified by the Location parameter. One of the User/Password and 302 | Credential parameters must be provided in order to authenticate with the host. If both are specified, the Credential parameter is used and the User and Password parameters are ignored. 303 | 304 | 305 | PARAMETERS 306 | -Name 307 | Specifies the name of the host you want to add to a vCenter Server system. 308 | 309 | -Port 310 | Specifies the port on the host you want to use for the connection. 311 | 312 | -Location 313 | Specifies a datacenter or folder where you want to place the host. 314 | 315 | -Credential 316 | Specifies a PSCredential object that contains credentials for authenticating with the virtual machine host. 317 | 318 | -User 319 | Specifies the user name you want to use for authenticating with the host. 320 | 321 | -Password 322 | Specifies the password you want to use for authenticating with the host. 323 | 324 | -Force 325 | Indicates that the cmdlet runs even if the authenticity of the host SSL certificate cannot be verified. 326 | 327 | -RunAsync 328 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 329 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 330 | 331 | -Server 332 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 333 | about default servers, see the description of Connect-VIServer. 334 | 335 | -WhatIf 336 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 337 | 338 | -Confirm 339 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 340 | 341 | 342 | This cmdlet supports the common parameters: Verbose, Debug, 343 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 344 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 345 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 346 | 347 | -------------- Example 1 -------------- 348 | 349 | C:\PS>$myServer = Connect-VIServer -Server 10.23.112.235 350 | Add-VMHost -Server $myServer -Name MyVMHost1 -Location MyDatacenter1 -User MyUsername1 -Password MyPassword1 351 | 352 | Adds a VM host to a specified vCenter Server system and provides a username and password for authentication. 353 | 354 | 355 | 356 | 357 | -------------- Example 2 -------------- 358 | 359 | C:\PS>$myCredentials = Get-VICredentialStoreItem -File "C:\MyCredentials.xml" 360 | $myServer = Connect-VIServer -Server 10.23.112.235 361 | Add-VMHost -Server $myServer -Name MyVMHost1 -Location MyDatacenter1 -Credentials $myCredentials 362 | 363 | Adds a VM host to a vCenter Server system and specifies a PSCredential object that contains authentication credentials. 364 | 365 | 366 | 367 | 368 | -------------- Example 3 -------------- 369 | 370 | C:\PS>$myCredentials = Get-VICredentialStoreItem -File "C:\MyCredentials.xml" 371 | $myServer = Connect-VIServer -Server 10.23.112.235 372 | Add-VMHost -Server $server -Name MyVMHost1 -Location MyDatacenter1 -Credentials $myCredentials -Port MyVMHostPortNumber1 -Confirm:$false 373 | 374 | Adds a VM host to a vCenter Server system without asking for confirmation and specifies a port on the host for connecting. 375 | 376 | 377 | 378 | 379 | -------------- Example 4 -------------- 380 | 381 | C:\PS>$myCredentials = Get-VICredentialStoreItem -File "C:\MyCredentials.xml" 382 | $myServer = Connect-VIServer -Server 10.23.112.235 383 | Add-VMHost -Server $myServer -Name MyVMHost1 -Location MyDataCenter1 -Credentials $myCredentials -Port MyVMHostPortNumber1 -Force 384 | 385 | Adds a VM host to a vCenter Server system even if the authenticity of the host SSL certificate cannot be verified. 386 | 387 | 388 | 389 | 390 | REMARKS 391 | To see the examples, type: "get-help Add-VMHost -examples". 392 | For more information, type: "get-help Add-VMHost -detailed". 393 | For technical information, type: "get-help Add-VMHost -full". 394 | For online help, type: "get-help Add-VMHost -online" 395 | 396 | Add-VMHostNtpServer 397 | ------------------------- 398 | 399 | NAME 400 | Add-VMHostNtpServer 401 | 402 | SYNOPSIS 403 | This cmdlet adds the specified NTP servers to the NTP server list of the specified hosts. 404 | 405 | 406 | SYNTAX 407 | Add-VMHostNtpServer [-NtpServer] [-VMHost] [-Server ] [-WhatIf] [-Confirm] [] 408 | 409 | 410 | DESCRIPTION 411 | This cmdlet adds the specified NTP servers to the NTP server list of the specified hosts. If a server is already in the list, a non-terminating error is generated and a duplicate is not 412 | created. 413 | 414 | 415 | PARAMETERS 416 | -NtpServer 417 | Specifies the domain name or the IP address of the NTP server you want to add to the host. 418 | 419 | -VMHost 420 | Specifies a host to which you want to add the NTP server. 421 | 422 | -Server 423 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 424 | about default servers, see the description of Connect-VIServer. 425 | 426 | -WhatIf 427 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 428 | 429 | -Confirm 430 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 431 | 432 | 433 | This cmdlet supports the common parameters: Verbose, Debug, 434 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 435 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 436 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 437 | 438 | -------------- Example 1 -------------- 439 | 440 | C:\PS>Add-VmHostNtpServer -NtpServer "ntp-server-name.com" -VMHost $vmhost 441 | 442 | Adds the NTP server with a domain name "ntp-server-name.com" to the virtual machine hosts stored in the $vmhost variable. 443 | 444 | 445 | 446 | 447 | -------------- Example 2 -------------- 448 | 449 | C:\PS>Add-VmHostNtpServer -NtpServer "192.168.1.5" -VMHost (Get-VMHost) 450 | 451 | Adds the NTP server with an IP address "192.168.1.5" to the virtual machine hosts pipelined through the Get-VMHost cmdlet. 452 | 453 | 454 | 455 | 456 | REMARKS 457 | To see the examples, type: "get-help Add-VMHostNtpServer -examples". 458 | For more information, type: "get-help Add-VMHostNtpServer -detailed". 459 | For technical information, type: "get-help Add-VMHostNtpServer -full". 460 | For online help, type: "get-help Add-VMHostNtpServer -online" 461 | 462 | 463 | 464 | -------------------------------------------------------------------------------- /docs/cmd_connect.rst: -------------------------------------------------------------------------------- 1 | Connect Commands 2 | ========================= 3 | 4 | This page contains details on **Connect** commands. 5 | 6 | Connect-VIServer 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Connect-VIServer 12 | 13 | SYNOPSIS 14 | This cmdlet establishes a connection to a vCenter Server system. 15 | 16 | 17 | SYNTAX 18 | Connect-VIServer [-Server] [-Port ] [-Protocol ] [-Credential ] [-User ] [-Password ] [-Session ] [-NotDefault] 19 | [-SaveCredentials] [-AllLinked] [-Force] [] 20 | 21 | Connect-VIServer -Menu [] 22 | 23 | 24 | DESCRIPTION 25 | This cmdlet establishes a connection to a vCenter Server system. The cmdlet starts a new session or re-establishes a previous session with a vCenter Server system using the specified 26 | parameters. 27 | 28 | When you attempt to connect to a server, the server checks for valid certificates. To set the default behavior of vSphere PowerCLI when no valid certificates are recognized, use the 29 | InvalidCertificateAction parameter of the Set-PowerCLIConfiguration cmdlet. For more information about invalid certificates, run 'Get-Help about_invalid_certificates'. 30 | 31 | You can have more than one connections to the same server. To disconnect from a server, you need to close all active connections to this server. 32 | vSphere PowerCLI supports working with multiple default servers. If you select this option, every time when you connect to a different server using Connect-VIServer, the new server 33 | connection is stored in an array variable together with the previously connected servers, unless the NotDefault parameter is set. This variable is named $DefaultVIServers and its 34 | initial value is an empty array. When you run a cmdlet and the target servers cannot be determined from the specified parameters, the cmdlet runs against all servers stored in the array 35 | variable. To remove a server from the $DefaultVIServers variable, you can either use Disconnect-Server to close all active connections to the server, or modify the value of 36 | $DefaultVIServers manually. 37 | 38 | If you choose to work with a single default server, when you run a cmdlet and the target servers cannot be determined from the specified parameters, the cmdlet runs against the last 39 | connected server. This server is stored in the $defaultVIServer variable, which is updated every time you establish a new connection. 40 | 41 | To switch between single and multiple default servers working mode, use DefaultServerMode parameter of the Set-PowerCLIConfiguration cmdlet. Working with multiple default servers will 42 | be enabled by default in a future release. 43 | 44 | 45 | PARAMETERS 46 | -Server 47 | Specifies the IP address or the DNS name of the vSphere server to which you want to connect. You can also specify a server by providing its IPv6 address enclosed in square brackets, 48 | for example [fe80::250:56ff:feb0:74bd%4]. 49 | 50 | -Port 51 | Specifies the port on the server you want to use for the connection. 52 | 53 | -Protocol 54 | Specifies the Internet protocol you want to use for the connection. It can be either http or https. 55 | 56 | -Credential 57 | Specifies a PSCredential object that contains credentials for authenticating with the server. For more information about the server authentication logic of PowerCLI, run "help 58 | about_server_authentication". Passing values to this parameter through a pipeline is deprecated and will be disabled in a future release. 59 | 60 | -User 61 | Specifies the user name you want to use for authenticating with the server. If the Credential parameter is also specified, this parameter is ignored. For more information about the 62 | server authentication logic of PowerCLI, run "help about_server_authentication". Passing values to this parameter through a pipeline is deprecated and will be disabled in a future 63 | release. 64 | 65 | Note: If the user name contains special characters, enclose the entire string in single quotes ('). 66 | 67 | -Password 68 | Specifies the password you want to use for authenticating with the server. If the Credential parameter is also specified, this parameter is ignored. For more information about the 69 | server authentication logic of PowerCLI, run "help about_server_authentication". 70 | 71 | Note: If the password contains special characters, enclose the entire string in single quotes ('). 72 | 73 | -Session 74 | Specifies the ID of an existing vCenter Server session you want to reestablish. 75 | 76 | -NotDefault 77 | Indicates that you do not want to include the server to which you connect into the $defaultVIServers variable. 78 | 79 | -SaveCredentials 80 | Indicates that you want to save the specified credentials in the local credential store. 81 | 82 | -AllLinked 83 | Indicates whether you want to connect to vCenter Server in linked mode. If you specify $true for the AllLinked parameter and the server to which you want to connect is a part of a 84 | federation vCenter Server, you'll be connected to all members of the linked vCenter Server. 85 | 86 | To use this option, PowerCLI must be configured to work in multiple servers connection mode. To configure PowerCLI to support multiple servers connection, specify Multiple for the 87 | DefaultVIServerMode parameter of the Set-PowerCLI Configuration cmdlet. 88 | 89 | -Force 90 | Suppresses all user interface prompts during the cmdlet execution. Currently these include 'Multiple default servers' and 'Invalid certificate action'. 91 | 92 | -Menu 93 | Indicates that you want to select a connection server from a list of recently connected servers. If Menu is set to $true, the cmdlet retrieves a list of the last visited servers and 94 | enters a nested command prompt, so that you can select a server from the list. 95 | 96 | 97 | This cmdlet supports the common parameters: Verbose, Debug, 98 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 99 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 100 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 101 | 102 | -------------- Example 1 -------------- 103 | 104 | C:\PS>Connect-VIServer -Server 10.23.112.235 -Protocol https -User admin -Password pass 105 | 106 | Connects to a vSphere server using the User and Password parameters. 107 | 108 | 109 | 110 | 111 | -------------- Example 2 -------------- 112 | 113 | C:\PS>Connect-VIServer Server -Credential $myCredentialsObject -Port 1234 114 | 115 | Connects to a vSphere server by using a credential object. 116 | 117 | 118 | 119 | 120 | -------------- Example 3 -------------- 121 | 122 | C:\PS>Connect-VIServer "Server" -SessionId $sessionId 123 | 124 | Connect by using a server session ID. 125 | Once you connect to a server, you can save the session ID - $serverObject.SessionId, so that you can restore the existing server connection instead of reconnecting. 126 | 127 | 128 | 129 | 130 | -------------- Example 4 -------------- 131 | 132 | C:\PS>Connect-VIServer Server 133 | 134 | Connect by using integrated authentication. In this case, the credentials you are logged on to your machine must be the same as those for the server. 135 | 136 | 137 | 138 | 139 | -------------- Example 5 -------------- 140 | 141 | C:\PS>Connect-VIServer "Server" -User user -Password pass -SaveCredentials 142 | 143 | Connect to a server and save the credentials in the credential store. After the credentials are stored, you can connect to the server without specifying them. To get a previously saved 144 | credential store item, use the Get-VICredentialStoreItem cmdlet. 145 | 146 | 147 | 148 | 149 | -------------- Example 6 -------------- 150 | 151 | C:\PS>Connect-VIServer -Menu 152 | 153 | Connect to a server by choosing the server address from a list of previously connected servers. 154 | 155 | 156 | 157 | 158 | -------------- Example 7 -------------- 159 | 160 | C:\PS>Connect-VIServer "Server" -AllLinked 161 | 162 | Connect to a vSphere server which is a part of a federation vCenter Server. This will Connect you to all vSphere servers in the federation as well. 163 | 164 | 165 | 166 | 167 | REMARKS 168 | To see the examples, type: "get-help Connect-VIServer -examples". 169 | For more information, type: "get-help Connect-VIServer -detailed". 170 | For technical information, type: "get-help Connect-VIServer -full". 171 | For online help, type: "get-help Connect-VIServer -online" 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /docs/cmd_copy.rst: -------------------------------------------------------------------------------- 1 | Copy Commands 2 | ========================= 3 | 4 | This page contains details on **Copy** commands. 5 | 6 | Copy-DatastoreItem 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Copy-DatastoreItem 12 | 13 | SYNOPSIS 14 | This cmdlet copies items between datastores and between a datastore and a local file system provider. 15 | 16 | 17 | SYNTAX 18 | Copy-DatastoreItem [-Item] [[-Destination] ] [-Force] [-PassThru] [-Recurse] [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet copies items between datastores and between a datastore and a local file system provider. 23 | 24 | 25 | PARAMETERS 26 | -Item 27 | Specifies the datastore item you want to copy. You can use a string to provide a relative path to the item in the current provider location. 28 | 29 | -Destination 30 | Specifies the destination where you want to copy the datastore item. You can use a string to specify a relative path to the destination object in the current provider location. 31 | 32 | -Force 33 | Indicates whether to overwrite all items with the same name at the provided destination. 34 | 35 | -PassThru 36 | Indicates that the cmdlet returns the copied item. 37 | 38 | -Recurse 39 | Indicates that you want to copy not only the item, but its children items as well. 40 | 41 | -WhatIf 42 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 43 | 44 | -Confirm 45 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 46 | 47 | 48 | This cmdlet supports the common parameters: Verbose, Debug, 49 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 50 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 51 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 52 | 53 | -------------- Example 1 -------------- 54 | 55 | C:\PS>Copy-DatastoreItem vmstore:\Datacenter\Storage1\MyVM\* c:\VMFolder\MyVM\ 56 | 57 | Copies the contents of a datastore folder in a local folder. 58 | 59 | 60 | 61 | 62 | -------------- Example 2 -------------- 63 | 64 | C:\PS>Copy-DatastoreItem c:\VMFolder\MyVM\* vmstore:\Datacenter\Storage1\NewVM\ -Force 65 | 66 | Copies the contents of a local folder into a datastore folder. If the destination folder does not exist, the Force parameter enforces its creation. 67 | 68 | 69 | 70 | 71 | -------------- Example 3 -------------- 72 | 73 | C:\PS>Copy-DatastoreItem c:\VMFolder\* vmstore:\Datacenter\Storage1\VMs\ -Force -Recurse 74 | 75 | Copies recursively the contents of a local folder into a datastore folder. 76 | 77 | 78 | 79 | 80 | -------------- Example 4 -------------- 81 | 82 | C:\PS>Copy-DatastoreItem Windows.ISO vmstore:\Datacenter\Storage1\ISOFiles\WinXPSP3.iso 83 | 84 | Copies a file into a datastore folder and changes the file name. 85 | 86 | 87 | 88 | 89 | REMARKS 90 | To see the examples, type: "get-help Copy-DatastoreItem -examples". 91 | For more information, type: "get-help Copy-DatastoreItem -detailed". 92 | For technical information, type: "get-help Copy-DatastoreItem -full". 93 | For online help, type: "get-help Copy-DatastoreItem -online" 94 | 95 | Copy-HardDisk 96 | ------------------------- 97 | 98 | NAME 99 | Copy-HardDisk 100 | 101 | SYNOPSIS 102 | Copies a virtual hard disk to another destination. 103 | 104 | 105 | SYNTAX 106 | Copy-HardDisk [-HardDisk] [-DestinationPath] [-DestinationStorageFormat ] [-Force] [-RunAsync] [-WhatIf] [-Confirm] [] 107 | 108 | 109 | DESCRIPTION 110 | Copies a virtual hard disk to another destination specified by the DestinationPath parameter. DestinationPath must be a datastore path to the destination folder. 111 | 112 | 113 | PARAMETERS 114 | -HardDisk 115 | Specifies the virtual hard disk you want to copy. 116 | 117 | -DestinationPath 118 | Specifies the datastore path to the folder where you want to copy the hard disk. The datastore name is included in the path in square braces. 119 | 120 | -DestinationStorageFormat 121 | Specifies the type of the hard disk copy. The valid values are Thin, Thick, and EagerZeroedThick. This parameter is only applicable when you are connected to an ESX/ESXi host. 122 | 123 | -Force 124 | Indicates whether to overwrite all disks with the same name at the provided destination. 125 | 126 | -RunAsync 127 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 128 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 129 | 130 | -WhatIf 131 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 132 | 133 | -Confirm 134 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 135 | 136 | 137 | This cmdlet supports the common parameters: Verbose, Debug, 138 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 139 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 140 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 141 | 142 | -------------- Example 1 -------------- 143 | 144 | C:\PS>Get-HardDisk -VM $vm | Copy-HardDisk "[Storage1]/" 145 | 146 | Retrieves the hard disks of a virtual machine and copies them into the storage1 root folder. 147 | 148 | 149 | 150 | 151 | -------------- Example 2 -------------- 152 | 153 | C:\PS>Copy-HardDisk -HardDisk $hdd -DestinationPath "[Storage1] vms/disks" -DestinationStorageFormat Thick 154 | 155 | Copies the $hdd hard disk to the "vms/disks"location on storage1 and changes the storage format of the destination disk to Thick. 156 | 157 | 158 | 159 | 160 | REMARKS 161 | To see the examples, type: "get-help Copy-HardDisk -examples". 162 | For more information, type: "get-help Copy-HardDisk -detailed". 163 | For technical information, type: "get-help Copy-HardDisk -full". 164 | For online help, type: "get-help Copy-HardDisk -online" 165 | 166 | Copy-VMGuestFile 167 | ------------------------- 168 | 169 | NAME 170 | Copy-VMGuestFile 171 | 172 | SYNOPSIS 173 | This cmdlet copies files and folders from and to the guest OS of the specified virtual machines using VMware Tools. 174 | 175 | 176 | SYNTAX 177 | Copy-VMGuestFile [-Source] [-Destination] -LocalToGuest [-Force] [-VM] [-HostCredential ] [-HostUser ] [-HostPassword 178 | ] [-GuestCredential ] [-GuestUser ] [-GuestPassword ] [-ToolsWaitSecs ] [-Server ] [-WhatIf] [-Confirm] 179 | [] 180 | 181 | Copy-VMGuestFile [-Source] [-Destination] -GuestToLocal [-Force] [-VM] [-HostCredential ] [-HostUser ] [-HostPassword 182 | ] [-GuestCredential ] [-GuestUser ] [-GuestPassword ] [-ToolsWaitSecs ] [-Server ] [-WhatIf] [-Confirm] 183 | [] 184 | 185 | 186 | DESCRIPTION 187 | This cmdlet copies files and folders from and to the guest OS of the specified virtual machines using VMware Tools. If a file with the same name exists in the destination directory, it 188 | is overwritten. Use the GuestUser and GuestPassword, or GuestCredential parameters to authenticate when connecting to the VMware Tools. To authenticate with the host, use the HostUser 189 | and HostPassword, or HostCredential parameters. SSPI is not supported. For a list of supported operating systems, see the PowerCLI User's Guide. 190 | 191 | To run this cmdlet against vCenter Server/ESX/ESXi versions earlier than 5.0, you need to meet the following requirements: 192 | *You must run the cmdlet on the 32-bit version of Windows PowerShell. 193 | *You must have access to the ESX that hosts the virtual machine over TCP port 902. 194 | *For vCenter Server/ESX/ESXi versions earlier than 4.1, you need VirtualMachine.Interact.ConsoleInteract privilege. For vCenter Server/ESX/ESXi 4.1 and later, you need 195 | VirtualMachine.Interact.GuestControl privilege. 196 | 197 | To run this cmdlet against vCenter Server/ESXi 5.0 and later, you need VirtualMachine.GuestOperations.Modify privilege. 198 | 199 | 200 | PARAMETERS 201 | -Source 202 | Specifies the file you want to copy. If the file is on a virtual machine, specifies the absolute file path. Relative file paths are supported only when copying files from a local 203 | storage. Wildcards are allowed only at the end of the source path. If you are copying files from the guest operating system of a virtual machine to a local directory, the Source 204 | parameter supports wildcards only on vCenter Server 5.0 and later. 205 | 206 | -Destination 207 | Specifies the destination path where you want to copy the file. If the destination points to a virtual machine, specify the absolute file path. Relative destination paths are 208 | supported only when copying files to a local storage. 209 | 210 | -LocalToGuest 211 | Indicates that you want to copy a file from a local directory to the guest operating system of the virtual machine. 212 | 213 | -Force 214 | Indicates that the non-existing directories in the specified destination path are automatically created. 215 | 216 | -VM 217 | Specifies the virtual machine where the file is located. 218 | 219 | -HostCredential 220 | Specifies a PSCredential object that contains credentials for authenticating with the host where the file is to be copied. Do not use this parameter if the HostUser and HostPassword 221 | parameters are used. You need to specify host credentials only if the version of the vCenter Server or ESX you are authenticating with is earlier than 4.0, or the VIX version you 222 | have installed is earlier than 1.10. 223 | 224 | -HostUser 225 | Specifies the user name you want to use for authenticating with the host where the file is to be copied. You need to specify host credentials only if the version of the vCenter 226 | Server or ESX you are authenticating with is earlier than 4.0, or the VIX version you have installed is earlier than 1.10. 227 | 228 | -HostPassword 229 | Specifies the password you want to use for authenticating with the host where the file is to be copied. You need to specify host credentials only if the version of the vCenter 230 | Server or ESX you are authenticating with is earlier than 4.0, or the VIX version you have installed is earlier than 1.10. 231 | 232 | -GuestCredential 233 | Specifies a PSCredential object that contains credentials for authenticating with the guest OS where the file to be copied is located. 234 | 235 | -GuestUser 236 | Specifies the user name you want to use for authenticating with the guest OS where the file to be copied is located. 237 | 238 | -GuestPassword 239 | Specifies the password you want to use for authenticating with the guest OS where the file to be copied is located. 240 | 241 | -ToolsWaitSecs 242 | Specifies the time in seconds to wait for a response from the VMware Tools. If a non-positive value is provided, the system waits infinitely long time. 243 | 244 | -Server 245 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 246 | about default servers, see the description of Connect-VIServer. 247 | 248 | -WhatIf 249 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 250 | 251 | -Confirm 252 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 253 | 254 | -GuestToLocal 255 | Indicates that you want to copy a file from the guest operating system of the virtual machine to a local directory. 256 | 257 | 258 | This cmdlet supports the common parameters: Verbose, Debug, 259 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 260 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 261 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 262 | 263 | -------------- Example 1 -------------- 264 | 265 | C:\PS>Copy-VMGuestFile -Source c:\text.txt -Destination c:\temp\ -VM VM -GuestToLocal -GuestUser user -GuestPassword pass2 266 | 267 | Copies the text.txt file from the guest OS system to the local Temp directory. 268 | 269 | 270 | 271 | 272 | -------------- Example 2 -------------- 273 | 274 | C:\PS>$vm = Get-VM -Name VM 275 | 276 | Get-Item "c:\FolderToCopy\*.*" | Copy-VMGuestFile -Destination "c:\MyFolder" -VM $vm -LocalToGuest -GuestUser -GuestPassword pass2 277 | 278 | Copies files from a local machine to a guest operating system. 279 | 280 | 281 | 282 | 283 | REMARKS 284 | To see the examples, type: "get-help Copy-VMGuestFile -examples". 285 | For more information, type: "get-help Copy-VMGuestFile -detailed". 286 | For technical information, type: "get-help Copy-VMGuestFile -full". 287 | For online help, type: "get-help Copy-VMGuestFile -online" 288 | 289 | 290 | 291 | -------------------------------------------------------------------------------- /docs/cmd_disconnect.rst: -------------------------------------------------------------------------------- 1 | Disconnect Commands 2 | ========================= 3 | 4 | This page contains details on **Disconnect** commands. 5 | 6 | Disconnect-VIServer 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Disconnect-VIServer 12 | 13 | SYNOPSIS 14 | This cmdlet closes the connection to a vCenter Server system. 15 | 16 | 17 | SYNTAX 18 | Disconnect-VIServer [[-Server] ] [-Force] [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet closes the connection to a vCenter Server system. In PowerCLI, you can have multiple connections to a server. In order to disconnect from a server, you must close all active 23 | connections to it. By default, Disconnect-VIServer closes only the last connection to the specified server. To close all active connections to a server, use the Force parameter or run 24 | the cmdlet for each connection. When a server is disconnected, it is removed from the default servers list. For more information about default servers, see the description of 25 | Connect-VIServer. 26 | 27 | 28 | PARAMETERS 29 | -Server 30 | Specifies the vCenter Server systems you want to disconnect from. 31 | 32 | -Force 33 | Indicates that you want to close all active connections to the specified server and disconnect from it. If the value is $false, the cmdlet closes only the last connection to the 34 | specified server and you must run Disconnect-VIServer for each active connection to this server in order to disconnect from it. 35 | 36 | -WhatIf 37 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 38 | 39 | -Confirm 40 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 41 | 42 | 43 | This cmdlet supports the common parameters: Verbose, Debug, 44 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 45 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 46 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 47 | 48 | -------------- Example 1 -------------- 49 | 50 | C:\PS>$Server = Connect-VIServer 10.23.112.235 51 | 52 | Disconnect-VIServer -Server $Server 53 | 54 | Connects to a server with an IP address 10.23.112.235 and saves the returned VIServer object in the $Server variable. Then disconnects from the specified server. 55 | 56 | 57 | 58 | 59 | -------------- Example 2 -------------- 60 | 61 | C:\PS>Disconnect-VIServer -Server $global:DefaultVIServers -Force 62 | 63 | Closes all connections to the default servers. 64 | 65 | 66 | 67 | 68 | -------------- Example 3 -------------- 69 | 70 | C:\PS>Disconnect-VIServer -Server * -Force 71 | 72 | Disconnects all server connections. 73 | 74 | 75 | 76 | 77 | REMARKS 78 | To see the examples, type: "get-help Disconnect-VIServer -examples". 79 | For more information, type: "get-help Disconnect-VIServer -detailed". 80 | For technical information, type: "get-help Disconnect-VIServer -full". 81 | For online help, type: "get-help Disconnect-VIServer -online" 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/cmd_dismount.rst: -------------------------------------------------------------------------------- 1 | Dismount Commands 2 | ========================= 3 | 4 | This page contains details on **Dismount** commands. 5 | 6 | Dismount-Tools 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Dismount-Tools 12 | 13 | SYNOPSIS 14 | This cmdlet dismounts the VMware Tools installer CD. 15 | 16 | 17 | SYNTAX 18 | Dismount-Tools [[-Guest] ] [] 19 | 20 | Dismount-Tools [[-VM] ] [[-Server] ] [] 21 | 22 | 23 | DESCRIPTION 24 | This cmdlet dismounts the VMware Tools installer CD from one or more virtual machines operating systems specified by the VM and Guest parameters. To specify a server different from the 25 | default one, use the Server parameter. The virtual machines must be powered on. 26 | 27 | 28 | PARAMETERS 29 | -Guest 30 | Specifies the guest operating systems from which you want to remove the VMware Tools. 31 | 32 | -VM 33 | Specifies the virtual machines from which you want to remove the VMware Tools. 34 | 35 | -Server 36 | Specifies the vCenter Server systems on which the search for virtual machine names passed by the VM parameter is performed. If no value is given to this parameter, the search for 37 | the virtual machine names is performed on the default server. 38 | 39 | 40 | This cmdlet supports the common parameters: Verbose, Debug, 41 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 42 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 43 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 44 | 45 | -------------- Example 1 -------------- 46 | 47 | C:\PS>Dismount-Tools VM 48 | 49 | Dismounts the VMware Tools from the VM virtual machine. The virtual machine must be powered on. 50 | 51 | 52 | 53 | 54 | -------------- Example 2 -------------- 55 | 56 | C:\PS>Get-VMGuest VM | Dismount-Tools 57 | 58 | Dismounts the VMware Tools from the virtual machine specified by its guest operating system. The virtual machine must be powered on. 59 | 60 | 61 | 62 | 63 | REMARKS 64 | To see the examples, type: "get-help Dismount-Tools -examples". 65 | For more information, type: "get-help Dismount-Tools -detailed". 66 | For technical information, type: "get-help Dismount-Tools -full". 67 | For online help, type: "get-help Dismount-Tools -online" 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /docs/cmd_export.rst: -------------------------------------------------------------------------------- 1 | Export Commands 2 | ========================= 3 | 4 | This page contains details on **Export** commands. 5 | 6 | Export-VApp 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Export-VApp 12 | 13 | SYNOPSIS 14 | This cmdlet exports a vApp or a single virtual machine to the specified destination. 15 | 16 | 17 | SYNTAX 18 | Export-VApp [[-Destination] ] [-VApp] [-Name ] [-Force] [-Format ] [-CreateSeparateFolder] [-Description ] [-Server ] 19 | [-RunAsync] [-WhatIf] [-Confirm] [] 20 | 21 | Export-VApp [[-Destination] ] -VM [-Name ] [-Force] [-Format ] [-CreateSeparateFolder] [-Description ] [-Server 22 | ] [-RunAsync] [-WhatIf] [-Confirm] [] 23 | 24 | 25 | DESCRIPTION 26 | This cmdlet exports a vApp or a single virtual machine to the specified destination. If no destination is specified, the cmdlet creates a new folder in the current working directory and 27 | exports the vApp or the virtual machine to it. The name of the new folder is the same as the name of the vApp or the virtual machine as it appears in vCenter Server. 28 | 29 | 30 | PARAMETERS 31 | -Destination 32 | Specifies a destination path to the file system location where you want to export the vApp or the virtual machine. If the value of the Destination parameter is a folder, the vApp or 33 | the virtual machine is exported to a container folder (OVF). If the destination is a file, the vApp or the virtual machine is exported in OVA format. 34 | 35 | -VApp 36 | Specifies the vApp that you want to export. 37 | 38 | -Name 39 | Specifies a name for the exported vApp or virtual machine. 40 | 41 | -Force 42 | Indicates that the cmdlet overwrites the existing destination files and creates directories to complete the specified file path. 43 | 44 | -Format 45 | Specifies the file format of the specified vApp or virtual machine. The default format is OVF. The valid values are OVF and OVA. 46 | 47 | -CreateSeparateFolder 48 | Indicates that you want to create a separate folder for each vApp or virtual machine. 49 | 50 | -Description 51 | Provides a description of the exported vApp or virtual machine. 52 | 53 | -Server 54 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 55 | about default servers, see the description of Connect-VIServer. 56 | 57 | -RunAsync 58 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 59 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 60 | 61 | -WhatIf 62 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 63 | 64 | -Confirm 65 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 66 | 67 | -VM 68 | Specifies the virtual machine that you want to export. 69 | 70 | 71 | This cmdlet supports the common parameters: Verbose, Debug, 72 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 73 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 74 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 75 | 76 | -------------- Example 1 -------------- 77 | 78 | C:\PS>Get-VApp -Name "MyVApp*" | Export-VApp -Destination "C:\vapps\" 79 | 80 | Retrieves all vApps whose names start with "MyVApp" and exports them to the specified path. 81 | 82 | 83 | 84 | 85 | -------------- Example 2 -------------- 86 | 87 | C:\PS>$myVApp = Get-VApp -Name "MyVApp1" 88 | Export-VApp -Destination "C:\NewFolder\" -VApp $myVApp -Name "EMail_vApp" -Force 89 | 90 | Exports the vApp in the $myVApp variable to the specified location and assigns a name to the folder. 91 | 92 | 93 | 94 | 95 | -------------- Example 3 -------------- 96 | 97 | C:\PS>$myVApp = Get-VApp -Name "MyVApp1" 98 | Export-VApp -vApp $myVApp -Destination "C:\vapps\Vapp\" -Force -CreateSeparateFolder:$false 99 | 100 | Exports the vApp in the $myVApp variable to the specified location without creating a separate folder for each virtual appliance. 101 | 102 | 103 | 104 | 105 | -------------- Example 4 -------------- 106 | 107 | C:\PS>$myVApp = Get-VApp -Name "MyVApp1" 108 | Export-VApp -vApp $myVApp -Destination "C:\vapps\myVapp\" -Format Ova 109 | 110 | Exports a vApp in OVA format. 111 | 112 | 113 | 114 | 115 | -------------- Example 5 -------------- 116 | 117 | C:\PS>Get-VM -Name MyVM* | Export-VApp -Destination "C:\MyVMs\" 118 | 119 | Retrieves all virtual machines whose names start with "MyVM" and exports them to the specified path. 120 | 121 | 122 | 123 | 124 | -------------- Example 6 -------------- 125 | 126 | C:\PS>$myVM = New-VM -Name MyVM1 -VMHost MyVMHost1 127 | Export-VApp -Destination "C:\MyVMs\" -VM $myVM -Format Ova 128 | 129 | Creates a new virtual machine and exports it in OVA format. 130 | 131 | 132 | 133 | 134 | -------------- Example 7 -------------- 135 | 136 | C:\PS>$myVM = New-VM -Name "MyVM1" -VMHost MyVMHost1 137 | Get-VM -Name MyVM | Export-VApp -Destination "C:\MyVMs\" 138 | Export-VApp -Destination "C:\MyVMs\" -VM $myVM -Force 139 | 140 | Exports a virtual machine to the same path twice. The second time forces an override of the previously exported files. 141 | 142 | 143 | 144 | 145 | REMARKS 146 | To see the examples, type: "get-help Export-VApp -examples". 147 | For more information, type: "get-help Export-VApp -detailed". 148 | For technical information, type: "get-help Export-VApp -full". 149 | For online help, type: "get-help Export-VApp -online" 150 | 151 | Export-VDPortGroup 152 | ------------------------- 153 | 154 | NAME 155 | Export-VDPortGroup 156 | 157 | SYNOPSIS 158 | This cmdlet exports the configuration of a specified distributed port group to a specified .zip file. 159 | 160 | 161 | SYNTAX 162 | Export-VDPortGroup [-VDPortGroup] [-Description ] [-Destination ] [-Force] [-Server ] [] 163 | 164 | 165 | DESCRIPTION 166 | This cmdlet exports the configuration of a specified distributed port group to a specified .zip file. You can export only vSphere distributed port groups. 167 | 168 | Note: This cmdlet is supported only on vSphere 5.1 or later. 169 | 170 | 171 | PARAMETERS 172 | -VDPortGroup 173 | Specifies the distributed port group whose configuration you want to export. 174 | 175 | -Description 176 | Specifies a description for the exported distributed port group configuration. 177 | 178 | -Destination 179 | Specifies an absolute or a relative file path to the location where you want to export the configuration of the distributed port group. 180 | 181 | -Force 182 | Indicates that if the specified destination file already exists, the existing file will be overwritten. Any directories required to complete the specified file path will also be 183 | created. 184 | 185 | -Server 186 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 187 | default servers, see the description of Connect-VIServer. 188 | 189 | 190 | This cmdlet supports the common parameters: Verbose, Debug, 191 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 192 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 193 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 194 | 195 | -------------- Example 1 -------------- 196 | 197 | C:\PS>Get-VDPortGroup -Name 'MyVDPortGroup' | Export-VDPortGroup -Destination 'C:\MyVDSwitchesBackup\MyVDPortGroup_21122012.zip' 198 | 199 | Exports the configuration of the specified port group to the specified file. 200 | 201 | 202 | 203 | 204 | -------------- Example 2 -------------- 205 | 206 | C:\PS>$myPortGroup = Get-VDPortGroup -Name 'MyVDPortGroup' 207 | Export-VDPortGroup -VDPortGroup $myPortGroup -Destination 'C:\MyVDSwitchesBackup\MyVDPortGroupBackup.zip' -Force 208 | 209 | Exports the configuration of the specified port group to the specified file. If the MyVDSwitchesBackup directory does not exist, it is created. If the MyVDPortGroupBackup.zip file 210 | already exists in the specified location, it is overwritten. 211 | 212 | 213 | 214 | 215 | REMARKS 216 | To see the examples, type: "get-help Export-VDPortGroup -examples". 217 | For more information, type: "get-help Export-VDPortGroup -detailed". 218 | For technical information, type: "get-help Export-VDPortGroup -full". 219 | For online help, type: "get-help Export-VDPortGroup -online" 220 | 221 | Export-VDSwitch 222 | ------------------------- 223 | 224 | NAME 225 | Export-VDSwitch 226 | 227 | SYNOPSIS 228 | This cmdlet exports the configuration of a specified vSphere distributed switch to a .zip file. 229 | 230 | 231 | SYNTAX 232 | Export-VDSwitch [-VDSwitch] [-WithoutPortGroups] [-Description ] [-Destination ] [-Force] [-Server ] [] 233 | 234 | 235 | DESCRIPTION 236 | This cmdlet exports the configuration of a specified vSphere distributed switch to a .zip file. 237 | 238 | Note: This cmdlet is supported only on vCenter Server 5.1 or later. 239 | 240 | 241 | PARAMETERS 242 | -VDSwitch 243 | Specifies the vSphere distributed switch whose configuration you want to export. 244 | 245 | -WithoutPortGroups 246 | Indicates that the configuration of the vSphere distributed switch is exported without its port group configuration. 247 | 248 | -Description 249 | Specifies a description for the exported vSphere distributed switch configuration. 250 | 251 | -Destination 252 | Specifies an absolute or a relative file path to the location where you want to export the vSphere distributed switch configuration. 253 | 254 | -Force 255 | Indicates that if the specified destination file already exists, the existing file is overwritten. Any directories required to complete the specified file path are also created. 256 | 257 | -Server 258 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 259 | default servers, see the description of Connect-VIServer. 260 | 261 | 262 | This cmdlet supports the common parameters: Verbose, Debug, 263 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 264 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 265 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 266 | 267 | -------------- Example 1 -------------- 268 | 269 | C:\PS>Get-VDSwitch -Name 'MyVDSwitch' | Export-VDSwitch -Description "My VDSwitch configuration" -Destination "c:\myVDSwitchConfig.zip" 270 | 271 | Exports the configuration of the specified vSphere distributed switch and its port groups to the specified file. 272 | 273 | 274 | 275 | 276 | -------------- Example 2 -------------- 277 | 278 | C:\PS>Get-VDSwitch -Name 'MyVDSwitch' | Export-VDSwitch -Description "My VDSwitch configuration" -Destination "c:\myVDSwitchConfig.zip" -WithoutPortGroups -Force 279 | 280 | Exports the configuration of the specified vSphere distributed switch and its port groups to the specified file. If the myVDSwitchConfig.zip file already exists, it is overwritten. 281 | 282 | 283 | 284 | 285 | REMARKS 286 | To see the examples, type: "get-help Export-VDSwitch -examples". 287 | For more information, type: "get-help Export-VDSwitch -detailed". 288 | For technical information, type: "get-help Export-VDSwitch -full". 289 | For online help, type: "get-help Export-VDSwitch -online" 290 | 291 | Export-VMHostProfile 292 | ------------------------- 293 | 294 | NAME 295 | Export-VMHostProfile 296 | 297 | SYNOPSIS 298 | This cmdlet exports the specified host profile to a file. 299 | 300 | 301 | SYNTAX 302 | Export-VMHostProfile [-FilePath] [-Profile] [-Force] [-Server ] [] 303 | 304 | 305 | DESCRIPTION 306 | This cmdlet exports the specified host profile to a file that is in the VMware profile format (.vpf). If the value of the Force parameter is $false and the destination file exists or 307 | the target parent directory does not exist, a terminating error is generated. If the value of the Force parameter is $true, the existing destination file is overwritten and directories 308 | are created to complete the specified file path. 309 | 310 | 311 | PARAMETERS 312 | -FilePath 313 | Specifies the path to the file where you want to export the host profile. 314 | 315 | -Profile 316 | Specifies the host profile you want to export. 317 | 318 | -Force 319 | Indicates that the cmdlet overwrites the existing destination files and creates directories to complete the specified file path. 320 | 321 | -Server 322 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 323 | about default servers, see the description of Connect-VIServer. 324 | 325 | 326 | This cmdlet supports the common parameters: Verbose, Debug, 327 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 328 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 329 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 330 | 331 | -------------- Example 1 -------------- 332 | 333 | C:\PS>$profile = (Get-VMHostProfile -Name Profile )[0] 334 | 335 | Export-VMHostProfile -FilePath export.prf -Profile $profile -Force 336 | 337 | Exports the selected host profile to the export.prf file. 338 | 339 | 340 | 341 | 342 | REMARKS 343 | To see the examples, type: "get-help Export-VMHostProfile -examples". 344 | For more information, type: "get-help Export-VMHostProfile -detailed". 345 | For technical information, type: "get-help Export-VMHostProfile -full". 346 | For online help, type: "get-help Export-VMHostProfile -online" 347 | 348 | 349 | 350 | -------------------------------------------------------------------------------- /docs/cmd_format.rst: -------------------------------------------------------------------------------- 1 | Format Commands 2 | ========================= 3 | 4 | This page contains details on **Format** commands. 5 | 6 | Format-VMHostDiskPartition 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Format-VMHostDiskPartition 12 | 13 | SYNOPSIS 14 | This cmdlet formats a new VMFS (Virtual Machine File System) on each of the specified host disk partitions. 15 | 16 | 17 | SYNTAX 18 | Format-VMHostDiskPartition [-VolumeName] -VMHostDiskPartition [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet formats a new VMFS (Virtual Machine File System) on each of the specified host disk partitions. 23 | 24 | 25 | PARAMETERS 26 | -VolumeName 27 | Specifies a name for the new VMFS. 28 | 29 | -VMHostDiskPartition 30 | Specifies the disk partitions on which you want to format a new VMFS. 31 | 32 | -WhatIf 33 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 34 | 35 | -Confirm 36 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 37 | 38 | 39 | This cmdlet supports the common parameters: Verbose, Debug, 40 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 41 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 42 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 43 | 44 | -------------- Example 1 -------------- 45 | 46 | C:\PS>Get-VMHost Host | Get-VMHostDisk | Get-VMHostDiskPartition | ? {.Type -eq "Ntfs"} | Format-VMHostDiskPartition -VolumeName "NewStorage" 47 | 48 | Formats the NTFS disk partitions of a host. 49 | 50 | 51 | 52 | 53 | REMARKS 54 | To see the examples, type: "get-help Format-VMHostDiskPartition -examples". 55 | For more information, type: "get-help Format-VMHostDiskPartition -detailed". 56 | For technical information, type: "get-help Format-VMHostDiskPartition -full". 57 | For online help, type: "get-help Format-VMHostDiskPartition -online" 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/cmd_import.rst: -------------------------------------------------------------------------------- 1 | Import Commands 2 | ========================= 3 | 4 | This page contains details on **Import** commands. 5 | 6 | Import-VApp 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Import-VApp 12 | 13 | SYNOPSIS 14 | This cmdlet imports OVF (Open Virtualization Format) and OVA packages. The package can contain a virtual appliance or a virtual machine. 15 | 16 | 17 | SYNTAX 18 | Import-VApp [-Source] [-OvfConfiguration ] [[-Name] ] [-Location ] [-VMHost] [-Datastore ] [-Force] 19 | [-DiskStorageFormat ] [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 20 | 21 | 22 | DESCRIPTION 23 | This cmdlet imports OVF (Open Virtualization Format) and OVA packages. The package can contain a vApp or a virtual machine. The cmdlet returns a VApp object when the OVF contains a vApp 24 | and a VirtualMachine object when the OVF contains a single virtual machine. 25 | 26 | 27 | PARAMETERS 28 | -Source 29 | Specifies the path to the OVF or OVA package that you want to import. 30 | 31 | -OvfConfiguration 32 | Specifies values for a set of user-configurable OVF properties. 33 | 34 | -Name 35 | Specifies a name for the imported vApp or virtual machine. 36 | 37 | -Location 38 | Specifies a vSphere inventory container where you want to import the vApp or virtual machine. It must be a vApp, a resource pool, or a cluster. 39 | 40 | -VMHost 41 | Specifies a host where you want to run the vApp or virtual machine. 42 | 43 | -Datastore 44 | Specifies a datastore or a datastore cluster where you want to store the vApp or virtual machine. 45 | 46 | -Force 47 | Indicates that you want to import an OVF or OVA package even if the package signature cannot be verified. 48 | 49 | -DiskStorageFormat 50 | Specifies the storage format for the disks of the imported VMs. By default, the storage format is thick. When you set this parameter, you set the storage format for all virtual 51 | machine disks in the OVF package. This parameter accepts Thin, Thick, and EagerZeroedThick values. 52 | 53 | -Server 54 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 55 | about default servers, see the description of Connect-VIServer. 56 | 57 | -RunAsync 58 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 59 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 60 | 61 | -WhatIf 62 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 63 | 64 | -Confirm 65 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 66 | 67 | 68 | This cmdlet supports the common parameters: Verbose, Debug, 69 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 70 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 71 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 72 | 73 | -------------- Example 1 -------------- 74 | 75 | C:\PS>$vmHost = Get-VMHost -Name "MyVMHost1" 76 | Import-vApp -Source "c:\vApps\WebServer\WebServer.ovf" -VMHost $vmHost 77 | 78 | Imports an OVF package by specifying the target host and name. 79 | 80 | 81 | 82 | 83 | -------------- Example 2 -------------- 84 | 85 | C:\PS>$myCluster = Get-Cluster -Name "MyCluster1" 86 | $vmHost = Get-VMHost -Name "MyVMHost1" 87 | Import-vApp -Source "c:\vApps\WebServer\WebServer.ovf" -VMHost $vmHost -Location $myCluster -Name "MyWebServerProduction1" 88 | 89 | Imports an OVF package within a cluster. 90 | 91 | 92 | 93 | 94 | -------------- Example 3 -------------- 95 | 96 | C:\PS>$vmHost = Get-VMHost -Name "MyVMHost1" 97 | $myDatastore = Get-Datastore -Name "MyDatastore1" 98 | $vmHost | Import-vApp -Source "c:\vApps\WebServer\WebServer.ovf" -Datastore $myDatastore 99 | 100 | Imports an OVF package by specifying a datastore where to store the virtual machines. 101 | 102 | 103 | 104 | 105 | -------------- Example 4 -------------- 106 | 107 | C:\PS>$myDatastore = Get-Datastore -Name "MyDatastore1" 108 | $vmHost = Get-VMHost -Name "MyVMHost1" 109 | $vmHost | Import-vApp -Source "c:\vApps\WebServer\WebServer.ova" -Datastore $myDatastore -Force 110 | 111 | Imports an OVA package even if the package signature cannot be verified. 112 | 113 | 114 | 115 | 116 | -------------- Example 5 -------------- 117 | 118 | C:\PS>$ovfConfig = Get-OvfConfiguration "myOvfTemplate.ovf" 119 | $ovfConfig.NetworkMapping.Network.Value = "Network 2" 120 | $ovfConfig.vami.VM_1.ip0.Value = "10.23.101.2" 121 | $ovfConfig.vami.VM_2.ip0.Value = "10.23.101.3" 122 | Import-VApp $ovfPath -OvfConfiguration $ovfConfig -VMHost $vmHost 123 | 124 | Imports an OVF package with specified network mapping and two standard OVF properties. 125 | 126 | 127 | 128 | 129 | -------------- Example 6 -------------- 130 | 131 | C:\PS>$ovfConfig = Get-OvfConfiguration "myOvfTemplate.ovf" 132 | $portGroup = Get-VirtualPortGroup -Name "Network 2" -Standard 133 | $ovfConfig.NetworkMapping.Network.Value = $portGroup 134 | Import-VApp $ovfPath -OvfConfiguration $ovfConfig -VMHost $vmHost 135 | 136 | Imports an OVF package by specifying network mapping with a standard port group object. 137 | 138 | 139 | 140 | 141 | -------------- Example 7 -------------- 142 | 143 | C:\PS>$ovfConfig = Get-OvfConfiguration "myOvfTemplate.ovf" 144 | $vdPortGroup = Get-VDPortgroup "myDistributedPortGroup" 145 | $ovfConfig.NetworkMapping.Network.Value = $vdPortGroup 146 | Import-VApp $ovfPath -OvfConfiguration $ovfConfig -VMHost $vmHost 147 | 148 | Imports an OVF package by specifying network mapping with a distributed port group object. 149 | 150 | 151 | 152 | 153 | -------------- Example 8 -------------- 154 | 155 | C:\PS>$ovfConfig.ToHashTable() 156 | $ovfConfig = @{ 157 | "NetworkMapping.VM Test Network"="Network 2"; 158 | "vami.ip0.VM_1"="10.23.101.2"; 159 | "vami.ip0.VM_2"="10.23.101.3" 160 | } 161 | Import-VApp $ovfPath -OvfConfiguration $ovfConfig -VMHost $vmHost 162 | 163 | Imports an OVF package by specifying a hash table with populated OVF properties to the OvfConfiguration parameter. 164 | 165 | 166 | 167 | 168 | REMARKS 169 | To see the examples, type: "get-help Import-VApp -examples". 170 | For more information, type: "get-help Import-VApp -detailed". 171 | For technical information, type: "get-help Import-VApp -full". 172 | For online help, type: "get-help Import-VApp -online" 173 | 174 | Import-VMHostProfile 175 | ------------------------- 176 | 177 | NAME 178 | Import-VMHostProfile 179 | 180 | SYNOPSIS 181 | This cmdlet imports a host profile from a file. The file path must be accessible from the vSphere PowerCLI client side. 182 | 183 | 184 | SYNTAX 185 | Import-VMHostProfile [-FilePath] [-Name] [[-ReferenceHost] ] [-Description ] [-Server ] [-WhatIf] [-Confirm] [] 186 | 187 | 188 | DESCRIPTION 189 | This cmdlet imports a host profile from a file. The file path must be accessible from the vSphere PowerCLI client side. 190 | 191 | 192 | PARAMETERS 193 | -FilePath 194 | Specifies the path to the file, from which you want to import a host profile. 195 | 196 | -Name 197 | Specifies a name of the imported host profile. 198 | 199 | -ReferenceHost 200 | Specifies a reference host for the imported host profile. 201 | 202 | -Description 203 | Specifies a description for the imported host profile. 204 | 205 | -Server 206 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 207 | about default servers, see the description of Connect-VIServer. 208 | 209 | -WhatIf 210 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 211 | 212 | -Confirm 213 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 214 | 215 | 216 | This cmdlet supports the common parameters: Verbose, Debug, 217 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 218 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 219 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 220 | 221 | -------------- Example 1 -------------- 222 | 223 | C:\PS>Import-VMHostProfile -FilePath export.prf -Name Profile 224 | 225 | Imports a virtual machine host profile from the export.prf file and names it Profile. 226 | 227 | 228 | 229 | 230 | REMARKS 231 | To see the examples, type: "get-help Import-VMHostProfile -examples". 232 | For more information, type: "get-help Import-VMHostProfile -detailed". 233 | For technical information, type: "get-help Import-VMHostProfile -full". 234 | For online help, type: "get-help Import-VMHostProfile -online" 235 | 236 | 237 | 238 | -------------------------------------------------------------------------------- /docs/cmd_install.rst: -------------------------------------------------------------------------------- 1 | Install Commands 2 | ========================= 3 | 4 | This page contains details on **Install** commands. 5 | 6 | Install-VMHostPatch 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Install-VMHostPatch 12 | 13 | SYNOPSIS 14 | This cmdlet updates the specified hosts. 15 | 16 | 17 | SYNTAX 18 | Install-VMHostPatch [-VMHost] -HostPath [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 19 | 20 | Install-VMHostPatch [-VMHost] -WebPath [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 21 | 22 | Install-VMHostPatch [-VMHost] -LocalPath [-HostUsername ] [-HostPassword ] [-HostCredential ] [-Server ] 23 | [-RunAsync] [-WhatIf] [-Confirm] [] 24 | 25 | 26 | DESCRIPTION 27 | This cmdlet updates the specified hosts. The cmdlet installs patches on the host. The patches that can be located locally, on a Web location, or in a host file system. 28 | When using the LocalPath or WebPath parameters, the ESX/ESXi host attempts to store the patch contents in its local temporary directory. Because ESXi hosts might not have enough free 29 | space on their local drives, this cannot apply to large size patches. The best practice for upgrading an ESXi host is to upload the patch contents on the host's datastore and to run 30 | Install-VMHostPatch with the HostPath parameter. 31 | If you want to install patches packaged in a ZIP archive, you must extract them and use one of the HostPatch, LocalPath, or WebPath parameters. If you use the HostPath parameter, you 32 | must extract each patch to a temporary folder that is named after the patch ID (for example, c:\temp\ESX400-200906001\), and copy the folder in the root folder of a datastore. Note that 33 | the datastore path is case-sensitive. If you use the LocalPath parameter, you must extract each patch to a folder. The name of the folder must contain the patch ID (for example, 34 | "ESX400-200906001"). If you use the WebPath parameter, you must extract each patch to a folder that is published on a Web server. The patch URL address must contain the patch ID (for 35 | example, http://myInternalWebServer/esx40/ESX400-200906001/). 36 | Depending on the component to be upgraded, you might have to set the host into a maintenance mode and to restart the host or the hostd management service after applying the patch. 37 | This cmdlet is experimental and might be changed or removed in a future release. 38 | 39 | 40 | PARAMETERS 41 | -VMHost 42 | Specifies the hosts you want to update. 43 | 44 | -HostPath 45 | Specifies a file path on the ESX/ESXi host to the patches you want to install. 46 | 47 | -Server 48 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 49 | about default servers, see the description of Connect-VIServer. 50 | 51 | -RunAsync 52 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 53 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 54 | 55 | -WhatIf 56 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 57 | 58 | -Confirm 59 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 60 | 61 | -WebPath 62 | Specifies the Web location of the patches you want to install. 63 | 64 | -LocalPath 65 | Specifies the local file system path to the patches you want to install. Providing credentials when installing a patch from a local path is mandatory. 66 | 67 | -HostUsername 68 | Specifies the username you want to use to authenticate with the host. 69 | 70 | -HostPassword 71 | Specifies the password you want to use to authenticate with the host. 72 | 73 | -HostCredential 74 | Specifies a PSCredential object that contains credentials for authenticating with the host. 75 | 76 | 77 | This cmdlet supports the common parameters: Verbose, Debug, 78 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 79 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 80 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 81 | 82 | -------------- Example 1 -------------- 83 | 84 | C:\PS>Install-VMHostPatch -VMHost $vmhost1,$vmhost2 -LocalPath c:\esx40\patches\ESX400-200906001\metadata.zip -HostUsername admin -HostPassword pass 85 | 86 | Updates ESX servers using a local file. Before running the cmdlet, you must download the patch file locally and extract to a folder. The name of the folder must contain the patch ID 87 | (for example, "ESX400-200906001"). Providing credentials when installing a patch from a local path is mandatory. 88 | 89 | 90 | 91 | 92 | -------------- Example 2 -------------- 93 | 94 | C:\PS>$vmhost | Install-VMHostPatch -WebPath http://myInternalWebServer/esx40/ESX400-200906001/metadata.zip 95 | 96 | Upgrades an ESX server using a Web location. Before running the cmdlet, you must download the patch file and extract it to a folder that is published on a Web server. The patch URL 97 | address must contain the patch ID (for example, http://myInternalWebServer/esx40/ESX400-200906001/). 98 | 99 | 100 | 101 | 102 | -------------- Example 3 -------------- 103 | 104 | C:\PS>$datastore = Get-Datastore -Name Datastore 105 | 106 | Copy-DatastoreItem c:\temp\ESX400-200906001\ 107 | 108 | $datastore.DatastoreBrowserPath -Recurse 109 | 110 | $vmhost1,$vmhost2 | Install-VMHostPatch -HostPath 111 | /vmfs/volumes/datastore/ESX400-200906001/metadata.zip 112 | 113 | Upgrades ESX servers using the -HostPath parameter. First, you must download the patch file and extract its contents to a temporary folder that is named after the patch ID (for example, 114 | c:\temp\ESX400-200906001\). Copy the folder in the root folder of the Datastore datastore and run Install-VMHostPatch providing the datastore path to the patch. Note that the datastore 115 | path is case-sensitive. 116 | 117 | 118 | 119 | 120 | REMARKS 121 | To see the examples, type: "get-help Install-VMHostPatch -examples". 122 | For more information, type: "get-help Install-VMHostPatch -detailed". 123 | For technical information, type: "get-help Install-VMHostPatch -full". 124 | For online help, type: "get-help Install-VMHostPatch -online" 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /docs/cmd_invoke.rst: -------------------------------------------------------------------------------- 1 | Invoke Commands 2 | ========================= 3 | 4 | This page contains details on **Invoke** commands. 5 | 6 | Invoke-DrsRecommendation 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Invoke-DrsRecommendation 12 | 13 | SYNOPSIS 14 | This cmdlet applies the specified DRS recommendations. 15 | 16 | 17 | SYNTAX 18 | Invoke-DrsRecommendation [-DrsRecommendation] [-RunAsync] [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet applies the specified DRS recommendations. 23 | 24 | 25 | PARAMETERS 26 | -DrsRecommendation 27 | Specifies the DRS recommendations you want to apply. 28 | 29 | -RunAsync 30 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 31 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 32 | 33 | -WhatIf 34 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 35 | 36 | -Confirm 37 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 38 | 39 | 40 | This cmdlet supports the common parameters: Verbose, Debug, 41 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 42 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 43 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 44 | 45 | -------------- Example 1 -------------- 46 | 47 | C:\PS>Get-DrsRecommendation -Priority 1,2 | Invoke-DrsRecommendation 48 | 49 | Retrieves and applies DRS recommendations with priorities 1 and 2. 50 | 51 | 52 | 53 | 54 | -------------- Example 2 -------------- 55 | 56 | C:\PS>$drs = Get-DrsRecommendation -Cluster Cluster 57 | Invoke-DrsRecommendation -DrsRecommendation $drs -RunAsync 58 | 59 | Retrieves the DRS recommendations from the Cluster cluster and applies them. The command returns without waiting for the task to complete. 60 | 61 | 62 | 63 | 64 | REMARKS 65 | To see the examples, type: "get-help Invoke-DrsRecommendation -examples". 66 | For more information, type: "get-help Invoke-DrsRecommendation -detailed". 67 | For technical information, type: "get-help Invoke-DrsRecommendation -full". 68 | For online help, type: "get-help Invoke-DrsRecommendation -online" 69 | 70 | Invoke-VMHostProfile 71 | ------------------------- 72 | 73 | NAME 74 | Invoke-VMHostProfile 75 | 76 | SYNOPSIS 77 | This cmdlet applies a host profile to the specified host or cluster. 78 | 79 | 80 | SYNTAX 81 | Invoke-VMHostProfile [-Entity] [-Profile ] [-Variable ] [-AssociateOnly] [-ApplyOnly] [-RunAsync] [-Server ] [-WhatIf] [-Confirm] 82 | [] 83 | 84 | 85 | DESCRIPTION 86 | This cmdlet applies a host profile to the specified host or cluster. The host or cluster must be in a maintenance mode. If no value is provided to the Profile parameter, the profile 87 | currently associated with the host or cluster is applied. 88 | 89 | 90 | PARAMETERS 91 | -Entity 92 | Specifies hosts or clusters to which you want to apply the virtual machine host profile. 93 | 94 | -Profile 95 | Specifies the host profile you want to apply. 96 | 97 | -Variable 98 | Specifies a hash table object that provides values for the host profile required variables. 99 | 100 | -AssociateOnly 101 | Indicates whether to associate the host profile to the specified host or cluster without applying it. 102 | 103 | -ApplyOnly 104 | Indicates whether to apply the host profile to the specified virtual machine host without associating it. 105 | 106 | -RunAsync 107 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 108 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 109 | 110 | -Server 111 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 112 | about default servers, see the description of Connect-VIServer. 113 | 114 | -WhatIf 115 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 116 | 117 | -Confirm 118 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 119 | 120 | 121 | This cmdlet supports the common parameters: Verbose, Debug, 122 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 123 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 124 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 125 | 126 | -------------- Example 1 -------------- 127 | 128 | C:\PS>Invoke-VMHostProfile -AssociateOnly -Entity $cluster -Profile $profile 129 | 130 | Associates the specified profile to all hosts in the specified cluster. 131 | 132 | 133 | 134 | 135 | -------------- Example 2 -------------- 136 | 137 | C:\PS>Invoke-VMHostProfile -Entity $vmhost -Profile $profile 138 | 139 | Associates and applies the specified profile to the specified host. 140 | 141 | 142 | 143 | 144 | -------------- Example 3 -------------- 145 | 146 | C:\PS>Get-VMHost | Invoke-VMHostProfile -ApplyOnly -Profile $profile 147 | 148 | Applies the specified profile to all specified hosts. 149 | 150 | 151 | 152 | 153 | -------------- Example 4 -------------- 154 | 155 | C:\PS>Get-VMHost | Invoke-VMHostProfile -AssociateOnly -profile $profile 156 | 157 | Associates the specified profile to all specified hosts. 158 | 159 | 160 | 161 | 162 | -------------- Example 5 -------------- 163 | 164 | C:\PS>Invoke-VMHostProfile $vmhost 165 | 166 | Applies the associated host's profile to the host. 167 | 168 | 169 | 170 | 171 | -------------- Example 6 -------------- 172 | 173 | C:\PS>$requireInput = Invoke-VMHostProfile $vmhost -Profile $profile; 174 | 175 | $requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.address'] = '192.168.0.1'; 176 | 177 | $requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.subnetmask'] = '255.255.255.0'; 178 | 179 | Invoke-VMHostProfile $vmhost -Profile $profile -Variable $requireInput; 180 | 181 | Applies a profile to host but first assigns values to all required values. 182 | 183 | 184 | 185 | 186 | REMARKS 187 | To see the examples, type: "get-help Invoke-VMHostProfile -examples". 188 | For more information, type: "get-help Invoke-VMHostProfile -detailed". 189 | For technical information, type: "get-help Invoke-VMHostProfile -full". 190 | For online help, type: "get-help Invoke-VMHostProfile -online" 191 | 192 | Invoke-VMScript 193 | ------------------------- 194 | 195 | NAME 196 | Invoke-VMScript 197 | 198 | SYNOPSIS 199 | This cmdlet runs a script in the guest OS of each of the specified virtual machines. 200 | 201 | 202 | SYNTAX 203 | Invoke-VMScript [-ScriptText] [-VM] [-HostCredential ] [-HostUser ] [-HostPassword ] [-GuestCredential ] 204 | [-GuestUser ] [-GuestPassword ] [-ToolsWaitSecs ] [-ScriptType ] [-RunAsync] [-Server ] [-WhatIf] [-Confirm] [] 205 | 206 | 207 | DESCRIPTION 208 | This cmdlet runs a script in the guest OS of each of the specified virtual machines. To run Invoke-VMScript, the user must have read access to the folder containing the virtual machine 209 | and a Virtual Machine.Interaction.Console Interaction privilege. The virtual machines must be powered on and have VMware Tools installed. Network connectivity to the ESX system hosting 210 | the virtual machine on port 902 must be present. To authenticate with the host or the guest OS, one of the HostUser/HostPassword (GuestUser/GuestPassword) pair and HostCredential 211 | (GuestCredential) parameters must be provided. The guest account you use to authenticate with the guest operating system must have administrator's privileges. For a list of supported 212 | operating systems, see the PowerCLI User's Guide. 213 | 214 | To run this cmdlet against vCenter Server/ESX/ESXi versions earlier than 5.0, you need to meet the following requirements: 215 | *You must run the cmdlet on the 32-bit version of Windows PowerShell. 216 | *You must have access to the ESX that hosts the virtual machine over TCP port 902. 217 | *For vCenter Server/ESX/ESXi versions earlier than 4.1, you need VirtualMachine.Interact.ConsoleInteract privilege. For vCenter Server/ESX/ESXi 4.1 and later, you need 218 | VirtualMachine.Interact.GuestControl privilege. 219 | 220 | To run this cmdlet against vCenter Server/ESXi 5.0 and later, you need VirtualMachine.GuestOperations.Modify and VirtualMachine.GuestOperations.Execute privileges. 221 | 222 | 223 | PARAMETERS 224 | -ScriptText 225 | Provides the text of the script you want to run. You can also pass to this parameter a string variable containing the path to the script. 226 | 227 | -VM 228 | Specifies the virtual machines on whose guest operating systems you want to run the script. 229 | 230 | -HostCredential 231 | Specifies a PSCredential object containing the credentials you want to use for authenticating with the host. You need to specify host credentials only if the version of the vCenter 232 | Server or ESX you are authenticating with is earlier than 4.0, or the VIX version you have installed is earlier than 1.10. 233 | 234 | -HostUser 235 | Specifies the user name you want to use for authenticating with the host. You need to specify host credentials only if the version of the vCenter Server or ESX you are 236 | authenticating with is earlier than 4.0, or the VIX version you have installed is earlier than 1.10. 237 | 238 | -HostPassword 239 | Specifies the password you want to use for authenticating with the host. You need to specify host credentials only if the version of the vCenter Server or ESX you are authenticating 240 | with is earlier than 4.0, or the VIX version you have installed is earlier than 1.10. 241 | 242 | -GuestCredential 243 | Specifies a PSCredential object containing the credentials you want to use for authenticating with the virtual machine guest OS. 244 | 245 | -GuestUser 246 | Specifies the user name you want to use for authenticating with the virtual machine guest OS. 247 | 248 | -GuestPassword 249 | Specifies the password you want to use for authenticating with the virtual machine guest OS. 250 | 251 | -ToolsWaitSecs 252 | Specifies how long in seconds the system waits for connecting to the VMware Tools. The default value is 20. 253 | 254 | -ScriptType 255 | Specifies the type of the script. The valid values are PowerShell, Bat, and Bash. If the virtual machine OS is Windows, the default value is PowerShell. If the virtual machine OS is 256 | Linux, the default value is Bash. 257 | 258 | -RunAsync 259 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 260 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 261 | 262 | -Server 263 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 264 | about default servers, see the description of Connect-VIServer. 265 | 266 | -WhatIf 267 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 268 | 269 | -Confirm 270 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 271 | 272 | 273 | This cmdlet supports the common parameters: Verbose, Debug, 274 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 275 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 276 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 277 | 278 | -------------- Example 1 -------------- 279 | 280 | C:\PS>Invoke-VMScript -VM VM -ScriptText "dir" -GuestUser administrator -GuestPassword pass2 281 | 282 | Lists the directory entries on the guest OS. 283 | 284 | 285 | 286 | 287 | -------------- Example 2 -------------- 288 | 289 | C:\PS>$script = '&"$env:ProgramFiles\Common Files\Microsoft Shared\MSInfo\msinfo32.exe" /report "$env:Tmp\inforeport"' 290 | 291 | Invoke-VMScript -ScriptText $script -VM VM -GuestCredential $guestCredential 292 | 293 | Runs a PowerShell script. In PowerShell, to access environment variables, you must use the following syntax: $env: (for example, $env:ProgramFiles). Also, to run 294 | the program, you must specify an ampersand (&) in front of the program path. 295 | The outer quotes ($script = '...') are required because this is how you define a string variable in PowerShell. The inner double quotes are required because there are spaces in the path. 296 | 297 | 298 | 299 | 300 | -------------- Example 3 -------------- 301 | 302 | C:\PS>$script = '"%programfiles%\Common Files\Microsoft Shared\MSInfo\msinfo32.exe" /report "%tmp%\inforeport"' 303 | 304 | Invoke-VMScript -ScriptText $script -VM VM -GuestCredential $guestCredential -ScriptType Bat 305 | 306 | Runs a BAT script. In BAT scripts, to access environment variables, you must use the following syntax: %% (for example, %programfiles%). 307 | 308 | The outer quotes ($script = '...') are required because this is how you define a string variable in PowerShell. The inner double quotes are required because there are spaces in the path. 309 | 310 | 311 | 312 | 313 | REMARKS 314 | To see the examples, type: "get-help Invoke-VMScript -examples". 315 | For more information, type: "get-help Invoke-VMScript -detailed". 316 | For technical information, type: "get-help Invoke-VMScript -full". 317 | For online help, type: "get-help Invoke-VMScript -online" 318 | 319 | 320 | 321 | -------------------------------------------------------------------------------- /docs/cmd_mount.rst: -------------------------------------------------------------------------------- 1 | Mount Commands 2 | ========================= 3 | 4 | This page contains details on **Mount** commands. 5 | 6 | Mount-Tools 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Mount-Tools 12 | 13 | SYNOPSIS 14 | This cmdlet mounts the VMware Tools CD installer as a CD-ROM on the guest operating system. 15 | 16 | 17 | SYNTAX 18 | Mount-Tools [[-Guest] ] [] 19 | 20 | Mount-Tools [[-VM] ] [[-Server] ] [] 21 | 22 | 23 | DESCRIPTION 24 | This cmdlet mounts the VMware Tools CD installer as a CD-ROM on the guest operating system that is specified by the Guest or VM parameters. To specify a server different from the 25 | default one, use the Server parameter. 26 | 27 | 28 | PARAMETERS 29 | -Guest 30 | Specifies the guest operating systems on which you want to mount VMware Tools. 31 | 32 | -VM 33 | Specifies the virtual machines on which you want to mount VMware Tools. 34 | 35 | -Server 36 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information 37 | about default servers, see the description of Connect-VIServer. 38 | 39 | 40 | This cmdlet supports the common parameters: Verbose, Debug, 41 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 42 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 43 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 44 | 45 | -------------- Example 1 -------------- 46 | 47 | C:\PS>Mount-Tools VM 48 | 49 | Mounts the VMware Tools on the specified virtual machine. The virtual machine must be powered on. 50 | 51 | 52 | 53 | 54 | -------------- Example 2 -------------- 55 | 56 | C:\PS>Get-VMGuest VM | Mount-Tools 57 | 58 | Mounts the VMware Tools on the virtual machine specified by its guest operating system. The virtual machine must be powered on. 59 | 60 | 61 | 62 | 63 | REMARKS 64 | To see the examples, type: "get-help Mount-Tools -examples". 65 | For more information, type: "get-help Mount-Tools -detailed". 66 | For technical information, type: "get-help Mount-Tools -full". 67 | For online help, type: "get-help Mount-Tools -online" 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /docs/cmd_open.rst: -------------------------------------------------------------------------------- 1 | Open Commands 2 | ========================= 3 | 4 | This page contains details on **Open** commands. 5 | 6 | Open-VMConsoleWindow 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Open-VMConsoleWindow 12 | 13 | SYNOPSIS 14 | This cmdlet opens a window to the virtual machine's console. 15 | 16 | 17 | SYNTAX 18 | Open-VMConsoleWindow [-VM] [-FullScreen] [-UrlOnly] [-Server ] [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet opens a window to the virtual machine's console. The window is opened in a Web page in the browser configured in the VMConsoleWindowBrowser setting (in 23 | Set-PowerCLIConfiguration), or in the default Web browser, if the setting is not configured. 24 | 25 | If the default browser is not 32-bit, you must configure a 32-bit browser to be used by this cmdlet. This configuration is done through the Set-PowerCLIConfiguration cmdlet, by 26 | specifying the VMConsoleWindowBrowser setting and providing the full path to a browser's executable file. The officially supported browsers are listed on the VMware site, under the VMRC 27 | distributable (which is used to display the virtual machine's console). 28 | 29 | 30 | PARAMETERS 31 | -VM 32 | Specifies the virtual machines for which to open a remote console. Supports vCloud and vSphere virtual machines. 33 | 34 | -FullScreen 35 | If specified, opens the virtual machine console window in full screen mode. 36 | 37 | -UrlOnly 38 | If specified, the cmdlet returns the URL for opening a console window to the virtual machine, without opening the console window. 39 | 40 | Note: The URL is valid for 30 seconds. After 30 seconds, the screen authentication ticket contained in the URL expires. 41 | 42 | -Server 43 | Specifies the vCenter Server systems or cloud server instances on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. 44 | For more information about default servers, see the description of Connect-VIServer. 45 | 46 | -WhatIf 47 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 48 | 49 | -Confirm 50 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 51 | 52 | 53 | This cmdlet supports the common parameters: Verbose, Debug, 54 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 55 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 56 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 57 | 58 | -------------- Example 1 -------------- 59 | 60 | C:\PS>Get-CIVM myVM | Open-VMConsoleWindow -FullScreen 61 | 62 | Opens the console of the specified virtual machine in full screen mode. 63 | 64 | 65 | 66 | 67 | REMARKS 68 | To see the examples, type: "get-help Open-VMConsoleWindow -examples". 69 | For more information, type: "get-help Open-VMConsoleWindow -detailed". 70 | For technical information, type: "get-help Open-VMConsoleWindow -full". 71 | For online help, type: "get-help Open-VMConsoleWindow -online" 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /docs/cmd_restart.rst: -------------------------------------------------------------------------------- 1 | Restart Commands 2 | ========================= 3 | 4 | This page contains details on **Restart** commands. 5 | 6 | Restart-VM 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Restart-VM 12 | 13 | SYNOPSIS 14 | This cmdlet restarts the specified virtual machines. 15 | 16 | 17 | SYNTAX 18 | Restart-VM [-RunAsync] [-VM] [-Server ] [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet restarts the specified virtual machines. 23 | 24 | 25 | PARAMETERS 26 | -RunAsync 27 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 28 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 29 | 30 | -VM 31 | Specifies the virtual machines you want to restart. 32 | 33 | -Server 34 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 35 | default servers, see the description of Connect-VIServer. 36 | 37 | -WhatIf 38 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 39 | 40 | -Confirm 41 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 42 | 43 | 44 | This cmdlet supports the common parameters: Verbose, Debug, 45 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 46 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 47 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 48 | 49 | -------------- Example 1 -------------- 50 | 51 | C:\PS>Restart-VM -VM VM -RunAsync -Confirm 52 | 53 | Restarts the VM virtual machine after user confirmation. The cmdlet returns without waiting for the task to complete. 54 | 55 | 56 | 57 | 58 | REMARKS 59 | To see the examples, type: "get-help Restart-VM -examples". 60 | For more information, type: "get-help Restart-VM -detailed". 61 | For technical information, type: "get-help Restart-VM -full". 62 | For online help, type: "get-help Restart-VM -online" 63 | 64 | Restart-VMGuest 65 | ------------------------- 66 | 67 | NAME 68 | Restart-VMGuest 69 | 70 | SYNOPSIS 71 | This cmdlet restarts the virtual machine guest operating systems. 72 | 73 | 74 | SYNTAX 75 | Restart-VMGuest [[-VM] ] [[-Server] ] [-WhatIf] [-Confirm] [] 76 | 77 | Restart-VMGuest [[-Guest] ] [-WhatIf] [-Confirm] [] 78 | 79 | 80 | DESCRIPTION 81 | This cmdlet restarts the virtual machine guest operating systems. 82 | 83 | 84 | PARAMETERS 85 | -VM 86 | Specifies the virtual machines whose operating systems you want to restart. The specified virtual machines must have VMware Tools installed. 87 | 88 | -Server 89 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 90 | default servers, see the description of Connect-VIServer. 91 | 92 | -WhatIf 93 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 94 | 95 | -Confirm 96 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 97 | 98 | -Guest 99 | Specifies the virtual machine guest operating systems you want to restart. 100 | 101 | 102 | This cmdlet supports the common parameters: Verbose, Debug, 103 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 104 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 105 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 106 | 107 | -------------- Example 1 -------------- 108 | 109 | C:\PS>Get-VM VM | Restart-VMGuest 110 | 111 | Restarts the guest OS of the virtual machine named VM. 112 | 113 | 114 | 115 | 116 | REMARKS 117 | To see the examples, type: "get-help Restart-VMGuest -examples". 118 | For more information, type: "get-help Restart-VMGuest -detailed". 119 | For technical information, type: "get-help Restart-VMGuest -full". 120 | For online help, type: "get-help Restart-VMGuest -online" 121 | 122 | Restart-VMHost 123 | ------------------------- 124 | 125 | NAME 126 | Restart-VMHost 127 | 128 | SYNOPSIS 129 | This cmdlet restarts the specified hosts. 130 | 131 | 132 | SYNTAX 133 | Restart-VMHost [-VMHost] [-Force] [-Evacuate] [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 134 | 135 | 136 | DESCRIPTION 137 | This cmdlet restarts the specified hosts. 138 | 139 | 140 | PARAMETERS 141 | -VMHost 142 | Specifies the hosts you want to restart. 143 | 144 | -Force 145 | Indicates that you want to restart the hosts even if they are not in a maintenance mode. 146 | 147 | -Evacuate 148 | Indicates that vCenter Server automatically reregisters the virtual machines that are compatible for reregistration. If they are not compatible, they remain on the rebooted host. If 149 | there are powered-on virtual machines that cannot be reregistered, the operation waits until they are powered off manually. The Evacuate parameter is valid only if the cmdlet is run 150 | against a vCenter Server system and the host is in a DRS-enabled cluster. 151 | 152 | -Server 153 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 154 | default servers, see the description of Connect-VIServer. 155 | 156 | -RunAsync 157 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 158 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 159 | 160 | -WhatIf 161 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 162 | 163 | -Confirm 164 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 165 | 166 | 167 | This cmdlet supports the common parameters: Verbose, Debug, 168 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 169 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 170 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 171 | 172 | -------------- Example 1 -------------- 173 | 174 | C:\PS>Restart-VMHost 10.23.112.235 -RunAsync -Confirm 175 | 176 | Restarts the specified host after user confirmation. The cmdlet returns without waiting for the task to complete. 177 | 178 | 179 | 180 | 181 | REMARKS 182 | To see the examples, type: "get-help Restart-VMHost -examples". 183 | For more information, type: "get-help Restart-VMHost -detailed". 184 | For technical information, type: "get-help Restart-VMHost -full". 185 | For online help, type: "get-help Restart-VMHost -online" 186 | 187 | Restart-VMHostService 188 | ------------------------- 189 | 190 | NAME 191 | Restart-VMHostService 192 | 193 | SYNOPSIS 194 | This cmdlet restarts the specified host services. 195 | 196 | 197 | SYNTAX 198 | Restart-VMHostService [-HostService] [-WhatIf] [-Confirm] [] 199 | 200 | 201 | DESCRIPTION 202 | This cmdlet restarts the specified host services. 203 | 204 | 205 | PARAMETERS 206 | -HostService 207 | Specifies the host service you want to restart. 208 | 209 | -WhatIf 210 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 211 | 212 | -Confirm 213 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 214 | 215 | 216 | This cmdlet supports the common parameters: Verbose, Debug, 217 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 218 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 219 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 220 | 221 | -------------- Example 1 -------------- 222 | 223 | C:\PS>Restart-VMHostService -Service $vmHostService -Confirm:$false 224 | 225 | Restarts a host service. 226 | 227 | 228 | 229 | 230 | REMARKS 231 | To see the examples, type: "get-help Restart-VMHostService -examples". 232 | For more information, type: "get-help Restart-VMHostService -detailed". 233 | For technical information, type: "get-help Restart-VMHostService -full". 234 | For online help, type: "get-help Restart-VMHostService -online" 235 | 236 | 237 | 238 | -------------------------------------------------------------------------------- /docs/cmd_start.rst: -------------------------------------------------------------------------------- 1 | Start Commands 2 | ========================= 3 | 4 | This page contains details on **Start** commands. 5 | 6 | Start-VApp 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Start-VApp 12 | 13 | SYNOPSIS 14 | This cmdlet starts vApps. 15 | 16 | 17 | SYNTAX 18 | Start-VApp [-VApp] [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet starts vApps. 23 | 24 | 25 | PARAMETERS 26 | -VApp 27 | Specifies the vApp that you want to start. 28 | 29 | -Server 30 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 31 | default servers, see the description of Connect-VIServer. 32 | 33 | -RunAsync 34 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 35 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 36 | 37 | -WhatIf 38 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 39 | 40 | -Confirm 41 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 42 | 43 | 44 | This cmdlet supports the common parameters: Verbose, Debug, 45 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 46 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 47 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 48 | 49 | -------------- Example 1 -------------- 50 | 51 | C:\PS>Get-VMHost MyVMHost1 | Get-VApp | Start-VApp 52 | 53 | Starts all vApps on the specified host. 54 | 55 | 56 | 57 | 58 | REMARKS 59 | To see the examples, type: "get-help Start-VApp -examples". 60 | For more information, type: "get-help Start-VApp -detailed". 61 | For technical information, type: "get-help Start-VApp -full". 62 | For online help, type: "get-help Start-VApp -online" 63 | 64 | Start-VM 65 | ------------------------- 66 | 67 | NAME 68 | Start-VM 69 | 70 | SYNOPSIS 71 | This cmdlet powers on virtual machines. 72 | 73 | 74 | SYNTAX 75 | Start-VM [-RunAsync] [-VM] [-Server ] [-WhatIf] [-Confirm] [] 76 | 77 | 78 | DESCRIPTION 79 | This cmdlet powers on the virtual machines specified by the VM parameter. 80 | 81 | 82 | PARAMETERS 83 | -RunAsync 84 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 85 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 86 | 87 | -VM 88 | Specifies the virtual machines you want to power on. 89 | 90 | -Server 91 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 92 | default servers, see the description of Connect-VIServer. 93 | 94 | -WhatIf 95 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 96 | 97 | -Confirm 98 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 99 | 100 | 101 | This cmdlet supports the common parameters: Verbose, Debug, 102 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 103 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 104 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 105 | 106 | -------------- Example 1 -------------- 107 | 108 | C:\PS>Start-VM -VM VM -Confirm -RunAsync 109 | 110 | Asynchronously starts the virtual machine named VM. Before initializing the task, asks for confirmation. 111 | 112 | 113 | 114 | 115 | REMARKS 116 | To see the examples, type: "get-help Start-VM -examples". 117 | For more information, type: "get-help Start-VM -detailed". 118 | For technical information, type: "get-help Start-VM -full". 119 | For online help, type: "get-help Start-VM -online" 120 | 121 | Start-VMHost 122 | ------------------------- 123 | 124 | NAME 125 | Start-VMHost 126 | 127 | SYNOPSIS 128 | This cmdlet starts the specified hosts. 129 | 130 | 131 | SYNTAX 132 | Start-VMHost [-VMHost] [-TimeoutSeconds ] [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 133 | 134 | 135 | DESCRIPTION 136 | This cmdlet starts the specified hosts. The task completes when the host successfully exits standby state and sends a heartbeat signal. If nothing is received from the host for the time 137 | defined by the TimeoutSeconds parameter, the host is declared timed out, and the task is assumed failed. 138 | 139 | 140 | PARAMETERS 141 | -VMHost 142 | Specifies the hosts you want to start. 143 | 144 | -TimeoutSeconds 145 | Specifies a time period in seconds to wait for a heartbeat signal from the host. If nothing is received from the host for the specified time, the host is declared timed out, and the 146 | task is assumed failed. The default value is 300. 147 | 148 | -Server 149 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 150 | default servers, see the description of Connect-VIServer. 151 | 152 | -RunAsync 153 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 154 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 155 | 156 | -WhatIf 157 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 158 | 159 | -Confirm 160 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 161 | 162 | 163 | This cmdlet supports the common parameters: Verbose, Debug, 164 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 165 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 166 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 167 | 168 | -------------- Example 1 -------------- 169 | 170 | C:\PS>Start-VMHost 10.23.112.235 -RunAsync 171 | 172 | Starts the specified host. The command returns without waiting for the task to complete. 173 | 174 | 175 | 176 | 177 | REMARKS 178 | To see the examples, type: "get-help Start-VMHost -examples". 179 | For more information, type: "get-help Start-VMHost -detailed". 180 | For technical information, type: "get-help Start-VMHost -full". 181 | For online help, type: "get-help Start-VMHost -online" 182 | 183 | Start-VMHostService 184 | ------------------------- 185 | 186 | NAME 187 | Start-VMHostService 188 | 189 | SYNOPSIS 190 | This cmdlet starts the specified host services. 191 | 192 | 193 | SYNTAX 194 | Start-VMHostService [-HostService] [-WhatIf] [-Confirm] [] 195 | 196 | 197 | DESCRIPTION 198 | This cmdlet starts the specified host services. 199 | 200 | 201 | PARAMETERS 202 | -HostService 203 | Specifies the host services you want to start. 204 | 205 | -WhatIf 206 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 207 | 208 | -Confirm 209 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 210 | 211 | 212 | This cmdlet supports the common parameters: Verbose, Debug, 213 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 214 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 215 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 216 | 217 | -------------- Example 1 -------------- 218 | 219 | C:\PS>Start-VMHostService -Service $vmHostService 220 | 221 | Starts a host service. 222 | 223 | 224 | 225 | 226 | REMARKS 227 | To see the examples, type: "get-help Start-VMHostService -examples". 228 | For more information, type: "get-help Start-VMHostService -detailed". 229 | For technical information, type: "get-help Start-VMHostService -full". 230 | For online help, type: "get-help Start-VMHostService -online" 231 | 232 | 233 | 234 | -------------------------------------------------------------------------------- /docs/cmd_stop.rst: -------------------------------------------------------------------------------- 1 | Stop Commands 2 | ========================= 3 | 4 | This page contains details on **Stop** commands. 5 | 6 | Stop-Task 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Stop-Task 12 | 13 | SYNOPSIS 14 | This cmdlet stops the specified tasks. 15 | 16 | 17 | SYNTAX 18 | Stop-Task [-Task] [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet stops the tasks specified by the Task parameter. 23 | 24 | 25 | PARAMETERS 26 | -Task 27 | Specifies the tasks you want to stop. 28 | 29 | -WhatIf 30 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 31 | 32 | -Confirm 33 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 34 | 35 | 36 | This cmdlet supports the common parameters: Verbose, Debug, 37 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 38 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 39 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 40 | 41 | -------------- Example 1 -------------- 42 | 43 | C:\PS>$vm = Get-VM -Name "VM1" 44 | 45 | $datacenter = Get-Datacenter -Name "Datacenter1" 46 | 47 | $task = New-Template -Name "Template1" -Location $datacenter -VM $vm -RunAsync 48 | 49 | Stop-Task -Task $task 50 | 51 | Stops the process of creating a new template from a virtual machine. 52 | 53 | 54 | 55 | 56 | REMARKS 57 | To see the examples, type: "get-help Stop-Task -examples". 58 | For more information, type: "get-help Stop-Task -detailed". 59 | For technical information, type: "get-help Stop-Task -full". 60 | For online help, type: "get-help Stop-Task -online" 61 | 62 | Stop-VApp 63 | ------------------------- 64 | 65 | NAME 66 | Stop-VApp 67 | 68 | SYNOPSIS 69 | This cmdlet stops vApps. 70 | 71 | 72 | SYNTAX 73 | Stop-VApp [-Force] [-VApp] [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 74 | 75 | 76 | DESCRIPTION 77 | This cmdlet stops vApps. 78 | 79 | 80 | PARAMETERS 81 | -Force 82 | Indicates that the virtual machines are powered off regardless of the auto-start configuration of the vApps. 83 | 84 | -VApp 85 | Specifies the vApp that you want to stop. 86 | 87 | -Server 88 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 89 | default servers, see the description of Connect-VIServer. 90 | 91 | -RunAsync 92 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 93 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 94 | 95 | -WhatIf 96 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 97 | 98 | -Confirm 99 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 100 | 101 | 102 | This cmdlet supports the common parameters: Verbose, Debug, 103 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 104 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 105 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 106 | 107 | -------------- Example 1 -------------- 108 | 109 | C:\PS>Get-VMHost MyVMHost1 | Get-VApp | Stop-VApp 110 | 111 | Stops all virtual appliances on the specified host. 112 | 113 | 114 | 115 | 116 | REMARKS 117 | To see the examples, type: "get-help Stop-VApp -examples". 118 | For more information, type: "get-help Stop-VApp -detailed". 119 | For technical information, type: "get-help Stop-VApp -full". 120 | For online help, type: "get-help Stop-VApp -online" 121 | 122 | Stop-VM 123 | ------------------------- 124 | 125 | NAME 126 | Stop-VM 127 | 128 | SYNOPSIS 129 | This cmdlet powers off virtual machines. 130 | 131 | 132 | SYNTAX 133 | Stop-VM [-Kill] [-RunAsync] [-VM] [-Server ] [-WhatIf] [-Confirm] [] 134 | 135 | 136 | DESCRIPTION 137 | This cmdlet stops the virtual machines specified by the VM parameter. 138 | 139 | 140 | PARAMETERS 141 | -Kill 142 | Indicates that you want to stop the specified virtual machines by terminating their processes running on the ESX. You can use this parameter to stop a virtual machine that is not 143 | responding and cannot be stopped or restarted in other ways. To use the Kill parameter, you need to have a direct connection to ESX 4.1 or later. 144 | 145 | -RunAsync 146 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 147 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 148 | 149 | -VM 150 | Specifies the virtual machines you want to power off. 151 | 152 | -Server 153 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 154 | default servers, see the description of Connect-VIServer. 155 | 156 | -WhatIf 157 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 158 | 159 | -Confirm 160 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 161 | 162 | 163 | This cmdlet supports the common parameters: Verbose, Debug, 164 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 165 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 166 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 167 | 168 | -------------- Example 1 -------------- 169 | 170 | C:\PS>Stop-VM -VM VM -Confirm 171 | 172 | Stops the virtual machine named VM after confirmation by the user. 173 | 174 | 175 | 176 | 177 | -------------- Example 2 -------------- 178 | 179 | C:\PS>Stop-VM -VM VM -Kill -Confirm:$false 180 | 181 | Stops the virtual machine VM by terminating its process running on the ESX. 182 | 183 | 184 | 185 | 186 | REMARKS 187 | To see the examples, type: "get-help Stop-VM -examples". 188 | For more information, type: "get-help Stop-VM -detailed". 189 | For technical information, type: "get-help Stop-VM -full". 190 | For online help, type: "get-help Stop-VM -online" 191 | 192 | Stop-VMGuest 193 | ------------------------- 194 | 195 | NAME 196 | Stop-VMGuest 197 | 198 | SYNOPSIS 199 | This cmdlet shuts down the specified virtual machine guest OS. 200 | 201 | 202 | SYNTAX 203 | Stop-VMGuest [[-VM] ] [[-Server] ] [-WhatIf] [-Confirm] [] 204 | 205 | Stop-VMGuest [[-Guest] ] [-WhatIf] [-Confirm] [] 206 | 207 | 208 | DESCRIPTION 209 | This cmdlet issues a command to the guest operating system asking it to prepare for a shutdown operation. Returns immediately and does not wait for the guest operating system to 210 | complete the operation. 211 | 212 | 213 | PARAMETERS 214 | -VM 215 | Specifies the virtual machines whose operating systems you want to shut down. The virtual machines must have VMware Tools installed. 216 | 217 | -Server 218 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 219 | default servers, see the description of Connect-VIServer. 220 | 221 | -WhatIf 222 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 223 | 224 | -Confirm 225 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 226 | 227 | -Guest 228 | Specifies the virtual machine guests you want to shut down. 229 | 230 | 231 | This cmdlet supports the common parameters: Verbose, Debug, 232 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 233 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 234 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 235 | 236 | -------------- Example 1 -------------- 237 | 238 | C:\PS>Get-VM VM | Stop-VMGuest 239 | 240 | Shuts down the guest OS of the virtual machine named VM. 241 | 242 | 243 | 244 | 245 | REMARKS 246 | To see the examples, type: "get-help Stop-VMGuest -examples". 247 | For more information, type: "get-help Stop-VMGuest -detailed". 248 | For technical information, type: "get-help Stop-VMGuest -full". 249 | For online help, type: "get-help Stop-VMGuest -online" 250 | 251 | Stop-VMHost 252 | ------------------------- 253 | 254 | NAME 255 | Stop-VMHost 256 | 257 | SYNOPSIS 258 | This cmdlet powers off the specified hosts. 259 | 260 | 261 | SYNTAX 262 | Stop-VMHost [-VMHost] [-Force] [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 263 | 264 | 265 | DESCRIPTION 266 | This cmdlet powers off the specified hosts. When the cmdlet runs asynchronously (with the RunAsync parameter) and you are connected directly to the host, the returned task object 267 | contains no indicator of success. 268 | 269 | 270 | PARAMETERS 271 | -VMHost 272 | Specifies the hosts you want to power off. 273 | 274 | -Force 275 | Indicates that you want to stop the hosts even if they are not in a maintenance mode. 276 | 277 | -Server 278 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 279 | default servers, see the description of Connect-VIServer. 280 | 281 | -RunAsync 282 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 283 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 284 | 285 | -WhatIf 286 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 287 | 288 | -Confirm 289 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 290 | 291 | 292 | This cmdlet supports the common parameters: Verbose, Debug, 293 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 294 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 295 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 296 | 297 | -------------- Example 1 -------------- 298 | 299 | C:\PS>Stop-VMHost 10.23.112.235 -Confirm 300 | 301 | Shutdowns the specified host after user confirmation. 302 | 303 | 304 | 305 | 306 | REMARKS 307 | To see the examples, type: "get-help Stop-VMHost -examples". 308 | For more information, type: "get-help Stop-VMHost -detailed". 309 | For technical information, type: "get-help Stop-VMHost -full". 310 | For online help, type: "get-help Stop-VMHost -online" 311 | 312 | Stop-VMHostService 313 | ------------------------- 314 | 315 | NAME 316 | Stop-VMHostService 317 | 318 | SYNOPSIS 319 | This cmdlet stops the specified host services. 320 | 321 | 322 | SYNTAX 323 | Stop-VMHostService [-HostService] [-WhatIf] [-Confirm] [] 324 | 325 | 326 | DESCRIPTION 327 | This cmdlet stops the host service specified by the Service parameter. 328 | 329 | 330 | PARAMETERS 331 | -HostService 332 | Specifies the host services you want to stop. 333 | 334 | -WhatIf 335 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 336 | 337 | -Confirm 338 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 339 | 340 | 341 | This cmdlet supports the common parameters: Verbose, Debug, 342 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 343 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 344 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 345 | 346 | -------------- Example 1 -------------- 347 | 348 | C:\PS>Start-VMHostService -Service $vmHostService 349 | 350 | Stops a host service. 351 | 352 | 353 | 354 | 355 | REMARKS 356 | To see the examples, type: "get-help Stop-VMHostService -examples". 357 | For more information, type: "get-help Stop-VMHostService -detailed". 358 | For technical information, type: "get-help Stop-VMHostService -full". 359 | For online help, type: "get-help Stop-VMHostService -online" 360 | 361 | 362 | 363 | -------------------------------------------------------------------------------- /docs/cmd_suspend.rst: -------------------------------------------------------------------------------- 1 | Suspend Commands 2 | ========================= 3 | 4 | This page contains details on **Suspend** commands. 5 | 6 | Suspend-VM 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Suspend-VM 12 | 13 | SYNOPSIS 14 | This cmdlet suspends virtual machines. 15 | 16 | 17 | SYNTAX 18 | Suspend-VM [-RunAsync] [-VM] [-Server ] [-WhatIf] [-Confirm] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet suspends the virtual machines specified by the VM parameter. You can use the suspend feature to make resources available on a short-term basis or for other situations in 23 | which you want to put a virtual machine on hold without powering it down. Using wildcards is supported with virtual machine names. 24 | 25 | 26 | PARAMETERS 27 | -RunAsync 28 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 29 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 30 | 31 | -VM 32 | Specifies the virtual machines you want to suspend. 33 | 34 | -Server 35 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 36 | default servers, see the description of Connect-VIServer. 37 | 38 | -WhatIf 39 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 40 | 41 | -Confirm 42 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 43 | 44 | 45 | This cmdlet supports the common parameters: Verbose, Debug, 46 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 47 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 48 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 49 | 50 | -------------- Example 1 -------------- 51 | 52 | C:\PS>Get-VM VM | Suspend-VM 53 | 54 | Suspends the virtual machine named VM. 55 | 56 | 57 | 58 | 59 | REMARKS 60 | To see the examples, type: "get-help Suspend-VM -examples". 61 | For more information, type: "get-help Suspend-VM -detailed". 62 | For technical information, type: "get-help Suspend-VM -full". 63 | For online help, type: "get-help Suspend-VM -online" 64 | 65 | Suspend-VMGuest 66 | ------------------------- 67 | 68 | NAME 69 | Suspend-VMGuest 70 | 71 | SYNOPSIS 72 | This cmdlet suspends the specified guest operating systems. 73 | 74 | 75 | SYNTAX 76 | Suspend-VMGuest [[-VM] ] [[-Server] ] [-WhatIf] [-Confirm] [] 77 | 78 | Suspend-VMGuest [[-Guest] ] [-WhatIf] [-Confirm] [] 79 | 80 | 81 | DESCRIPTION 82 | This cmdlet issues a command to the specified guest operating system asking it to prepare for a suspend operation. 83 | 84 | 85 | PARAMETERS 86 | -VM 87 | Specifies the virtual machines whose operating systems you want to suspend. The virtual machines must have VMware Tools installed. 88 | 89 | -Server 90 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 91 | default servers, see the description of Connect-VIServer. 92 | 93 | -WhatIf 94 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 95 | 96 | -Confirm 97 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 98 | 99 | -Guest 100 | Specifies the guest operating systems you want to suspend. 101 | 102 | 103 | This cmdlet supports the common parameters: Verbose, Debug, 104 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 105 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 106 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 107 | 108 | -------------- Example 1 -------------- 109 | 110 | C:\PS>Get-VM VM| Suspend-VMGuest 111 | 112 | Suspends the guest OS of the virtual machine named VM. 113 | 114 | 115 | 116 | 117 | REMARKS 118 | To see the examples, type: "get-help Suspend-VMGuest -examples". 119 | For more information, type: "get-help Suspend-VMGuest -detailed". 120 | For technical information, type: "get-help Suspend-VMGuest -full". 121 | For online help, type: "get-help Suspend-VMGuest -online" 122 | 123 | Suspend-VMHost 124 | ------------------------- 125 | 126 | NAME 127 | Suspend-VMHost 128 | 129 | SYNOPSIS 130 | This cmdlet suspends hosts. 131 | 132 | 133 | SYNTAX 134 | Suspend-VMHost [-VMHost] [-TimeoutSeconds ] [-Evacuate] [-Server ] [-RunAsync] [-WhatIf] [-Confirm] [] 135 | 136 | 137 | DESCRIPTION 138 | This cmdlet puts the specified host machines in standby mode. You can use the suspend feature to make resources available on a short-term basis or for other situations in which you want 139 | to put a host on hold without powering it off. 140 | 141 | 142 | PARAMETERS 143 | -VMHost 144 | Specifies the hosts you want to suspend. 145 | 146 | -TimeoutSeconds 147 | Specifies a time period in seconds to wait for the host to enter standby mode. If the host is not suspended for the specified time, the host is declared timed out, and the task is 148 | assumed failed. The default value is 300. 149 | 150 | -Evacuate 151 | If the value is $true, vCenter Server automatically reregisters the virtual machines that are compatible for reregistration. If they are not compatible, they remain on the suspended 152 | host. If there are powered-on virtual machines that cannot be reregistered, the operation waits until they are powered off manually. The Evacuate parameter is valid only when 153 | connected to a vCenter Server system and the virtual machine host is part of a DRS-enabled cluster. 154 | 155 | -Server 156 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 157 | default servers, see the description of Connect-VIServer. 158 | 159 | -RunAsync 160 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 161 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 162 | 163 | -WhatIf 164 | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. 165 | 166 | -Confirm 167 | If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation. 168 | 169 | 170 | This cmdlet supports the common parameters: Verbose, Debug, 171 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 172 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 173 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 174 | 175 | -------------- Example 1 -------------- 176 | 177 | C:\PS>Suspend-VMHost 10.23.112.54 -TimeOutSeconds 60 -Confirm 178 | 179 | Suspends the specified host after user confirmation. If the host is not suspended within 60 seconds, the task is reported failed. 180 | 181 | 182 | 183 | 184 | REMARKS 185 | To see the examples, type: "get-help Suspend-VMHost -examples". 186 | For more information, type: "get-help Suspend-VMHost -detailed". 187 | For technical information, type: "get-help Suspend-VMHost -full". 188 | For online help, type: "get-help Suspend-VMHost -online" 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /docs/cmd_test.rst: -------------------------------------------------------------------------------- 1 | Test Commands 2 | ========================= 3 | 4 | This page contains details on **Test** commands. 5 | 6 | Test-VMHostProfileCompliance 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Test-VMHostProfileCompliance 12 | 13 | SYNOPSIS 14 | This cmdlet tests hosts for profile compliance. 15 | 16 | 17 | SYNTAX 18 | Test-VMHostProfileCompliance [-VMHost] [-UseCache] [[-Server] ] [] 19 | 20 | Test-VMHostProfileCompliance [-Profile] [-UseCache] [[-Server] ] [] 21 | 22 | 23 | DESCRIPTION 24 | This cmdlet tests hosts for profile compliance. The Profile and VMHost parameters cannot be set at the same time. If the Profile parameter is set, the specified host profile is tested 25 | for compliance with the hosts, to which it is associated. If the VMHost parameter is specified, the host is tested for compliance with the profiles associated with it. If no profiles 26 | are associated with the host, then the profile associated with the cluster is applied. 27 | 28 | 29 | PARAMETERS 30 | -VMHost 31 | Specifies the host you want to test for profile compliance with the profile associated with it. If no profile is associated with it, the host is tested for compliance with the 32 | profile associated with the cluster, to which the host belongs. Do not set this parameter if the Profile parameter is set. 33 | 34 | -UseCache 35 | Indicates that you want the vCenter Server to return cached information. If vCenter Server does not have cached information, a compliance scanning is performed. 36 | 37 | -Server 38 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 39 | default servers, see the description of Connect-VIServer. 40 | 41 | -Profile 42 | Specifies a host profile against which to test the specified host for compliance with the host to which it is associated. Do not set this parameter if the VMHost parameter is set. 43 | 44 | 45 | This cmdlet supports the common parameters: Verbose, Debug, 46 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 47 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 48 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 49 | 50 | -------------- Example 2 -------------- 51 | 52 | C:\PS>Test-VMHostProfileCompliance -VMHost Host 53 | 54 | Tests the specified host for compliance with the profiles associated with it. 55 | 56 | 57 | 58 | 59 | -------------- Example 3 -------------- 60 | 61 | C:\PS>$profile = Get-VMHostProfile -Name Profile 62 | 63 | Apply-VMHostProfile -AssociateOnly -Profile $profile -Entity 10.0.0.126 64 | 65 | Test-VMHostProfileCompliance -VMHost 10.0.0.126 | fl * 66 | 67 | Test the profile compliance of a non-compliant virtual machine host associated with the profile. 68 | 69 | 70 | 71 | 72 | -------------- Example 4 -------------- 73 | 74 | C:\PS>Test-VMHostProfileCompliance -Profile $profile | fl * 75 | 76 | Test the profile compliance of a virtual machine host profile with the hosts it is associated with. 77 | 78 | 79 | 80 | 81 | REMARKS 82 | To see the examples, type: "get-help Test-VMHostProfileCompliance -examples". 83 | For more information, type: "get-help Test-VMHostProfileCompliance -detailed". 84 | For technical information, type: "get-help Test-VMHostProfileCompliance -full". 85 | For online help, type: "get-help Test-VMHostProfileCompliance -online" 86 | 87 | Test-VMHostSnmp 88 | ------------------------- 89 | 90 | NAME 91 | Test-VMHostSnmp 92 | 93 | SYNOPSIS 94 | This cmdlet tests the host SNMP. 95 | 96 | 97 | SYNTAX 98 | Test-VMHostSnmp [-HostSnmp] [] 99 | 100 | 101 | DESCRIPTION 102 | This cmdlet tests the host SNMP specified by the HostSNMP parameter. 103 | 104 | 105 | PARAMETERS 106 | -HostSnmp 107 | Specifies the host SNMP you want to test. 108 | 109 | 110 | This cmdlet supports the common parameters: Verbose, Debug, 111 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 112 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 113 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 114 | 115 | -------------- Example 1 -------------- 116 | 117 | C:\PS>Test-VMHostSNMP -HostSNMP (Get-VMHostSNMP) 118 | 119 | Retrieves and tests the SNMP of the default server. 120 | 121 | 122 | 123 | 124 | REMARKS 125 | To see the examples, type: "get-help Test-VMHostSnmp -examples". 126 | For more information, type: "get-help Test-VMHostSnmp -detailed". 127 | For technical information, type: "get-help Test-VMHostSnmp -full". 128 | For online help, type: "get-help Test-VMHostSnmp -online" 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /docs/cmd_update.rst: -------------------------------------------------------------------------------- 1 | Update Commands 2 | ========================= 3 | 4 | This page contains details on **Update** commands. 5 | 6 | Update-Tools 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Update-Tools 12 | 13 | SYNOPSIS 14 | This cmdlet upgrades VMware Tools on the specified virtual machine guest OS. 15 | 16 | 17 | SYNTAX 18 | Update-Tools [-NoReboot] [-RunAsync] [[-Guest] ] [] 19 | 20 | Update-Tools [-NoReboot] [-RunAsync] [[-VM] ] [[-Server] ] [] 21 | 22 | 23 | DESCRIPTION 24 | This cmdlet upgrades the VMware Tools on the specified virtual machine guest OS. VMware Tools must be installed prior to updating it. After VMware Tools is updated, the virtual machine 25 | is restarted unless the NoReboot parameter is specified. 26 | 27 | 28 | PARAMETERS 29 | -NoReboot 30 | Indicates that you do not want to reboot the system after updating VMware Tools. This parameter is supported only for Windows operating systems. NoReboot passes the following set of 31 | options to the VMware Tools installer on the guest OS: 32 | 33 | /s /v"/qn REBOOT=ReallySuppress” 34 | 35 | However, the virtual machine might still reboot after updating VMware Tools, depending on the currently installed VMware Tools version, the VMware Tools version to which you want to 36 | upgrade, and the vCenter Center/ESX versions. 37 | 38 | -RunAsync 39 | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the 40 | RunAsync parameter run "help About_RunAsync" in the vSphere PowerCLI console. 41 | 42 | -Guest 43 | Specifies the guest operating systems on which you want to update VMware Tools. 44 | 45 | -VM 46 | Specifies a list of the virtual machines whose VMware Tools you want to upgrade. 47 | 48 | -Server 49 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 50 | default servers, see the description of Connect-VIServer. 51 | 52 | 53 | This cmdlet supports the common parameters: Verbose, Debug, 54 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 55 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 56 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 57 | 58 | -------------- Example 1 -------------- 59 | 60 | C:\PS>Update-Tools VM 61 | 62 | Updates the VMware Tools on the specified virtual machine. The virtual machine must be powered on. 63 | 64 | 65 | 66 | 67 | -------------- Example 2 -------------- 68 | 69 | C:\PS>Get-VMGuest VM | Update-Tools 70 | 71 | Updates the VMware Tools on the virtual machine specified by its guest operating system. The virtual machine must be powered on. 72 | 73 | 74 | 75 | 76 | REMARKS 77 | To see the examples, type: "get-help Update-Tools -examples". 78 | For more information, type: "get-help Update-Tools -detailed". 79 | For technical information, type: "get-help Update-Tools -full". 80 | For online help, type: "get-help Update-Tools -online" 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/cmd_wait.rst: -------------------------------------------------------------------------------- 1 | Wait Commands 2 | ========================= 3 | 4 | This page contains details on **Wait** commands. 5 | 6 | Wait-Task 7 | ------------------------- 8 | 9 | 10 | NAME 11 | Wait-Task 12 | 13 | SYNOPSIS 14 | This cmdlet waits for the completion of the specified tasks. 15 | 16 | 17 | SYNTAX 18 | Wait-Task [-Task] [] 19 | 20 | 21 | DESCRIPTION 22 | This cmdlet waits for the specified tasks to complete or fail before allowing the next command input. The task progress is observed in real time on the console screen. 23 | 24 | 25 | PARAMETERS 26 | -Task 27 | Specifies the tasks you want to wait to complete. 28 | 29 | 30 | This cmdlet supports the common parameters: Verbose, Debug, 31 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 32 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 33 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 34 | 35 | -------------- Example 1 -------------- 36 | 37 | C:\PS>$task = Remove-VM -VM VM -Confirm -RunAsync 38 | 39 | Wait-Task -Task $task 40 | 41 | Waits for the virtual machine to be removed before allowing the next command input. 42 | 43 | 44 | 45 | 46 | REMARKS 47 | To see the examples, type: "get-help Wait-Task -examples". 48 | For more information, type: "get-help Wait-Task -detailed". 49 | For technical information, type: "get-help Wait-Task -full". 50 | For online help, type: "get-help Wait-Task -online" 51 | 52 | Wait-Tools 53 | ------------------------- 54 | 55 | NAME 56 | Wait-Tools 57 | 58 | SYNOPSIS 59 | This cmdlet waits for VMware Tools on the specified virtual machines to load. 60 | 61 | 62 | SYNTAX 63 | Wait-Tools [-VM] [[-TimeoutSeconds] ] [-HostCredential ] [-HostUser ] [-HostPassword ] [-Server ] 64 | [] 65 | 66 | Wait-Tools [[-TimeoutSeconds] ] [-HostCredential ] [-HostUser ] [-HostPassword ] [-Guest] [] 67 | 68 | 69 | DESCRIPTION 70 | This cmdlet waits for VMware Tools of the specified virtual machines to load. The cmdlet returns the virtual machines or guests on which VMware Tools have loaded successfully within the 71 | specified time limits. You can cancel the operation before completion using Ctrl+C. 72 | The successful completion of Wait-Tools means that VMware Tools have loaded, but it does not guarantee for the start of other services. 73 | Updating the returned VMGuest objects requires additional communication with VMware Tools and some of their properties (OSFullName, IPAddress, HostName, and other) might be still empty 74 | right after the completion of Wait-Tools. 75 | 76 | 77 | PARAMETERS 78 | -VM 79 | Specifies the virtual machines for which you want to wait VMware Tools to load. 80 | 81 | -TimeoutSeconds 82 | Specifies the time period in seconds to wait for VMware Tools to start before cancelling the operation. 83 | 84 | -HostCredential 85 | Specifies credentials for authenticating with the ESX/ESXi host of the specified virtual machine. This parameter is needed only if you have authenticated with vCenter Server via 86 | SSPI. If SSPI is not used, the credentials for authentication with vCenter Server are used. 87 | 88 | -HostUser 89 | Specifies a username for authenticating with the ESX/ESXi host of the specified virtual machine. This parameter is needed only if you have authenticated with vCenter Server via 90 | SSPI. If SSPI is not used, the username for authentication with vCenter Server is used. 91 | 92 | -HostPassword 93 | Specifies a password for authenticating with the ESX host of the specified virtual machine. This parameter is needed only if you have authenticated with the vCenter Server via SSPI. 94 | If no SSPI is used, the password for authentication with vCenter Server is used. 95 | 96 | -Server 97 | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about 98 | default servers, see the description of Connect-VIServer. 99 | 100 | -Guest 101 | Specifies the guest operating systems for which you want to wait VMware Tools to load. 102 | 103 | 104 | This cmdlet supports the common parameters: Verbose, Debug, 105 | ErrorAction, ErrorVariable, WarningAction, WarningVariable, 106 | OutBuffer, PipelineVariable, and OutVariable. For more information, see 107 | about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 108 | 109 | -------------- Example 1 -------------- 110 | 111 | C:\PS>$vm = Start-VM VM* | Wait-Tools 112 | 113 | Starts the virtual machines with names starting with VM and Waits for their VMware Tools to load. 114 | 115 | 116 | 117 | 118 | -------------- Example 2 -------------- 119 | 120 | C:\PS>Wait-Tools -VM $vm -TimeoutSeconds 180 121 | 122 | Waits for the VMware Tools of the virtual machines in the $vm variable to start. If VMware Tools do not load after 180 seconds, the operation is aborted. 123 | 124 | 125 | 126 | 127 | -------------- Example 3 -------------- 128 | 129 | C:\PS>Wait-Tools -VM VM* -TimeoutSeconds 120 -HostCredential $vmhostCredential 130 | 131 | Waits for the VMware Tools of the virtual machines in the $vm variable to start. If VMware Tools do not load after 120 seconds, the operation is aborted. Host credentials are required 132 | when you run the cmdlet on environments older than vSphere 4.0. 133 | 134 | 135 | 136 | 137 | -------------- Example 4 -------------- 138 | 139 | C:\PS>Restart-VMGuest WindowsXP | Wait-Tools 140 | 141 | Restart the guest operating system WindowsXP and waits for the VMware Tools to load. 142 | 143 | 144 | 145 | 146 | REMARKS 147 | To see the examples, type: "get-help Wait-Tools -examples". 148 | For more information, type: "get-help Wait-Tools -detailed". 149 | For technical information, type: "get-help Wait-Tools -full". 150 | For online help, type: "get-help Wait-Tools -online" 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /docs/docker_install.rst: -------------------------------------------------------------------------------- 1 | Docker Installation 2 | =================== 3 | 4 | Docker Image 5 | ------------ 6 | 7 | Step 1 Run the following to download the container from the docker hub: 8 | 9 | :: 10 | 11 | docker pull vmware/powerclicore -------------------------------------------------------------------------------- /docs/faq.rst: -------------------------------------------------------------------------------- 1 | Frequently Asked Questions 2 | ========================== 3 | 4 | **1. I am receiving an error when using Connect-VIServer as below** 5 | 6 | :: 7 | 8 | WARNING: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Prompt if you'd like to connect once or to add a permanent exception for this server. 9 | connect-viserver : 10/17/16 3:00:15 PM Connect-VIServer An error occurred while sending the request. 10 | At line:1 char:1 11 | connect-viserver 10.192.116.20 -User administrator@vsphere.local -Pas ... 12 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 13 | CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViError 14 | FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer 15 | 16 | This error is because the certificate on your vCenter server is not trusted by the machine you are making the connection from. 17 | 18 | To fix this issue, replace the certificate chain on your machine or use the Set-PowerCLIConfiguration cmdlet to ignore certificate issues as below: 19 | 20 | :: 21 | 22 | Set-PowerCLIConfiguration -InvalidCertificateAction Ignore 23 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | Index 2 | ===== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: Introduction 7 | 8 | intro 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | :caption: Installation 13 | 14 | docker_install 15 | mac_install 16 | linux_install 17 | 18 | .. toctree:: 19 | :maxdepth: 2 20 | :caption: Using PowerCLI 21 | 22 | launch 23 | 24 | .. toctree:: 25 | :maxdepth: 2 26 | :caption: FAQ/Issue 27 | 28 | faq 29 | known_issues 30 | 31 | .. toctree:: 32 | :maxdepth: 2 33 | :caption: Cmdlet Reference 34 | 35 | cmd_connect 36 | cmd_add 37 | cmd_copy 38 | cmd_disconnect 39 | cmd_dismount 40 | cmd_export 41 | cmd_format 42 | cmd_get 43 | cmd_import 44 | cmd_install 45 | cmd_invoke 46 | cmd_mount 47 | cmd_move 48 | cmd_new 49 | cmd_open 50 | cmd_remove 51 | cmd_restart 52 | cmd_set 53 | cmd_start 54 | cmd_stop 55 | cmd_suspend 56 | cmd_test 57 | cmd_update 58 | cmd_wait 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /docs/intro.rst: -------------------------------------------------------------------------------- 1 | .. image:: https://labs.vmware.com/flings/files/flings/0/0/0/0/1/2/0/powerclicore140x140.jpg 2 | PowerCLI Core 3 | ============= 4 | 5 | Welcome! 6 | -------- 7 | PowerCLI Core uses Microsoft PowerShell Core and .Net Core to enable users of VMware Photon OS, Linux, Mac and Docker to now use the same cmdlets which were previously only available on windows. 8 | 9 | PowerCLI Core enables a multi-platform scripting language which will allow you to manage your VMware infrastructure on any OS. Scripts written previously against the windows version are now made portable to a number of operating systems and can simply be loaded and run on these new OS versions without change. 10 | 11 | PowerCLI Core can be downloaded from the VMware Flings site: https://labs.vmware.com/flings/powercli-core and used with he below instructions to be deployed. 12 | 13 | PowerCLI Core vs PowerCLI for Windows 14 | ------------------------------------- 15 | This initial version provides access to the core vSphere module including over 280 cmdlets allowing you to manage most of the major features of vCenter and ESXi. The below table shows the difference between the windows version and what is currently offered for PowerCLI Core: 16 | 17 | +-----------------+------------------------------------+---------------------+---------------+ 18 | | Module | Description | PowerCLI for Windows| PowerCLI Core | 19 | +=================+====================================+=====================+===============+ 20 | | Core | vCenter and ESXi Cmdlets | √ | √ | 21 | +-----------------+------------------------------------+---------------------+---------------+ 22 | | VDS | vSphere Distributed Switch Cmdlets | √ | √ | 23 | +-----------------+------------------------------------+---------------------+---------------+ 24 | | CIS | vSphere REST API Cmdlets | √ | √ | 25 | +-----------------+------------------------------------+---------------------+---------------+ 26 | | Storage | Storage Cmdlets | √ | X | 27 | +-----------------+------------------------------------+---------------------+---------------+ 28 | | License | License View Cmdlet | √ | X | 29 | +-----------------+------------------------------------+---------------------+---------------+ 30 | | VUM | Update Manager Cmdlets | √ | X | 31 | +-----------------+------------------------------------+---------------------+---------------+ 32 | | Auto Deploy | Auto Deploy Cmdlets | √ | X | 33 | +-----------------+------------------------------------+---------------------+---------------+ 34 | | Image Builder | Image Builder Cmdlets | √ | X | 35 | +-----------------+------------------------------------+---------------------+---------------+ 36 | | VCD | vCloud Director Cmdlets | √ | X | 37 | +-----------------+------------------------------------+---------------------+---------------+ 38 | | vCloud Air | vCloud Air Cmdlets | √ | X | 39 | +-----------------+------------------------------------+---------------------+---------------+ 40 | 41 | Changelog 42 | --------- 43 | 44 | +----------+--------+--------------------------------------------------------+ 45 | | Date | Tag | Change | 46 | +==========+========+========================================================+ 47 | | 04-18-17 | Latest | Added CIS REST API Cmdlets | 48 | +----------+--------+--------------------------------------------------------+ 49 | | 01-11-17 | Latest | Added PowerVRA Module for managing vRealize Automation | 50 | +----------+--------+--------------------------------------------------------+ 51 | | 01-05-17 | Latest | Added PowerNSX Module for managing NSXv | 52 | +----------+--------+--------------------------------------------------------+ 53 | 54 | -------------------------------------------------------------------------------- /docs/known_issues.rst: -------------------------------------------------------------------------------- 1 | Known Issues 2 | ============ 3 | * PowerShell Core does not provide aliases for some of the well known PowerShell cmdlets, watch out for aliases like sleep and sort as these will run native linux commands, it is recommended you use the full cmdlet names like Sort-Object and Start-Sleep for example. 4 | * The Get-VMHostHardware cmdlet has not yet been fully ported to PowerCLI Core and will provide an error when run 5 | * The Get-VMHostPciDevice cmdlet has not yet been fully ported to PowerCLI Core and will provide an error when run 6 | * The Open-VMConsoleWindow cmdlet has not yet been fully ported to PowerCLI Core and will provide an error when run 7 | * The Tag, TagCategory, TagAssignment cmdlets are not supported with vSphere 6.5 8 | * The Content Library Cmdlets have not yet been fully ported to PowerCLI Core and will provide an error when run 9 | * The Credential store Cmdlets have not yet been fully ported to PowerCLI Core and will provide an error when run 10 | -------------------------------------------------------------------------------- /docs/launch.rst: -------------------------------------------------------------------------------- 1 | Launching PowerCLI 2 | ================== 3 | 4 | Launching PowerCLI from Mac/Linux 5 | --------------------------------- 6 | 7 | Step 1 - Open terminal 8 | 9 | Step 2 - Start Powershell in the terminal by running the following command: 10 | :: 11 | 12 | powershell 13 | 14 | Step 3 - Import the PowerCLI Modules into your PowerShell Session: 15 | :: 16 | 17 | Get-Module -ListAvailable PowerCLI* | Import-Module 18 | 19 | Step 3a - (Optional - Please Read) If the SSL certificates of your vCenter are not trusted by your OS, disable SSL certificate validation for PowerCLI by running: 20 | :: 21 | 22 | Set-PowerCLIConfiguration -InvalidCertificateAction Ignore 23 | 24 | Step 4 - Connect to your vCenter Server using Connect-VIServer 25 | :: 26 | 27 | PS> Connect-VIServer -Server 192.168.1.51 -User administrator@vSphere.local - 28 | Password VMware1! 29 | Name Port User 30 | ---- ---- ---- 31 | 192.168.1.51 443 VSPHERE.LOCAL\Administrator 32 | 33 | Launching the PowerCLI Docker container 34 | --------------------------------------- 35 | To open a interactive Terminal and run: 36 | :: 37 | 38 | docker run --rm -it vmware/powerclicore 39 | 40 | To just execute a local script run: 41 | :: 42 | 43 | docker run --rm --entrypoint="/usr/bin/pwsh" -v ${PWD}/scripts:/tmp/scripts vmware/powerclicore /tmp/scripts/sample1.ps1 44 | 45 | Where /scripts is a local folder cointaining your scripts. 46 | 47 | More options for working with and running the container can be found here_. 48 | 49 | .. _here: http://www.virtuallyghetto.com/2016/10/5-different-ways-to-run-powercli-script-using-powercli-core-docker-container.html 50 | -------------------------------------------------------------------------------- /docs/linux_install.rst: -------------------------------------------------------------------------------- 1 | Linux Installation 2 | ================== 3 | 4 | Installing on VMware Photon OS 1.0 5 | ---------------------------------- 6 | 7 | Step 1 - On the Photon machine Edit a new file in the following location /etc/yum.repos.d/powershell.repo and place the following content in it: 8 | :: 9 | 10 | [powershell] 11 | name=VMware Photon Linux 1.0(x86_64) 12 | baseurl=https://vmware.bintray.com/powershell 13 | gpgcheck=0 14 | enabled=1 15 | skip_if_unavailable=True 16 | 17 | Step 2 - Install PowerShell onto Photon OS and create the modules folder needed later: 18 | :: 19 | 20 | tdnf install -y powershell 21 | mkdir -p ~/.local/share/powershell/Modules 22 | 23 | Step 3 - From your download machine, copy the PowerCLI Modules from the downloaded fling zip file to the Photon machine, for example use scp as below: 24 | :: 25 | 26 | scp PowerCLI* root@PHOTON_IP_ADDRESS:/root/.local/share/powershell/Modules 27 | 28 | Step 4 - From your Photon machine, install Unzip on the photon box 29 | :: 30 | 31 | tdnf install -y unzip 32 | 33 | Step 5 - Extract the PowerCLI modules into the directory you copied them into above by running the following command: 34 | :: 35 | 36 | cd /root/.local/share/powershell/Modules 37 | unzip PowerCLI.ViCore.zip 38 | unzip PowerCLI.Vds.zip 39 | 40 | Installing on Ubuntu 14.04.5 Server (64-bit) 41 | -------------------------------------------- 42 | Step 1 - Download PowerShell for Linux from here_ on your Ubuntu machine and install as below: 43 | :: 44 | 45 | curl -SLO https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.12/powershell_6.0.0-alpha.12-1ubuntu1.14.04.1_amd64.deb 46 | sudo dpkg -i powershell_6.0.0-alpha.12-1ubuntu1.14.04.1_amd64.deb 47 | sudo apt-get install -f 48 | 49 | Step 2 - Create the following directory if it does not exist by running the following command: 50 | :: 51 | 52 | mkdir -p ~/.local/share/powershell/Modules 53 | 54 | Step 3 - From your download machine, copy the PowerCLI Modules from the downloaded fling zip file to the Photon machine under your users folders (replace "username" with your username), for example use scp as below: 55 | :: 56 | 57 | scp PowerCLI* username@UBUNTU_IP_ADDRESS:/home/username/.local/share/powershell/Modules 58 | 59 | Step 4 - From the Ubunutu server extract the PowerCLI modules into the directory you created above by running the following command: 60 | :: 61 | 62 | cd ~/.local/share/powershell/Modules 63 | unzip PowerCLI.ViCore.zip 64 | unzip PowerCLI.Vds.zip 65 | 66 | -------------------------------------------------------------------------------- /docs/mac_install.rst: -------------------------------------------------------------------------------- 1 | Mac Installation 2 | ================ 3 | 4 | Install 5 | ------- 6 | 7 | These are the detailed instructions. 8 | 9 | Step 1 - Download and Install PowerShell for Mac OS X using the instructions and packages 10 | from here_ this will also include the install of homebrew 11 | 12 | Step 2 - Make sure you did not miss this step from the PowerShell installation instruction: 13 | :: 14 | 15 | brew install openssl 16 | brew install curl --with-openssl 17 | 18 | Step 3 - Create the following directory if it does not exists by running the following command: 19 | :: 20 | 21 | mkdir -p ~/.local/share/powershell/Modules 22 | 23 | Step 4 - Extract the PowerCLI modules into the directory you created above by running the following 24 | command: 25 | :: 26 | 27 | unzip PowerCLI.ViCore.zip -d ~/.local/share/powershell/Modules 28 | unzip PowerCLI.Vds.zip -d ~/.local/share/powershell/Modules 29 | 30 | .. here: https://github.com/PowerShell/PowerShell --------------------------------------------------------------------------------