├── .gitattributes ├── .gitignore ├── README.md ├── appveyor.yml ├── license.txt ├── profile.ps1.example ├── vmxtoolkit.pssproj ├── vmxtoolkit.pssproj.user ├── vmxtoolkit.sln └── vmxtoolkit ├── Formats ├── vmxtoolkit.virtualmachine.Format.ps1xml ├── vmxtoolkit.virtualmachineinfo.Format.ps1xml ├── vmxtoolkit.vmxscsidisk.Format.ps1xml └── vmxtoolkit.vmxsharedFolder.Format.ps1xml ├── en-US └── about_VMXToolKit.help.txt ├── vmxtoolkit.psd1 ├── vmxtoolkit.psm1 └── vmxtoolkitinit.ps1 /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | # * text=auto 3 | *.txt text eol=crlf 4 | *.ps1 text eol=crlf 5 | *.psm1 text eol=crlf 6 | *.psd1 text eol=crlf 7 | *.cmd text eol=crlf 8 | *.md text eol=crlf 9 | *.xml text merge=union 10 | 11 | # labbuildr.ps1 text eol=crlf 12 | 13 | # Custom for Visual Studio 14 | *.cs diff=csharp 15 | *.sln merge=union 16 | *.csproj merge=union 17 | *.vbproj merge=union 18 | *.fsproj merge=union 19 | *.dbproj merge=union 20 | 21 | # Standard to msysgit 22 | *.doc diff=astextplain 23 | *.DOC diff=astextplain 24 | *.docx diff=astextplain 25 | *.DOCX diff=astextplain 26 | *.dot diff=astextplain 27 | *.DOT diff=astextplain 28 | *.pdf diff=astextplain 29 | *.PDF diff=astextplain 30 | *.rtf diff=astextplain 31 | *.RTF diff=astextplain 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | #*.pssproj 17 | #*.pssproj.* 18 | #*.sln 19 | .vs 20 | ./.vs 21 | # Windows shortcuts 22 | *.lnk 23 | 24 | # ========================= 25 | # Operating System Files 26 | # ========================= 27 | 28 | # OSX 29 | # ========================= 30 | 31 | .DS_Store 32 | .AppleDouble 33 | .LSOverride 34 | 35 | # Thumbnails 36 | ._* 37 | 38 | # Files that might appear on external disk 39 | .Spotlight-V100 40 | .Trashes 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | #*.pssproj 49 | /vmxtoolkit.tests.ps1 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build status](https://ci.appveyor.com/api/projects/status/qj88qo6772ujim54/branch/develop?svg=true)](https://ci.appveyor.com/project/bottkars/vmxtoolkit/branch/develop) 2 | 3 | 4 | ## vmxtoolkit 5 | ========== 6 | 7 | vmxtoolkit is the Powershell extension to VMware Workstation and Fusion 8 | vmxtoolkit is community-driven 9 | vmxtoolkit is the Base for labbuildr, the automated lab building environment for vmware workstation on windows 10 | you get support for labbuildr on github 11 | https://github.com/bottkars/labbuildr/wiki 12 | 13 | ![logo](https://cloud.githubusercontent.com/assets/8255007/17695850/ce034d40-63aa-11e6-8cb7-69a9b914334d.gif) 14 | 15 | simply follow @sddc_guy on twitter for updates 16 | ## Installation 17 | =========== 18 | for powershell 5 of higher, you can use 19 | ```Powershell 20 | install-module vmxtoolkit 21 | ``` 22 | to install the module using the nuget provider. 23 | 24 | to install on earlier versions, simply extract the vmxttoolkit into a folder where your VM´s reside. 25 | Per Default, vmxtoolkit searches from that path 26 | Otherwise, specifythe path to your vm when doing a get-vmx 27 | 28 | ## Installation on OSX 29 | to run vmxtoolkit on OSX, you need to have PowerShell for OSX installed 30 | see [PowerShell for OSX](https://github.com/PowerShell/PowerShell/blob/master/docs/installation/linux.md#os-x-1011) for instructions 31 | it is also recommended to install .NET Core for OSX from for details on installation of .NET Core LIBS see [.NET Core on MACOS](https://www.microsoft.com/net/core#macos) 32 | OSX port is currently only available via Git clone, no auto installer 33 | use 34 | ```Bash``` 35 | git clone https://github.com/bottkars/vmxtoolkit 36 | `````` 37 | current exposed commands 38 | =========== 39 | ```Powershell 40 | PS E:\GitHub> Get-Command -Module vmxtoolkit 41 | 42 | CommandType Name ModuleName 43 | ----------- ---- ---------- 44 | Function Add-VMXScsiDisk vmxtoolkit 45 | Function Connect-VMXNetworkAdapter vmxtoolkit 46 | Function convert-VMXdos2unix vmxtoolkit 47 | Function Copy-VMXDirHost2Guest vmxtoolkit 48 | Function copy-VMXfile2guest vmxtoolkit 49 | Function Disconnect-VMXNetworkAdapter vmxtoolkit 50 | Function Get-VMwareVersion vmxtoolkit 51 | Function Get-VMX vmxtoolkit 52 | Function Get-VMXActivationPreference vmxtoolkit 53 | Function Get-VMXAnnotation vmxtoolkit 54 | Function Get-VMXConfig vmxtoolkit 55 | Function Get-VMXConfigVersion vmxtoolkit 56 | Function Get-VMXDisplayName vmxtoolkit 57 | Function Get-VMXGuestOS vmxtoolkit 58 | Function Get-VMXHWVersion vmxtoolkit 59 | Function Get-VMXIdeDisk vmxtoolkit 60 | Function Get-VMXInfo vmxtoolkit 61 | Function Get-VMXIPAddress vmxtoolkit 62 | Function Get-VMXmemory vmxtoolkit 63 | Function Get-VMXNetwork vmxtoolkit 64 | Function Get-VMXNetworkAdapter vmxtoolkit 65 | Function Get-VMXNetworkAddress vmxtoolkit 66 | Function Get-VMXNetworkConnection vmxtoolkit 67 | Function Get-VMXProcessesInGuest vmxtoolkit 68 | Function Get-VMXProcessor vmxtoolkit 69 | Function Get-VMXRun vmxtoolkit 70 | Function Get-VMXscenario vmxtoolkit 71 | Function Get-VMXScsiController vmxtoolkit 72 | Function Get-VMXScsiDisk vmxtoolkit 73 | Function Get-VMXSnapshot vmxtoolkit 74 | Function Get-VMXSnapshotconfig vmxtoolkit 75 | Function Get-VMXTemplate vmxtoolkit 76 | Function Get-VMXToolsState vmxtoolkit 77 | Function Get-VMXUUID vmxtoolkit 78 | Function Get-yesnoabort vmxtoolkit 79 | Function Invoke-VMXBash vmxtoolkit 80 | Function Invoke-VMXexpect vmxtoolkit 81 | Function Invoke-VMXPowerShell vmxtoolkit 82 | Function New-VMXClone vmxtoolkit 83 | Function New-VMXGuestPath vmxtoolkit 84 | Function New-VMXLinkedClone vmxtoolkit 85 | Function New-VMXScsiDisk vmxtoolkit 86 | Function New-VMXSnapshot vmxtoolkit 87 | Function Optimize-VMXDisk vmxtoolkit 88 | Function remove-vmx vmxtoolkit 89 | Function Remove-VMXserial vmxtoolkit 90 | Function Remove-VMXSnapshot vmxtoolkit 91 | Function Repair-VMXDisk vmxtoolkit 92 | Function Resize-VMXDiskfile vmxtoolkit 93 | Function Restore-VMXSnapshot vmxtoolkit 94 | Function Search-VMXPattern vmxtoolkit 95 | Function Set-VMXActivationPreference vmxtoolkit 96 | Function Set-VMXAnnotation vmxtoolkit 97 | Function Set-VMXDisconnectIDE vmxtoolkit 98 | Function Set-VMXDisplayName vmxtoolkit 99 | Function Set-VMXLinuxDNS vmxtoolkit 100 | Function Set-VMXLinuxNetwork vmxtoolkit 101 | Function Set-VMXMainMemory vmxtoolkit 102 | Function Set-VMXmemory vmxtoolkit 103 | Function Set-VMXNetworkAdapter vmxtoolkit 104 | Function Set-VMXprocessor vmxtoolkit 105 | Function Set-VMXscenario vmxtoolkit 106 | Function Set-VMXserialPipe vmxtoolkit 107 | Function Set-VMXSharedFolder vmxtoolkit 108 | Function Set-VMXSharedFolderState vmxtoolkit 109 | Function Set-VMXSize vmxtoolkit 110 | Function Set-VMXTemplate vmxtoolkit 111 | Function Set-VMXToolsReminder vmxtoolkit 112 | Function Set-VMXVnet vmxtoolkit 113 | Function Start-VMX vmxtoolkit 114 | Function Stop-VMX vmxtoolkit 115 | Function Suspend-VMX vmxtoolkit 116 | ``` 117 | Help 118 | ========== 119 | while commands are self explaining, there is an online help available get-help [command] -online 120 | Contributing 121 | ========== 122 | Please contribute in any way to the project. Specifically, normalizing differnet image sizes, locations, and intance types would be easy adds to enhance the usefulness of the project. 123 | 124 | Licensing 125 | ========== 126 | Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 127 | 128 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 129 | 130 | Support 131 | ========== 132 | Please file bugs and issues at the Github issues page. The code and documentation are released with no warranties or SLAs and are intended to be supported through a community driven process. 133 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 4.2.{build} 2 | nuget: 3 | account_feed: true 4 | project_feed: true 5 | build: 6 | project: vmxtoolkit.sln 7 | parallel: true 8 | verbosity: minimal 9 | only_commits: 10 | files: 11 | - vmxtoolkit/ -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 |  Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | 179 | -------------------------------------------------------------------------------- /profile.ps1.example: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bottkars/vmxtoolkit/d91bfc6d974faad6274ad658261bf4c1216f13ee/profile.ps1.example -------------------------------------------------------------------------------- /vmxtoolkit.pssproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | 2.0 6 | 6CAFC0C6-A428-4d30-A9F9-700E829FEA51 7 | Exe 8 | MyApplication 9 | MyApplication 10 | vmxtoolkit 11 | $(ProjectName).psd1 12 | ac255503-3fb2-4ef4-8c8c-ff9fbe064a8d 13 | 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /vmxtoolkit.pssproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ShowAllFiles 5 | 6 | -------------------------------------------------------------------------------- /vmxtoolkit.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{F5034706-568F-408A-B7B3-4D38C6DB8A32}") = "vmxtoolkit", "vmxtoolkit.pssproj", "{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /vmxtoolkit/Formats/vmxtoolkit.virtualmachine.Format.ps1xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | virtualmachine 6 | 7 | virtualmachine 8 | 9 | 10 | 11 | 12 | 13 | 14 | Left 15 | 16 | 17 | 18 | 19 | Left 20 | 21 | 22 | 23 | 24 | Left 25 | 26 | 27 | 28 | 29 | Left 30 | 31 | 32 | 33 | 34 | Left 35 | 36 | 37 | 38 | 39 | 40 | 41 | vmxname 42 | 43 | 44 | uuid 45 | 46 | 47 | state 48 | 49 | 50 | template 51 | 52 | 53 | path 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /vmxtoolkit/Formats/vmxtoolkit.virtualmachineinfo.Format.ps1xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | virtualmachineinfo 6 | 7 | virtualmachineinfo 8 | 9 | 10 | 11 | 12 | 13 | 14 | Left 15 | 16 | 17 | 18 | 19 | Left 20 | 21 | 22 | 23 | 24 | Left 25 | 26 | 27 | 28 | 29 | Right 30 | 31 | 32 | 33 | 34 | 35 | Right 36 | 37 | 38 | 39 | 40 | 41 | Left 42 | 43 | 44 | 45 | 46 | 47 | 48 | Left 49 | 50 | 51 | 52 | 53 | 54 | 55 | vmxname 56 | 57 | 58 | displayname 59 | 60 | 61 | guestos 62 | 63 | 64 | processor 65 | 66 | 67 | memory 68 | 69 | 70 | network 71 | 72 | 73 | configfile 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /vmxtoolkit/Formats/vmxtoolkit.vmxscsidisk.Format.ps1xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | vmxscsidisk 6 | 7 | vmxscsidisk 8 | 9 | 10 | 11 | 12 | 13 | 14 | Left 15 | 16 | 17 | 18 | 19 | Right 20 | 21 | 22 | 23 | 24 | Right 25 | 26 | 27 | 28 | 29 | Right 30 | 31 | 32 | 33 | 34 | Right 35 | 36 | 37 | 38 | 39 | Left 40 | 41 | 42 | 43 | 44 | Left 45 | 46 | 47 | 48 | 49 | 50 | 51 | vmxname 52 | 53 | 54 | scsiaddress 55 | 56 | 57 | controller 58 | 59 | 60 | lun 61 | 62 | 63 | SizeonDiskMB 64 | 65 | 66 | disk 67 | 68 | 69 | diskpath 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /vmxtoolkit/Formats/vmxtoolkit.vmxsharedFolder.Format.ps1xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | vmxsharedFolder 6 | 7 | vmxsharedFolder 8 | 9 | 10 | 11 | 12 | 13 | 14 | Left 15 | 16 | 17 | 18 | 19 | Left 20 | 21 | 22 | 23 | 24 | Right 25 | 26 | 27 | 28 | 29 | Left 30 | 31 | 32 | 33 | 34 | Left 35 | 36 | 37 | 38 | 39 | Left 40 | 41 | 42 | 43 | 44 | Left 45 | 46 | 47 | 48 | 49 | Left 50 | 51 | 52 | 53 | 54 | Left 55 | 56 | 57 | 58 | 59 | 60 | 61 | vmxname 62 | 63 | 64 | folderName 65 | 66 | 67 | folderNumber 68 | 69 | 70 | enabled 71 | 72 | 73 | readAccess 74 | 75 | 76 | writeAccess 77 | 78 | 79 | expiration 80 | 81 | 82 | present 83 | 84 | 85 | FolderPath 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /vmxtoolkit/en-US/about_VMXToolKit.help.txt: -------------------------------------------------------------------------------- 1 | vmxtoolkit 2 | ========== 3 | 4 | vmxtoolkit is the Powershell extension to VMware Workstation 5 | vmxtoolkit is community-driven 6 | vmxtoolkit is the Base for labbuildr, the automated lab building environment for vmware workstation on windows 7 | you get support for labbuildr on http://labbuildr.com and https://github.com/bottkars/vmxtoolkit 8 | 9 | simply follow @azurestack_guy on twitter for updates 10 | Installation 11 | =========== 12 | 13 | Simply extract the toolkit into a folder where your VM´s reside. 14 | Per Default, vmxtoolkit searches from that path 15 | Otherwise, specifythe path to your vm when doing a get-vmx 16 | 17 | current exposed commands 18 | =========== 19 | ```Powershell 20 | PS E:\GitHub> Get-Command -Module vmxtoolkit 21 | 22 | CommandType Name ModuleName 23 | ----------- ---- ---------- 24 | Function Add-VMXScsiDisk vmxtoolkit 25 | Function Connect-VMXNetworkAdapter vmxtoolkit 26 | Function convert-VMXdos2unix vmxtoolkit 27 | Function Copy-VMXDirHost2Guest vmxtoolkit 28 | Function copy-VMXfile2guest vmxtoolkit 29 | Function Disconnect-VMXNetworkAdapter vmxtoolkit 30 | Function Get-VMwareVersion vmxtoolkit 31 | Function Get-VMX vmxtoolkit 32 | Function Get-VMXActivationPreference vmxtoolkit 33 | Function Get-VMXAnnotation vmxtoolkit 34 | Function Get-VMXConfig vmxtoolkit 35 | Function Get-VMXConfigVersion vmxtoolkit 36 | Function Get-VMXDisplayName vmxtoolkit 37 | Function Get-VMXGuestOS vmxtoolkit 38 | Function Get-VMXHWVersion vmxtoolkit 39 | Function Get-VMXIdeDisk vmxtoolkit 40 | Function Get-VMXInfo vmxtoolkit 41 | Function Get-VMXIPAddress vmxtoolkit 42 | Function Get-VMXmemory vmxtoolkit 43 | Function Get-VMXNetwork vmxtoolkit 44 | Function Get-VMXNetworkAdapter vmxtoolkit 45 | Function Get-VMXNetworkAddress vmxtoolkit 46 | Function Get-VMXNetworkConnection vmxtoolkit 47 | Function Get-VMXProcessesInGuest vmxtoolkit 48 | Function Get-VMXProcessor vmxtoolkit 49 | Function Get-VMXRun vmxtoolkit 50 | Function Get-VMXscenario vmxtoolkit 51 | Function Get-VMXScsiController vmxtoolkit 52 | Function Get-VMXScsiDisk vmxtoolkit 53 | Function Get-VMXSnapshot vmxtoolkit 54 | Function Get-VMXSnapshotconfig vmxtoolkit 55 | Function Get-VMXTemplate vmxtoolkit 56 | Function Get-VMXToolsState vmxtoolkit 57 | Function Get-VMXUUID vmxtoolkit 58 | Function Get-yesnoabort vmxtoolkit 59 | Function Invoke-VMXBash vmxtoolkit 60 | Function Invoke-VMXexpect vmxtoolkit 61 | Function Invoke-VMXPowerShell vmxtoolkit 62 | Function New-VMXClone vmxtoolkit 63 | Function New-VMXGuestPath vmxtoolkit 64 | Function New-VMXLinkedClone vmxtoolkit 65 | Function New-VMXScsiDisk vmxtoolkit 66 | Function New-VMXSnapshot vmxtoolkit 67 | Function Optimize-VMXDisk vmxtoolkit 68 | Function remove-vmx vmxtoolkit 69 | Function Remove-VMXserial vmxtoolkit 70 | Function Remove-VMXSnapshot vmxtoolkit 71 | Function Repair-VMXDisk vmxtoolkit 72 | Function Resize-VMXDiskfile vmxtoolkit 73 | Function Restore-VMXSnapshot vmxtoolkit 74 | Function Search-VMXPattern vmxtoolkit 75 | Function Set-VMXActivationPreference vmxtoolkit 76 | Function Set-VMXAnnotation vmxtoolkit 77 | Function Set-VMXDisconnectIDE vmxtoolkit 78 | Function Set-VMXDisplayName vmxtoolkit 79 | Function Set-VMXLinuxDNS vmxtoolkit 80 | Function Set-VMXLinuxNetwork vmxtoolkit 81 | Function Set-VMXMainMemory vmxtoolkit 82 | Function Set-VMXmemory vmxtoolkit 83 | Function Set-VMXNetworkAdapter vmxtoolkit 84 | Function Set-VMXprocessor vmxtoolkit 85 | Function Set-VMXscenario vmxtoolkit 86 | Function Set-VMXserialPipe vmxtoolkit 87 | Function Set-VMXSharedFolder vmxtoolkit 88 | Function Set-VMXSharedFolderState vmxtoolkit 89 | Function Set-VMXSize vmxtoolkit 90 | Function Set-VMXTemplate vmxtoolkit 91 | Function Set-VMXToolsReminder vmxtoolkit 92 | Function Set-VMXVnet vmxtoolkit 93 | Function Start-VMX vmxtoolkit 94 | Function Stop-VMX vmxtoolkit 95 | Function Suspend-VMX vmxtoolkit 96 | ``` 97 | Help 98 | ========== 99 | while commands are self explaining, there is an online help available get-help [command] -online 100 | Contributing 101 | ========== 102 | Please contribute in any way to the project. Specifically, normalizing differnet image sizes, locations, and intance types would be easy adds to enhance the usefulness of the project. 103 | 104 | Licensing 105 | ========== 106 | Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 107 | 108 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 109 | 110 | Support 111 | ========== 112 | Please file bugs and issues at the Github issues page. The code and documentation are released with no warranties or SLAs and are intended to be supported through a community driven process. 113 | -------------------------------------------------------------------------------- /vmxtoolkit/vmxtoolkit.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Modulmanifest für das Modul "vmxtoolkit" 3 | # 4 | # Generiert von: Karsten Bott 5 | # 6 | # Generiert am: 26.04.2014 7 | # 8 | @{ 9 | # Die diesem Manifest zugeordnete Skript- oder Binärmoduldatei. 10 | RootModule = 'vmxtoolkit.psm1' 11 | # ModuletoProcess = 'vmxtoolkit.psm1' 12 | # Die Versionsnummer dieses Moduls 13 | ModuleVersion = '4.5.3.1' 14 | # ID zur eindeutigen Kennzeichnung dieses Moduls 15 | GUID = 'abe3797c-5a42-4e80-a1fb-9e648872ee14' 16 | # Autor dieses Moduls 17 | Author = 'Karsten Bott' 18 | 19 | # Unternehmen oder Hersteller dieses Moduls 20 | CompanyName = 'labbuildr' 21 | # Urheberrechtserklärung für dieses Modul 22 | Copyright = '(c) 2014 Karsten Bott. Alle Rechte vorbehalten. 23 | Copyright 2014 Karsten Bott 24 | 25 | Licensed under the Apache License, Version 2.0 (the "License"); 26 | you may not use this file except in compliance with the License. 27 | You may obtain a copy of the License at 28 | 29 | http://www.apache.org/licenses/LICENSE-2.0 30 | 31 | ' 32 | 33 | # Beschreibung der von diesem Modul bereitgestellten Funktionen 34 | Description = 'Powershell Modules for VMware Workstation on Windows/Linux and VMware Fusion on OSX, see https://github.com/bottkars/vmxtoolkit for details' 35 | 36 | # Die für dieses Modul mindestens erforderliche Version des Windows PowerShell-Moduls 37 | PowerShellVersion = '3.0' 38 | 39 | # Der Name des für dieses Modul erforderlichen Windows PowerShell-Hosts 40 | # PowerShellHostName = '' 41 | 42 | # Die für dieses Modul mindestens erforderliche Version des Windows PowerShell-Hosts 43 | # PowerShellHostVersion = '' 44 | 45 | # Die für dieses Modul mindestens erforderliche Microsoft .NET Framework-Version 46 | # DotNetFrameworkVersion = '' 47 | 48 | # Die für dieses Modul mindestens erforderliche Version der CLR (Common Language Runtime) 49 | # CLRVersion = '' 50 | 51 | # Die für dieses Modul erforderliche Prozessorarchitektur ("Keine", "X86", "Amd64"). 52 | # ProcessorArchitecture = '' 53 | 54 | # Die Module, die vor dem Importieren dieses Moduls in die globale Umgebung geladen werden müssen 55 | # RequiredModules = @() 56 | 57 | # Die Assemblys, die vor dem Importieren dieses Moduls geladen werden müssen 58 | # RequiredAssemblies = @() 59 | 60 | # Die Skriptdateien (PS1-Dateien), die vor dem Importieren dieses Moduls in der Umgebung des Aufrufers ausgeführt werden. 61 | ScriptsToProcess = @(".\vmxtoolkitinit.ps1") 62 | 63 | # Die Typdateien (.ps1xml), die beim Importieren dieses Moduls geladen werden sollen 64 | # TypesToProcess = @() 65 | 66 | # Die Formatdateien (.ps1xml), die beim Importieren dieses Moduls geladen werden sollen 67 | FormatsToProcess = @( 68 | '.\Formats\vmxtoolkit.virtualmachine.Format.ps1xml', 69 | '.\Formats\vmxtoolkit.virtualmachineinfo.Format.ps1xml', 70 | '.\Formats\vmxtoolkit.vmxscsidisk.Format.ps1xml', 71 | '.\Formats\vmxtoolkit.vmxsharedFolder.Format.ps1xml' 72 | ) 73 | 74 | # Die Module, die als geschachtelte Module des in "RootModule/ModuleToProcess" angegebenen Moduls importiert werden sollen. 75 | NestedModules = @() 76 | 77 | # Aus diesem Modul zu exportierende Funktionen 78 | FunctionsToExport = '*' 79 | 80 | # Aus diesem Modul zu exportierende Cmdlets 81 | CmdletsToExport = '*' 82 | 83 | # Die aus diesem Modul zu exportierenden Variablen 84 | VariablesToExport = '*' 85 | 86 | # Aus diesem Modul zu exportierende Aliase 87 | AliasesToExport = '*' 88 | 89 | # Liste aller Module in diesem Modulpaket 90 | # ModuleList = @() 91 | 92 | # Liste aller Dateien in diesem Modulpaket 93 | FileList = @("vmxtoolkitinit.ps1", 94 | "vmxtoolkit.psd1", 95 | "vmxtoolkit.psm1") 96 | 97 | # Die privaten Daten, die an das in "RootModule/ModuleToProcess" angegebene Modul übergeben werden sollen. 98 | # PrivateData = '' 99 | 100 | # HelpInfo-URI dieses Moduls 101 | # HelpInfoURI = '' 102 | 103 | # Standardpräfix für Befehle, die aus diesem Modul exportiert werden. Das Standardpräfix kann mit "Import-Module -Prefix" überschrieben werden. 104 | # DefaultCommandPrefix = 'vmx' 105 | 106 | } 107 | 108 | -------------------------------------------------------------------------------- /vmxtoolkit/vmxtoolkitinit.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param 3 | ( 4 | $VMX_Path) 5 | 6 | ################## Some Globals 7 | if ($PSVersionTable.PSVersion -lt [version]"6.0.0") { 8 | Write-Verbose "this will check if we are on 6" 9 | } 10 | 11 | write-Host "trying to get os type ... " 12 | if ($env:windir) { 13 | $OS_Version = Get-Command "$env:windir\system32\ntdll.dll" 14 | $OS_Version = "Product Name: Windows $($OS_Version.Version)" 15 | $Global:vmxtoolkit_type = "win_x86_64" 16 | write-verbose "getting VMware Path from Registry" 17 | if (!(Test-Path "HKCR:\")) { $NewPSDrive = New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT } 18 | if (!($VMware_Path = Get-ItemProperty HKCR:\Applications\vmware.exe\shell\open\command -ErrorAction SilentlyContinue)) { 19 | Write-Error "VMware Binaries not found from registry" 20 | Break 21 | } 22 | 23 | $preferences_file = "$env:AppData\VMware\preferences.ini" 24 | $VMX_BasePath = '\Documents\Virtual Machines\' 25 | $VMware_Path = Split-Path $VMware_Path.'(default)' -Parent 26 | $VMware_Path = $VMware_Path -replace '"', '' 27 | $Global:vmwarepath = $VMware_Path 28 | $Global:vmware = "$VMware_Path\vmware.exe" 29 | $Global:vmrun = "$VMware_Path\vmrun.exe" 30 | $Global:vmware_vdiskmanager = Join-Path $VMware_Path 'vmware-vdiskmanager.exe' 31 | $Global:VMware_OVFTool = Join-Path $Global:vmwarepath 'OVFTool\ovftool.exe' 32 | $GLobal:VMware_packer = Join-Path $Global:vmwarepath '7za.exe' 33 | $VMwarefileinfo = Get-ChildItem $Global:vmware 34 | $Global:vmxinventory = "$env:appdata\vmware\inventory.vmls" 35 | $Global:vmwareversion = New-Object System.Version($VMwarefileinfo.VersionInfo.ProductMajorPart, $VMwarefileinfo.VersionInfo.ProductMinorPart, $VMwarefileinfo.VersionInfo.ProductBuildPart, $VMwarefileinfo.VersionInfo.ProductVersion.Split("-")[1]) 36 | $webrequestor = ".Net" 37 | $Global:mkisofs = "$Global:vmwarepath/mkisofs.exe" 38 | } 39 | elseif ($OS = uname) { 40 | Write-Host "found OS $OS" 41 | Switch ($OS) { 42 | "Darwin" { 43 | $Global:vmxtoolkit_type = "OSX" 44 | $OS_Version = (sw_vers) 45 | $OS_Version = $OS_Version -join " " 46 | $VMX_BasePath = 'Documents/Virtual Machines.localized' 47 | # $VMware_Path = "/Applications/VMware Fusion.app" 48 | $VMware_Path = mdfind -onlyin /Applications "VMware Fusion" 49 | $Global:vmwarepath = $VMware_Path 50 | [version]$Fusion_Version = defaults read $VMware_Path/Contents/Info.plist CFBundleShortVersionString 51 | $VMware_BIN_Path = Join-Path $VMware_Path '/Contents/Library' 52 | $preferences_file = "$HOME/Library/Preferences/VMware Fusion/preferences" 53 | try { 54 | $webrequestor = (get-command curl).Path 55 | } 56 | catch { 57 | Write-Warning "curl not found" 58 | exit 59 | } 60 | try { 61 | $GLobal:VMware_packer = (get-command 7za -ErrorAction Stop).Path 62 | } 63 | catch { 64 | Write-Warning "7za not found, pleas install p7zip full" 65 | Break 66 | } 67 | 68 | $Global:VMware_vdiskmanager = Join-Path $VMware_BIN_Path 'vmware-vdiskmanager' 69 | $Global:vmrun = Join-Path $VMware_BIN_Path "vmrun" 70 | switch ($Fusion_Version.Major) { 71 | "10" { 72 | $Global:VMware_OVFTool = "/Applications/VMware Fusion.app/Contents/Library/VMware OVF Tool/ovftool" 73 | [version]$Global:vmwareversion = "14.0.0.0" 74 | } 75 | 76 | default { 77 | $Global:VMware_OVFTool = Join-Path $VMware_Path 'ovftool' 78 | [version]$Global:vmwareversion = "12.0.0.0" 79 | } 80 | } 81 | 82 | } 83 | 'Linux' { 84 | $Global:vmxtoolkit_type = "LINUX" 85 | $OS_Version = (uname -o) 86 | #$OS_Version = $OS_Version -join " " 87 | $preferences_file = "$HOME/.vmware/preferences" 88 | $VMX_BasePath = '/var/lib/vmware/Shared VMs' 89 | try { 90 | $webrequestor = (get-command curl).Path 91 | } 92 | catch { 93 | Write-Warning "curl not found" 94 | exit 95 | } 96 | try { 97 | $VMware_Path = Split-Path -Parent (get-command vmware).Path 98 | } 99 | catch { 100 | Write-Warning "VMware Path not found" 101 | exit 102 | } 103 | 104 | $Global:vmwarepath = $VMware_Path 105 | $VMware_BIN_Path = $VMware_Path 106 | try { 107 | $Global:VMware_vdiskmanager = (get-command vmware-vdiskmanager).Path 108 | } 109 | catch { 110 | Write-Warning "vmware-vdiskmanager not found" 111 | break 112 | } 113 | try { 114 | $GLobal:VMware_packer = (get-command 7za).Path 115 | } 116 | catch { 117 | Write-Warning "7za not found, pleas install p7zip full" 118 | } 119 | 120 | try { 121 | $Global:vmrun = (Get-Command vmrun).Path 122 | } 123 | catch { 124 | Write-Warning "vmrun not found" 125 | break 126 | } 127 | try { 128 | $Global:VMware_OVFTool = (Get-Command ovftool).Path 129 | } 130 | catch { 131 | Write-Warning "ovftool not found" 132 | break 133 | } 134 | try { 135 | $Global:mkisofs = (Get-Command mkisofs).Path 136 | } 137 | catch { 138 | Write-Warning "mkisofs not found" 139 | break 140 | } 141 | $Vmware_Base_Version = (vmware -v) 142 | $Vmware_Base_Version = $Vmware_Base_Version -replace "VMware Workstation " 143 | [version]$Global:vmwareversion = ($Vmware_Base_Version.Split(' '))[0] 144 | } 145 | default { 146 | Write-host "Sorry, rome was not build in one day" 147 | exit 148 | } 149 | 150 | 151 | 152 | 'default' { 153 | write-host "unknown linux OS" 154 | break 155 | } 156 | } 157 | } 158 | else { 159 | write-host "error detecting OS" 160 | } 161 | 162 | if (Test-Path $preferences_file) { 163 | Write-Verbose "Found VMware Preferences file" 164 | Write-Verbose "trying to get vmx path from preferences" 165 | $defaultVMPath = get-content $preferences_file | Select-String prefvmx.defaultVMPath 166 | if ($defaultVMPath) { 167 | $defaultVMPath = $defaultVMPath -replace "`"" 168 | $defaultVMPath = ($defaultVMPath -split "=")[-1] 169 | $defaultVMPath = $defaultVMPath.TrimStart(" ") 170 | Write-Verbose "default vmpath from preferences is $defaultVMPath" 171 | $VMX_default_Path = $defaultVMPath 172 | $defaultselection = "preferences" 173 | } 174 | else { 175 | Write-Verbose "no defaultVMPath in prefernces" 176 | } 177 | } 178 | 179 | 180 | 181 | 182 | if (!$VMX_Path) { 183 | if (!$VMX_default_Path) { 184 | Write-Verbose "trying to use default vmxdir in homedirectory" 185 | try { 186 | $defaultselection = "homedir" 187 | $Global:vmxdir = Join-Path $HOME $VMX_BasePath 188 | } 189 | catch { 190 | Write-Warning "could not evaluate default Virtula machines home, using $PSScriptRoot" 191 | $Global:vmxdir = $PSScriptRoot 192 | $defaultselection = "ScriptRoot" 193 | Write-Verbose "using psscriptroot as vmxdir" 194 | } 195 | 196 | } 197 | else { 198 | if (Test-Path $VMX_default_Path) { 199 | $Global:vmxdir = $VMX_default_Path 200 | } 201 | else { 202 | $Global:vmxdir = $PSScriptRoot 203 | } 204 | 205 | } 206 | } 207 | else { 208 | $Global:vmxdir = $VMX_Path 209 | } 210 | 211 | #### some vmx api error handlers :-) false positives from experience 212 | $Global:VMrunErrorCondition = @( 213 | "Waiting for Command execution Available", 214 | "Error", 215 | "Unable to connect to host.", 216 | "Error: Unable to connect to host.", 217 | "Error: The operation is not supported for the specified parameters", 218 | "Unable to connect to host. Error: The operation is not supported for the specified parameters", 219 | "Error: The operation is not supported for the specified parameters", 220 | "Error: vmrun was unable to start. Please make sure that vmrun is installed correctly and that you have enough resources available on your system.", 221 | "Error: The specified guest user must be logged in interactively to perform this operation", 222 | "Error: A file was not found", 223 | "Error: VMware Tools are not running in the guest", 224 | "Error: The VMware Tools are not running in the virtual machine" ) 225 | if (!$GLobal:VMware_packer) { 226 | Write-Warning "Please install 7za/p7zip, otherwise labbtools can not expand OS Masters" 227 | } 228 | if ($OS_Version) { 229 | write-Host -ForegroundColor Gray " ==>$OS_Version" 230 | } 231 | else { 232 | write-host "error Detecting OS" 233 | Break 234 | } 235 | Write-Host -ForegroundColor Gray " ==>running vmxtoolkit for $Global:vmxtoolkit_type" 236 | Write-Host -ForegroundColor Gray " ==>vmrun is $Global:vmrun" 237 | Write-Host -ForegroundColor Gray " ==>vmwarepath is $Global:vmwarepath" 238 | if ($VMX_Path) { 239 | Write-Host -ForegroundColor Gray " ==>using virtual machine directory from module load $Global:vmxdir" 240 | } 241 | else { 242 | Write-Host -ForegroundColor Gray " ==>using virtual machine directory from $defaultselection`: $Global:vmxdir" 243 | } 244 | Write-Host -ForegroundColor Gray " ==>running VMware Version Mode $Global:vmwareversion" 245 | Write-Host -ForegroundColor Gray " ==>OVFtool is $Global:VMware_OVFTool" 246 | Write-Host -ForegroundColor Gray " ==>Packertool is $GLobal:VMware_packer" 247 | Write-Host -ForegroundColor Gray " ==>vdisk manager is $Global:vmware_vdiskmanager" 248 | Write-Host -ForegroundColor Gray " ==>webrequest tool is $webrequestor" 249 | Write-Host -ForegroundColor Gray " ==>isotool is $Global:mkisofs" 250 | --------------------------------------------------------------------------------