From fb641c8a1c514c407c15b28f4fb17350f5ef4411 Mon Sep 17 00:00:00 2001 From: dmilov Date: Mon, 7 Jun 2021 09:58:47 +0300 Subject: [PATCH] License PowerCLI-Examples-Scripts repository under BSD-2 Clause (#462) As part of the VMware open source program, we have to update this repository with the correct license and copyright information. We add the BSD-2 Clause License for this repository. We mark all source code provided by VMware with the Copyright notice under BSD-2 Clause license. * Update repository license to BSD 2-Clause License * Update Copyright --- LICENSE.md | 42 --- LICENSE.txt | 12 + Modules/Backup-VCSA/Backup-VCSA.psm1 | 4 + Modules/ContentLibrary/ContentLibrary.psm1 | 6 +- Modules/CrossvCentervmotion/XVM.psm1 | 6 +- .../DatastoreFunctions.psm1 | 8 +- Modules/Get-NICDetails/Get-NICDetails.psm1 | 18 +- .../Get-NewAndRemovedVMs.psm1 | 16 +- Modules/Get-VMmaxIOPS/Get-VMmaxIOPS.psm1 | 24 +- Modules/Konfig-ESXi/Konfig-ESXi.psm1 | 50 +-- Modules/NSXT/NSXT.psd1 | 6 +- Modules/NSXT/NSXT.psm1 | 292 +++++++++--------- Modules/PSvLIMessage/PSvLIMessage.psm1 | 22 +- Modules/PerVMEVC/PerVMEVC.psm1 | 56 ++-- Modules/ProactiveHA/ProactiveHA.psm1 | 6 +- .../Recommend-Sizing/Recommend-Sizing.psm1 | 56 ++-- Modules/SRM/Examples/ReportConfiguration.ps1 | 13 +- Modules/SRM/Examples/SrmTagging.ps1 | 11 +- Modules/SRM/LICENSE.txt | 8 +- Modules/SRM/Meadowcroft.Srm.Protection.ps1 | 21 +- Modules/SRM/Meadowcroft.Srm.Recovery.ps1 | 25 +- Modules/SRM/Meadowcroft.Srm.Storage.ps1 | 11 +- Modules/SRM/Meadowcroft.Srm.psd1 | 11 +- Modules/SRM/Meadowcroft.Srm.psm1 | 8 + Modules/SRM/NOTICE.txt | 9 +- Modules/Set-CBT/Set-CBT.psm1 | 28 +- Modules/Start-UNMAP/Start-UNMAP.psm1 | 22 +- Modules/VAMI/VAMI.psm1 | 9 +- Modules/VCHA/VCHA.psm1 | 4 + Modules/VCSA/VCSA.psm1 | 4 + Modules/VMCPFunctions/VMCPFunctions.psm1 | 46 +-- Modules/VMware.CSP/VMware.CSP.psm1 | 6 +- .../VMware.Community.CISTag.psd1 | 5 + .../VMware.Community.CISTag.psm1 | 136 ++++---- Modules/VMware.DRaaS/VMware.DRaaS.psd1 | Bin 7718 -> 7864 bytes Modules/VMware.DRaaS/VMware.DRaaS.psm1 | 4 + Modules/VMware.HCX/VMware.HCX.psd1 | 5 + Modules/VMware.HCX/VMware.HCX.psm1 | 8 +- Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psd1 | 5 + Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psm1 | 4 + Modules/VMware.VMC/VMware.VMC.psd1 | Bin 8706 -> 8850 bytes Modules/VMware.VMC/VMware.VMC.psm1 | 32 +- .../VMware.VMEncryption.psd1 | 5 + .../VMware.VMEncryption.psm1 | 5 + .../VMware.VsanEncryption.psd1 | Bin 5098 -> 5244 bytes .../VMware.VsanEncryption.psm1 | 131 ++++---- .../VMware.WorkloadManagement.psd1 | 5 + .../VMware.WorkloadManagement.psm1 | 6 +- .../VMware.WorkspaceOneAccess.psd1 | 5 + .../VMware.WorkspaceOneAccess.psm1 | 9 +- Modules/VMware.vSphere.SsoAdmin/Connect.ps1 | 2 +- Modules/VMware.vSphere.SsoAdmin/Group.ps1 | 2 +- .../IdentitySource.ps1 | 2 +- .../VMware.vSphere.SsoAdmin/LockoutPolicy.ps1 | 2 +- .../PasswordPolicy.ps1 | 2 +- .../VMware.vSphere.SsoAdmin.psd1 | 5 + .../VMware.vSphere.SsoAdmin.psm1 | 7 +- .../net45/VMware.vSphere.LsClient.dll | Bin 32256 -> 32256 bytes .../net45/VMware.vSphere.SsoAdmin.Utils.dll | Bin 7168 -> 7168 bytes .../net45/VMware.vSphere.SsoAdminClient.dll | Bin 337408 -> 337408 bytes .../netcoreapp3.1/VMware.vSphere.LsClient.dll | Bin 32256 -> 32256 bytes .../VMware.vSphere.SsoAdmin.Utils.dll | Bin 7168 -> 7168 bytes .../VMware.vSphere.SsoAdminClient.dll | Bin 337920 -> 337920 bytes .../LookupServiceClient.cs | 7 +- .../AcceptAllX509CertificateValidator.cs | 7 +- ...reStringArgumentTransformationAttribute.cs | 7 +- ...inServerArgumentTransformationAttribute.cs | 15 +- .../IntegrationTests.cs | 7 +- .../ActiveDirectoryIdentitySource.cs | 7 +- .../DataTypes/Group.cs | 7 +- .../DataTypes/IdentitySource.cs | 7 +- .../DataTypes/LocalOSIdentitySource.cs | 7 +- .../DataTypes/LockoutPolicy.cs | 7 +- .../DataTypes/PasswordPolicy.cs | 7 +- .../DataTypes/PersonUser.cs | 7 +- .../DataTypes/SsoAdminServer.cs | 15 +- .../DataTypes/SystemIdentitySource.cs | 7 +- .../DataTypes/TokenLifetime.cs | 7 +- .../SsoAdminClient.cs | 7 +- .../UserPassSecurityContext.cs | 13 +- Modules/VMware.vSphere.SsoAdmin/src/build.ps1 | 8 +- .../src/test/ConnectDisconnect.Tests.ps1 | 8 +- .../src/test/Group.Tests.ps1 | 7 +- .../src/test/IdentitySource.Tests.ps1 | 7 +- .../src/test/LockoutPolicy.Tests.ps1 | 7 +- .../src/test/LsClient.Tests.ps1 | 7 +- .../src/test/PasswordPolicy.Tests.ps1 | 7 +- .../src/test/PersonUser.Tests.ps1 | 7 +- .../src/test/RunTests.ps1 | 7 +- .../src/test/TokenLifetime.Tests.ps1 | 7 +- .../Validate-ESXiPackages.psm1 | 25 +- Modules/apply-hardening/apply-hardening.psm1 | 28 +- Modules/rCisTag/Examples/01-Get.ps1 | 8 +- Modules/rCisTag/Examples/02-New.ps1 | 8 +- Modules/rCisTag/Examples/03-Set.ps1 | 8 +- Modules/rCisTag/Examples/04-Remove.ps1 | 8 +- Modules/rCisTag/Examples/05-Tag-Datastore.ps1 | 8 +- Modules/rCisTag/Examples/CisConfig.ps1 | 7 +- Modules/vCenter.Alarms/New-vCenterAlarms.ps1 | 11 +- Modules/vCenter.Alarms/vCenter.Alarms.psm1 | 163 +++++----- Modules/vCenterCEIP/vCenterCEIP.psm1 | 7 +- .../vCenterManualMigration.psm1 | 6 +- NOTICE.txt | 3 + Scripts/AutomaticVMFSUnmap.ps1 | 5 + Scripts/Check-VMwareTools.ps1 | 12 +- Scripts/DatastoreSIOCStatistics.ps1 | 37 ++- Scripts/ESXInstallDate.ps1 | 5 + Scripts/ESXInstalledVIBs.ps1 | 5 + Scripts/ExportImportTags.ps1 | 30 +- Scripts/Get-BiosBootStatus.ps1 | 12 +- 110 files changed, 1066 insertions(+), 790 deletions(-) delete mode 100644 LICENSE.md create mode 100644 LICENSE.txt create mode 100644 NOTICE.txt diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 9d47952..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,42 +0,0 @@ -# PowerCLI-Example-Scripts -VMWARE TECHNOLOGY PREVIEW LICENSE AGREEMENT - -Notice to User: This Technology Preview License Agreement (the “Agreement”) is a CONTRACT between you (either an individual or a single entity) (“you” or “Licensee”) and VMware, Inc. (“VMware”), which covers your use of the Technology Preview Software (as defined below). If you do not agree to the terms of this Agreement, then do not install or use the Technology Preview Software. By explicitly accepting this Agreement, however, or by installing, copying, downloading, accessing, or otherwise using the Technology Preview Software, you are acknowledging and agreeing to be bound by the following terms. - -1. DEFINITIONS. (a) “Technology Preview Software” means the unreleased, concept version of VMware’s software, in object form only, excluding any Open Source Software provided with the such software, and the media and Documentation provided by VMware to Licensee and for which Licensee is granted a use license pursuant to this Agreement. (b) “Documentation” means the printed and online written reference material furnished to Licensee in conjunction with the Technology Preview Software, including, without limitation, instructions, testing guidelines, and end user guides. (c) “Intellectual Property Rights” shall mean all intellectual property rights, including, without limitation, patent, copyright, trademark, and trade secret. (d) “Open Source Software” means various open source software components provided with the Technology Preview Software that are licensed to you under the terms of the applicable license agreements included with such open source software components or other materials for the Technology Preview Software. (e) “Updates” means a modification, error correction, bug fix, new release, or other update to or for the Technology Preview Software. - -2. LICENSE GRANT, USE AND OWNERSHIP. - - (a) Limited License. Subject to the terms and conditions of this Agreement, VMware grants to Licensee a non-exclusive, non-transferable license (without the right to sublicense) (i) to use the Technology Preview Software in accordance with the Documentation solely for purposes of internal testing and evaluation, (ii) to use the Documentation provided with the Technology Preview Software in support of Licensee’s authorized use of the Technology Preview Software, and (iii) to copy the Technology Preview Software for archival or backup purposes, provided that all titles and trademarks, copyright, and restricted rights notices are reproduced on such copies. - - (b) Evaluation Feedback. The purpose of this limited license is the testing and evaluation of the Technology Preview Software as set forth above. In furtherance of this purpose, Licensee shall provide feedback to VMware concerning the functionality and performance of the Technology Preview Software from time to time as reasonably requested by VMware, including, without limitation, identifying potential errors and improvements. Licensee will provide the requested feedback in a manner that is convenient to Licensee subject to reasonable availability of Licensee’s personnel. Notwithstanding the foregoing, prior to Licensee disclosing to VMware any information under this Agreement that Licensee considers proprietary or confidential, Licensee shall obtain VMware’s prior written approval to disclose such information to VMware, and without such prior written approval from VMware, Licensee shall not disclose any such information to VMware. VMware may use feedback to improve or enhance its products and, accordingly, you hereby grant to VMware a non-exclusive, perpetual, irrevocable, royalty-free, transferable, worldwide right and license, with the right to sublicense, to use, reproduce, disclose, distribute, perform, display, modify, prepare derivative works of and otherwise exploit the feedback and other information without restriction in any manner now known or in the future conceived and to make, use, sell, offer to sell, import and export any product or service that incorporates the feedback and other information. - - (c) Restrictions. Licensee shall not copy or use the Technology Preview Software (including the Documentation) except as expressly permitted in this Agreement. Except to the extent that any applicable mandatory laws prevent VMware restraining Licensee from doing so, Licensee will not, and will not permit any third party to, sublicense, rent, copy, modify, create derivative works of, translate, reverse engineer, decompile, disassemble, or otherwise reduce to human perceivable form any portion of the Technology Preview Software or accompanying Documentation. Without limiting the generality of the foregoing, Licensee shall not use the Technology Preview Software for Licensee’s product development or any other commercial purpose. The Technology Preview Software and all performance data and test results, including without limitation, benchmark test results (collectively “Performance Data”) relating to the Technology Preview Software are the Confidential Information of VMware, and will be treated in accordance with the terms of Section 4 of this Agreement. Accordingly, Licensee shall not publish or disclose to any third party any Performance Data relating to the Technology Preview Software. - - (d) Ownership. VMware shall own and retain all right, title and interest in and to the Intellectual Property Rights in the Technology Preview Software, subject only to the limited license expressly set forth in Section 2(a) hereof. Licensee does not acquire any other rights, express or implied, in the Technology Preview Software. ALL RIGHTS NOT EXPRESSLY GRANTED HEREUNDER ARE RESERVED TO VMWARE. - - (e) No Support Services. VMware is under no obligation to support the Technology Preview Software in any way or to provide any Updates to Licensee. In the event VMware, in its sole discretion, supplies any Update to Licensee, the Update shall be deemed Technology Preview Software under this Agreement and shall be subject to the terms and conditions of this Agreement. - - (f) Third-Party Software. The Technology Preview Software may enable a computer to run multiple instances of third-party guest operating systems and application programs. Licensee acknowledges that Licensee is responsible for obtaining any licenses necessary to operate any third-party software, including guest operating systems and application programs. - - (g) Open Source Software. Except for Sections 5, 6 and 7, the terms and conditions of this Agreement shall not apply to any Open Source Software accompanying the Technology Preview Software. Any such Open Source Software is provided under the terms of the open source license agreement or copyright notice accompanying such Open Source Software or in the open source licenses file accompanying the Technology Preview Software. - -3. TERM AND TERMINATION. Licensee’s rights with respect to the Technology Preview Software will terminate upon the earlier of (a) automatic expiration of the Technology Preview Software based on the system date, or (b) termination by VMware, in its sole discretion, of Licensee’s rights with respect to the Technology Preview Software provided under this Agreement upon notice on the VMware website. Upon any expiration or termination of rights with respect to the Technology Preview Software under this Agreement, the rights and licenses granted to Licensee under this Agreement shall immediately terminate, and Licensee shall immediately cease using, and will destroy or render practically inaccessible the Technology Preview Software, Documentation, and all other tangible items in Licensee’s possession or control that contain Confidential Information. The rights and obligations of the parties set forth in Sections 2(b), 2(c), 2(d), 2(e), 2(f), 2(g), 3, 4, 5, 6 and 7 shall survive termination or expiration of this Agreement for any reason. - -4. CONFIDENTIALITY. (a) Confidentiality. "Confidential Information" means the Technology Preview Software, all information regarding the Technology Preview Software (including any trade secrets, know-how, inventions, techniques, processes, and algorithms embodied in the Technology Preview Software), Documentation, Performance Data, any Updates, and other information provided by VMware to Licensee under this Agreement, whether disclosed orally, in writing, or by examination or inspection, other than information that Licensee can demonstrate (i) was already known to Licensee, other than under an obligation of confidentiality, at the time of disclosure; (ii) was generally available in the public domain at the time of disclosure to Licensee; (iii) became generally available in the public domain after disclosure other than through any act or omission of Licensee; (iv) was subsequently lawfully disclosed to Licensee by a third party without any obligation of confidentiality; or (v) was independently developed by Licensee without use of or reference to any information or materials disclosed by VMware or its suppliers. If Licensee is required to disclose Confidential Information by applicable law or court order, Licensee shall notify VMware of the required disclosure promptly in writing and shall cooperate with VMware in any lawful action to contest or limit the scope of the required disclosure. Confidential Information shall include, without limitation, any information relating to VMware products, product roadmaps, and other technical, business, financial and product development plans, forecasts and strategies. Licensee shall not use any Confidential Information for any purpose other than as expressly authorized under this Agreement. In no event shall Licensee use the Technology Preview Software or any Confidential Information to develop, manufacture, market, sell, or distribute any product or service, including any VMware products. Licensee shall not disclose any Confidential Information to any third party. Without limiting the foregoing, Licensee shall use at least the same degree of care that it uses to prevent the disclosure of its own confidential information of like importance, but in no event less than reasonable care, to prevent the disclosure of such Confidential Information. (b) Additional Confidentiality Restrictions for Highly Confidential Technology Preview Software. For certain Technology Preview Software designated by VMware as highly confidential (“Highly Confidential Technology Preview Software”) in VMware’s correspondence to you regarding this Technology Preview Software or in any Documentation, additional heightened confidentiality restrictions designated below will apply. (i) Licensee shall limit dissemination of Highly Confidential Technology Preview Software and related information concerning product features, future technologies and roadmaps only to Information Technology teams and/or software/solutions development teams of Licensee designated by VMware, and only to individuals on those teams who have a need to know the Confidential Information for purposes expressly authorized under this Agreement. For clarity and without limiting the generality of the foregoing, Licensee shall not disseminate any Highly Confidential Technology Preview Software to Licensee's sales and marketing field organizations. Licensee will assign an employee who will be primarily responsible (“Primary Contact”) for ensuring that the terms of this Agreement are complied with. (ii) Licensee acknowledges that damages for improper disclosure of Highly Confidential Technology Preview Software or related information concerning product features, future technologies and roadmaps may be irreparable and that monetary damages would be inadequate to compensate VMware for any breach of this Agreement. In the event that VMware reasonably believes that Licensee has disseminated certain of such Highly Confidential Technology Preview Software or related information concerning product features, future technologies and roadmaps to an unauthorized party, Licensee will be immediately removed from VMware’s Technology Preview Software program and will not be permitted to participate in any VMware Technology Preview Software program in the future. Additionally, all rights and licenses granted to Licensee under this Agreement shall immediately terminate in accordance with Section 3 herein (Term and Termination). (c) Remedies. In addition to all other remedies available in law or otherwise, VMware is entitled to seek equitable relief, including injunctive relief, against the threatened breach of this Agreement or the continuation of any such breach. - -5. LIMITATION OF LIABILITY. IT IS UNDERSTOOD THAT THE TECHNOLOGY PREVIEW SOFTWARE IS PROVIDED WITHOUT CHARGE FOR LIMITED EVALUATION PURPOSES. ACCORDINGLY, THE TOTAL LIABILITY OF VMWARE AND ITS LICENSORS ARISING OUT OF OR RELATED TO THIS AGREEMENT SHALL NOT EXCEED US$100.00. TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT SHALL VMWARE OR ITS LICENSORS HAVE LIABILITY FOR ANY INDIRECT, INCIDENTAL, PUNITIVE, SPECIAL, OR CONSEQUENTIAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, OR LOSS OF BUSINESS INFORMATION), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY (INCLUDING WITHOUT LIMITATION, TORT, STATUTE, CONTRACT OR OTHER), EVEN IF VMWARE AND ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. - -6. WARRANTY DISCLAIMER. IT IS UNDERSTOOD THAT THE TECHNOLOGY PREVIEW SOFTWARE, OPEN SOURCE SOFTWARE, DOCUMENTATION, AND ANY UPDATES MAY CONTAIN ERRORS AND ARE PROVIDED FOR LIMITED EVALUATION ONLY. THE TECHNOLOGY PREVIEW SOFTWARE, THE OPEN SOURCE SOFTWARE, THE DOCUMENTATION, AND ANY UPDATES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE. VMWARE AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. Licensee acknowledges that VMware has not publicly announced the availability of the Technology Preview Software, that such Technology Preview Software may contain features currently under development, that VMware has not promised or guaranteed to Licensee that such Technology Preview Software will be announced or made available to anyone in the future, that VMware has no express or implied obligation to Licensee to announce or introduce the Technology Preview Software, that VMware has no obligation to introduce a product similar to or compatible with the Technology Preview Software, and that any version number (if any) referenced is subject to change and does not in any way represent VMware’s commitment to release any product in the future. Accordingly, Licensee acknowledges that any research or development that it performs regarding the Technology Preview Software or any product associated with the Technology Preview Software is done entirely at Licensee’s own risk. Specifically, the Technology Preview Software may contain features, functionality or modules that will not be included in the production version of the Technology Preview Software, if released, or that will be marketed separately for additional fees. - -7. OTHER PROVISIONS. (a) Governing Law. This Agreement, and all disputes arising out of or related thereto, shall be governed by and construed under the laws of the State of California without reference to conflict of laws principles. All such disputes shall be subject to the exclusive jurisdiction of the state and federal courts located in Santa Clara County, California, and the parties agree and submit to the personal and exclusive jurisdiction and venue of these courts. The United Nations Convention for the International Sale of Goods shall not apply. (b) Export Control.  The Technology Preview Software is of United States origin and is provided subject to the U.S. Export Administration Regulations. Diversion contrary to U.S. law is prohibited. Without limiting the foregoing, you agree that (i) you are not, and are not acting on behalf of, any person who is a citizen, national, or resident of, or who is controlled by the government of, Cuba, Iran, North Korea, Sudan, or Syria, or any other country to which the United States has prohibited export transactions; (ii) you are not, and are not acting on behalf of, any person or entity listed on the U.S. Treasury Department list of Specially Designated Nationals and Blocked Persons, or the U.S. Commerce Department Denied Persons List or Entity List; and (iii) you will not use the Technology Preview Software for, and will not permit the Technology Preview Software to be used for, any purposes prohibited by law, including, without limitation, for any prohibited development, design, manufacture or production of missiles or nuclear, chemical or biological weapons. U.S. Export Control Classification Numbers (ECCN’s) may be found at VMware help page: http://www.vmware.com/help/export-control. (c) Modification. This is the entire agreement between the parties relating to the subject matter hereof and all other terms are rejected. No waiver or modification of this Agreement shall be valid unless in writing signed by each party. The waiver of a breach of any term hereof shall in no way be construed as a waiver of any other term or breach hereof. If any provision of this Agreement is held by a court of competent jurisdiction to be contrary to law, the remaining provisions of this Agreement shall remain in full force and effect. (d) Data Privacy. Licensee agrees that VMware may process technical and related usage information about Licensee’s use of the Technology Preview Software for statistical and analytical purposes. Usage information is collected strictly for internal statistical and analytical purposes for the development of VMware products and services. Licensee understands that any log files generated in order to obtain support from VMware may contain sensitive, confidential or personal information. Licensee should consider obfuscating any logs before sending them to VMware. VMware’s privacy policy (http://www.vmware.com/help/privacy.html) shall apply. - -8. ASSIGNMENT. Licensee shall not assign this Agreement or any rights or obligations hereunder, directly or indirectly, by operation of law, merger, acquisition of stock or assets, or otherwise, without the prior written consent of VMware. Any attempted assignment or transfer in violation of the foregoing will be null and void. Subject to the foregoing, this Agreement shall inure to the benefit of and be binding upon the parties and their respective successors and permitted assigns. - -9. CONTACT INFORMATION. If you have any questions about this Agreement, please direct all correspondence to: VMware, Inc., 3401 Hillview Avenue, Palo Alto, CA 94304, United States of America or email info@vmware.com. VMware is a trademark of VMware, Inc. and is registered in the U.S. and numerous other countries. - -Rev. 2014Mar10 - - - - diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..18c048c --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,12 @@ +PowerCLI-Example-Scripts +Copyright 2021 VMware, Inc. + +BSD 2-Clause License + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Modules/Backup-VCSA/Backup-VCSA.psm1 b/Modules/Backup-VCSA/Backup-VCSA.psm1 index ee59f74..c444e10 100644 --- a/Modules/Backup-VCSA/Backup-VCSA.psm1 +++ b/Modules/Backup-VCSA/Backup-VCSA.psm1 @@ -1,3 +1,7 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> Function Backup-VCSAToFile { <# .NOTES diff --git a/Modules/ContentLibrary/ContentLibrary.psm1 b/Modules/ContentLibrary/ContentLibrary.psm1 index 3443897..dc9d012 100644 --- a/Modules/ContentLibrary/ContentLibrary.psm1 +++ b/Modules/ContentLibrary/ContentLibrary.psm1 @@ -1,4 +1,8 @@ -Function Get-ContentLibrary { +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> +Function Get-ContentLibrary { <# .NOTES =========================================================================== diff --git a/Modules/CrossvCentervmotion/XVM.psm1 b/Modules/CrossvCentervmotion/XVM.psm1 index 555ec5d..1fd1ff0 100644 --- a/Modules/CrossvCentervmotion/XVM.psm1 +++ b/Modules/CrossvCentervmotion/XVM.psm1 @@ -1,3 +1,7 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> Function Get-XVCMStatus { <# .NOTES @@ -12,7 +16,7 @@ Function Get-XVCMStatus { .EXAMPLE Get-XVCMStatus #> - $Uri = "http://localhost:8080/api/status" #Updated for 2.0, Old: "http://localhost:8080/api/ping" + $Uri = "http://localhost:8080/api/status" #Updated for 2.0, Old: "http://localhost:8080/api/ping" $results = Invoke-WebRequest -Uri $Uri -Method GET -TimeoutSec 5 diff --git a/Modules/DatastoreFunctions/DatastoreFunctions.psm1 b/Modules/DatastoreFunctions/DatastoreFunctions.psm1 index b908a40..dae0bc5 100644 --- a/Modules/DatastoreFunctions/DatastoreFunctions.psm1 +++ b/Modules/DatastoreFunctions/DatastoreFunctions.psm1 @@ -47,7 +47,7 @@ Function Get-HostViews { } write-progress -activity "Collecting ESXi Host Views" -completed $allHosts - } + } } Function Get-DatastoreMountInfo { @@ -74,7 +74,7 @@ Function Get-DatastoreMountInfo { Throw "No Datastores found.`nIs ""$Datastore"" a Datastore Object?" } $allDatastoreNAAs = foreach ($ds in $allDatastores) {$ds.ExtensionData.Info.vmfs.extent[0].diskname} - + #Build the array of custom Host Objects $allHosts = Get-HostViews -datastore $allDatastores $output = @() @@ -89,9 +89,9 @@ Function Get-DatastoreMountInfo { $thisDatastore = $alldatastores | ? {$_.ExtensionData.Info.vmfs.extent[0].diskname -eq $device.canonicalName} $hostviewDSAttachState = "" if ($device.operationalState[0] -eq "ok") { - $hostviewDSAttachState = "Attached" + $hostviewDSAttachState = "Attached" } elseif ($device.operationalState[0] -eq "off") { - $hostviewDSAttachState = "Detached" + $hostviewDSAttachState = "Detached" } else { $hostviewDSAttachState = $device.operationalstate[0] } diff --git a/Modules/Get-NICDetails/Get-NICDetails.psm1 b/Modules/Get-NICDetails/Get-NICDetails.psm1 index 30f1440..e8fa4b9 100644 --- a/Modules/Get-NICDetails/Get-NICDetails.psm1 +++ b/Modules/Get-NICDetails/Get-NICDetails.psm1 @@ -1,15 +1,15 @@ function Get-NICDetails { -<# +<# .NOTES =========================================================================== Created by: Markus Kraus Twitter: @VMarkus_K Private Blog: mycloudrevolution.com =========================================================================== - Changelog: - 2017.02 ver 1.0 Base Release + Changelog: + 2017.02 ver 1.0 Base Release =========================================================================== - External Code Sources: + External Code Sources: - =========================================================================== Tested Against Environment: @@ -35,11 +35,11 @@ #> [CmdletBinding()] -param( +param( [Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)] [ValidateNotNullorEmpty()] [String] $Clustername - + ) Begin { @@ -49,14 +49,14 @@ Begin { $Validate = $False thow "No Cluster '$myCluster' found!" } - + } Process { $MyView = @() if ($Validate -eq $True) { - + foreach ($myVMhost in ($myCluster | Get-VMHost)) { $esxcli2 = Get-ESXCLI -VMHost $myVMhost -V2 @@ -85,7 +85,7 @@ Process { } } - + $MyView } diff --git a/Modules/Get-NewAndRemovedVMs/Get-NewAndRemovedVMs.psm1 b/Modules/Get-NewAndRemovedVMs/Get-NewAndRemovedVMs.psm1 index 4a2e3ba..4a558eb 100644 --- a/Modules/Get-NewAndRemovedVMs/Get-NewAndRemovedVMs.psm1 +++ b/Modules/Get-NewAndRemovedVMs/Get-NewAndRemovedVMs.psm1 @@ -1,15 +1,15 @@ function Get-NewAndRemovedVMs { -<# +<# .NOTES =========================================================================== Created by: Markus Kraus Twitter: @VMarkus_K Private Blog: mycloudrevolution.com =========================================================================== - Changelog: - 2016.12 ver 1.0 Base Release + Changelog: + 2016.12 ver 1.0 Base Release =========================================================================== - External Code Sources: + External Code Sources: https://github.com/alanrenouf/vCheck-vSphere =========================================================================== Tested Against Environment: @@ -22,10 +22,10 @@ function Get-NewAndRemovedVMs { =========================================================================== .DESCRIPTION - This Function report newly created and deleted VMs by Cluster. + This Function report newly created and deleted VMs by Cluster. .Example - Get-NewAndRemovedVMs -ClusterName Cluster* | ft -AutoSize + Get-NewAndRemovedVMs -ClusterName Cluster* | ft -AutoSize .Example Get-NewAndRemovedVMs -ClusterName Cluster01 -Days 90 @@ -51,7 +51,7 @@ param( ) Begin { function Get-VIEventPlus { - + param( [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]]$Entity, [string[]]$EventType, @@ -117,7 +117,7 @@ Begin { { $events | % { $_.createdTime = $_.createdTime.ToLocalTime() } } - + $events } } diff --git a/Modules/Get-VMmaxIOPS/Get-VMmaxIOPS.psm1 b/Modules/Get-VMmaxIOPS/Get-VMmaxIOPS.psm1 index 27af1ad..2b0e67f 100644 --- a/Modules/Get-VMmaxIOPS/Get-VMmaxIOPS.psm1 +++ b/Modules/Get-VMmaxIOPS/Get-VMmaxIOPS.psm1 @@ -1,16 +1,16 @@ function Get-VMmaxIOPS { -<# +<# .NOTES =========================================================================== Created by: Markus Kraus Twitter: @VMarkus_K Private Blog: mycloudrevolution.com =========================================================================== - Changelog: - 2016.10 ver 1.0 Base Release + Changelog: + 2016.10 ver 1.0 Base Release 2016.11 ver 1.1 Added vSphere 6.5 Support, New Counters, More Error Handling =========================================================================== - External Code Sources: + External Code Sources: http://www.lucd.info/2011/04/22/get-the-maximum-iops/ https://communities.vmware.com/thread/485386 =========================================================================== @@ -24,7 +24,7 @@ function Get-VMmaxIOPS { =========================================================================== .DESCRIPTION - This Function will Create a VM Disk IOPS Report + This Function will Create a VM Disk IOPS Report .Example Get-VM TST* | Get-VMmaxIOPS -Minutes 60 | FT -Autosize @@ -34,17 +34,17 @@ function Get-VMmaxIOPS { Get-VMmaxIOPS -VMs $SampleVMs -Minutes 60 .PARAMETER VMs - Specify the VMs + Specify the VMs .PARAMETER Minutes - Specify the Minutes to report (10080 is one Week) + Specify the Minutes to report (10080 is one Week) #Requires PS -Version 4.0 #Requires -Modules VMware.VimAutomation.Core, @{ModuleName="VMware.VimAutomation.Core";ModuleVersion="6.3.0.0"} #> [CmdletBinding()] -param( +param( [Parameter(Mandatory=$true, ValueFromPipeline=$True, Position=0)] [ValidateNotNullorEmpty()] [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]] $VMs, @@ -55,7 +55,7 @@ param( Begin { # none } -Process { +Process { if ($_.PowerState -eq "PoweredOn") { #region: Global Definitions [int]$TimeRange = "-" + $Minutes @@ -82,7 +82,7 @@ Process { #region: Creating Reports Write-Verbose "$(Get-Date -Format G) Create Report..." - $reportPerf = @() + $reportPerf = @() $reportPerf = $stats | Group-Object -Property {$_.Entity.Name},Instance | %{ New-Object PSObject -Property @{ VM = $_.Values[0] @@ -98,7 +98,7 @@ Process { } Write-Verbose "$(Get-Date -Format G) Create Report completed" #endregion - + } Else { @@ -108,7 +108,7 @@ Process { } End { - # none + # none } } \ No newline at end of file diff --git a/Modules/Konfig-ESXi/Konfig-ESXi.psm1 b/Modules/Konfig-ESXi/Konfig-ESXi.psm1 index f14386a..bb2d54c 100644 --- a/Modules/Konfig-ESXi/Konfig-ESXi.psm1 +++ b/Modules/Konfig-ESXi/Konfig-ESXi.psm1 @@ -1,16 +1,16 @@ function Konfig-ESXi { -<# +<# .NOTES =========================================================================== Created by: Markus Kraus Twitter: @VMarkus_K Private Blog: mycloudrevolution.com =========================================================================== - Changelog: + Changelog: 2016.12 ver 1.0 Base Release - 2016.12 ver 1.1 ESXi 6.5 Tests, Minor enhancements + 2016.12 ver 1.1 ESXi 6.5 Tests, Minor enhancements =========================================================================== - External Code Sources: + External Code Sources: Function My-Logger : http://www.virtuallyghetto.com/ =========================================================================== Tested Against Environment: @@ -18,7 +18,7 @@ function Konfig-ESXi { PowerCLI Version: PowerCLI 6.3 R1, PowerCLI 6.5 R1 PowerShell Version: 4.0, 5.0 OS Version: Windows 8.1, Server 2012 R2 - Keyword: ESXi, NTP, SSH, Syslog, SATP, + Keyword: ESXi, NTP, SSH, Syslog, SATP, =========================================================================== .DESCRIPTION @@ -29,7 +29,7 @@ function Konfig-ESXi { * Syslog * Power Management * HP 3PAR SATP/PSP Rule - * ... + * ... .Example Konfig-ESXi -VMHost myesxi.lan.local -NTP 192.168.2.1, 192.168.2.2 -syslog "udp://loginsight.lan.local:514" @@ -51,14 +51,14 @@ function Konfig-ESXi { #> [CmdletBinding()] -param( +param( [Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)] [String] $VMHost, [Parameter(Mandatory=$true, ValueFromPipeline=$False, Position=1)] [array]$NTP, [Parameter(Mandatory=$true, ValueFromPipeline=$False, Position=2)] [String] $syslog - + ) Begin { @@ -75,11 +75,11 @@ Begin { } function Set-MyESXiOption { [CmdletBinding()] - param( + param( [Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)] [String] $Name, [Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=1)] - [String] $Value + [String] $Value ) process { $myESXiOption = Get-AdvancedSetting -Entity $ESXiHost -Name $Name @@ -89,7 +89,7 @@ Begin { } else { My-Logger " ESXi Option $Name already has Value $Value" - } + } } } } @@ -100,7 +100,7 @@ Process { #region: Start vCenter Connection My-Logger "Starting to Process ESXi Server Connection to $VMHost ..." if (($global:DefaultVIServers).count -gt 0) { - Disconnect-VIServer -Force -Confirm:$False -ErrorAction SilentlyContinue + Disconnect-VIServer -Force -Confirm:$False -ErrorAction SilentlyContinue } $VIConnection = Connect-VIServer -Server $VMHost if (-not $VIConnection.IsConnected) { @@ -118,9 +118,9 @@ Process { #endregion if ($Validate -eq $True) { - + #region: Enable SSH and disable SSH Warning - $SSHService = $ESXiHost | Get-VMHostService | where {$_.Key -eq 'TSM-SSH'} + $SSHService = $ESXiHost | Get-VMHostService | where {$_.Key -eq 'TSM-SSH'} My-Logger "Starting SSH Service..." if($SSHService.Running -ne $True){ Start-VMHostService -HostService $SSHService -Confirm:$false | Out-Null @@ -140,12 +140,12 @@ Process { #endregion #region: Config NTP - My-Logger "Removing existing NTP Server..." + My-Logger "Removing existing NTP Server..." try { - $ESXiHost | Remove-VMHostNtpServer -NtpServer (Get-VMHostNtpServer) -Confirm:$false + $ESXiHost | Remove-VMHostNtpServer -NtpServer (Get-VMHostNtpServer) -Confirm:$false } catch [System.Exception] { - Write-Warning "Error during removing existing NTP Servers." + Write-Warning "Error during removing existing NTP Servers." } My-Logger "Setting new NTP Servers..." foreach ($myNTP in $NTP) { @@ -154,16 +154,16 @@ Process { My-Logger "Configure NTP Service..." $NTPService = $ESXiHost | Get-VMHostService| Where-Object {$_.key -eq "ntpd"} - if($NTPService.Running -eq $True){ + if($NTPService.Running -eq $True){ Stop-VMHostService -HostService $NTPService -Confirm:$false | Out-Null } - if($NTPService.Policy -ne "on"){ + if($NTPService.Policy -ne "on"){ Set-VMHostService -HostService $NTPService -Policy "on" -confirm:$False | Out-Null } My-Logger "Configure Local Time..." - $HostTimeSystem = Get-View $ESXiHost.ExtensionData.ConfigManager.DateTimeSystem - $HostTimeSystem.UpdateDateTime([DateTime]::UtcNow) + $HostTimeSystem = Get-View $ESXiHost.ExtensionData.ConfigManager.DateTimeSystem + $HostTimeSystem.UpdateDateTime([DateTime]::UtcNow) My-Logger "Start NTP Service..." Start-VMHostService -HostService $NTPService -confirm:$False | Out-Null @@ -181,16 +181,16 @@ Process { #endregion #region: Configure Static HighPower - My-Logger "Setting PowerProfile to Static HighPower..." + My-Logger "Setting PowerProfile to Static HighPower..." try { $HostView = ($ESXiHost | Get-View) (Get-View $HostView.ConfigManager.PowerSystem).ConfigurePowerPolicy(1) } catch [System.Exception] { - Write-Warning "Error during Configure Static HighPower. See latest errors..." + Write-Warning "Error during Configure Static HighPower. See latest errors..." } #endregion - + #region: Conf Syslog My-Logger "Setting Syslog Firewall Rule ..." $SyslogFW = ($ESXiHost | Get-VMHostFirewallException | where {$_.Name -eq 'syslog'}) @@ -225,7 +225,7 @@ Process { $esxcli2.storage.nmp.satp.rule.add.Invoke($arguments) } catch { - Write-Warning "Error during Configure HP 3PAR SATP/PSP Rule. See latest errors..." + Write-Warning "Error during Configure HP 3PAR SATP/PSP Rule. See latest errors..." } #endregion diff --git a/Modules/NSXT/NSXT.psd1 b/Modules/NSXT/NSXT.psd1 index 3cee460..04cfc6e 100644 --- a/Modules/NSXT/NSXT.psd1 +++ b/Modules/NSXT/NSXT.psd1 @@ -1,3 +1,7 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> @{ ModuleToProcess = 'NSXT.psm1' ModuleVersion = '1.0.0.0' @@ -34,7 +38,7 @@ 'Get-NSXTIPAMIPBlock', 'Set-NSXTIPAMIPBlock', 'Remove-NSXTIPAMIPBlock' - + PrivateData = @{ PSData = @{ diff --git a/Modules/NSXT/NSXT.psm1 b/Modules/NSXT/NSXT.psm1 index 4e135e8..131adab 100644 --- a/Modules/NSXT/NSXT.psm1 +++ b/Modules/NSXT/NSXT.psm1 @@ -1,4 +1,8 @@ -Function Get-NSXTController { +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> +Function Get-NSXTController { Param ( [parameter(Mandatory=$false,ValueFromPipeline=$true)][string]$Id ) @@ -10,7 +14,7 @@ } else { $nodes = $clusterNodeService.list().results | where { $_.manager_role -eq $null } } - + $results = @() foreach ($node in $nodes) { $nodeId = $node.id @@ -64,7 +68,7 @@ Function Get-NSXTFabricNode { Version = $node.os_version; Status = $nodeStatusResult.host_node_deployment_status ManagerStatus = $nodeStatusResult.mpa_connectivity_status - ControllerStatus = $nodeStatusResult.lcp_connectivity_status + ControllerStatus = $nodeStatusResult.lcp_connectivity_status } $results+=$tmp } @@ -177,13 +181,13 @@ Function Get-NSXTTransportNode { .Synopsis Retrieves the transport_node information .DESCRIPTION - Retrieves transport_node information for a single or multiple IDs. Execute with no parameters to get all ports, specify a transport_node if known. + Retrieves transport_node information for a single or multiple IDs. Execute with no parameters to get all ports, specify a transport_node if known. .EXAMPLE Get-NSXTTransportNode .EXAMPLE Get-NSXTThingTemplate -Tranport_node_id "TN ID" -#> - +#> + Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] [Alias("Id","Tranportnode_id")] @@ -214,7 +218,7 @@ Function Get-NSXTTransportNode { } foreach ($NSXTransportNode in $NSXTransportNodes) { - + $results = [NSXTransportNode]::new() $results.Name = $NSXTransportNode.display_name; $results.Transport_node_id = $NSXTransportNode.Id; @@ -225,7 +229,7 @@ Function Get-NSXTTransportNode { $results.transport_zone_endpoints = $NSXTransportNode.transport_zone_endpoints; $results.host_switches = $NSXTransportNode.host_switches $results - } + } } } @@ -239,8 +243,8 @@ Function Get-NSXTTraceFlow { Get-NSXTTraceFlow .EXAMPLE Get-NSXTTraceFlow -traceflow_id "TF ID -#> - +#> + Param ( [parameter(Mandatory=$false,ValueFromPipeline=$true)] [Alias("Id")] @@ -248,7 +252,7 @@ Function Get-NSXTTraceFlow { ) $NSXTraceFlowsService = Get-NsxtService -Name "com.vmware.nsx.traceflows" - + if($traceflow_id) { $NSXTraceFlows = $NSXTraceFlowsService.get($traceflow_id) } else { @@ -267,7 +271,7 @@ Function Get-NSXTTraceFlow { } foreach ($NSXTraceFlow in $NSXTraceFlows) { - + $results = [NSXTraceFlow]::new() $results.traceflow_id = $NSXTraceFlow.Id; $results.Operation_State = $NSXTraceFlow.operation_state; @@ -277,7 +281,7 @@ Function Get-NSXTTraceFlow { $results.dropped = $NSXTraceFlow.Counters.dropped_count; $results.analysis = $NSXTraceFlow.analysis $results - } + } } Function Get-NSXTTraceFlowObservations { @@ -290,8 +294,8 @@ Function Get-NSXTTraceFlowObservations { Get-NSXTTraceFlowObservations -traceflow_id "TF ID" .EXAMPLE Get-NSXTTraceFlow | Get-NSXTTraceFlowObservations -#> - +#> + Param ( [parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] [Alias("Id")] @@ -302,9 +306,9 @@ Function Get-NSXTTraceFlowObservations { { $NSXTraceFlowsObservService = Get-NsxtService -Name "com.vmware.nsx.traceflows.observations" } - + Process - { + { if($traceflow_id) { $NSXTraceFlowsObserv = $NSXTraceFlowsObservService.list($traceflow_id) } else { @@ -327,7 +331,7 @@ Function Get-NSXTEdgeCluster { Get-NSXTEdgeCluster -edge_cluster_id "Edge Cluster ID" .EXAMPLE Get-NSXTThingTemplate | where name -eq "My Edge Cluster Name" -#> +#> Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] @@ -360,7 +364,7 @@ Function Get-NSXTEdgeCluster { else { $NSXEdgeClusters = $NSXTEdgeClustersService.list().results } - + foreach ($NSXEdgeCluster in $NSXEdgeClusters) { $results = [NSXEdgeCluster]::new() @@ -392,7 +396,7 @@ Function Get-NSXTLogicalRouter { Get-NSXTLogicalRouter | where name -eq "LR Name" .EXAMPLE (Get-NSXTLogicalRouter -Logical_router_id "LR ID").per_node_status -#> +#> Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] @@ -404,17 +408,17 @@ Function Get-NSXTLogicalRouter { { $NSXTLogicalRoutersService = Get-NsxtService -Name "com.vmware.nsx.logical_routers" $NSXTLogicalRoutersStatusService = Get-NsxtService -Name "com.vmware.nsx.logical_routers.status" - + class per_node_status { - $service_router_id + $service_router_id [ValidateSet("ACTIVE","STANDBY","DOWN","SYNC","UNKNOWN")] - $high_availability_status + $high_availability_status $transport_node_id per_node_status(){} per_node_status( - $service_router_id, + $service_router_id, $high_availability_status, $transport_node_id ) { @@ -423,7 +427,7 @@ Function Get-NSXTLogicalRouter { $this.transport_node_id = $transport_node_id } } - + class NSXTLogicalRouter { [string]$Name [string]$Logical_router_id @@ -453,10 +457,10 @@ Function Get-NSXTLogicalRouter { } foreach ($NSXLogicalRouter in $NSXLogicalRouters) { - + $NSXTLogicalRoutersStatus = $NSXTLogicalRoutersStatusService.get($NSXLogicalRouter.id) $results = [NSXTLogicalRouter]::new() - + foreach ($NSXTLogicalRouterStatus in $NSXTLogicalRoutersStatus.per_node_status) { $results.per_node_status += [per_node_status]::new($NSXTLogicalRouterStatus.service_router_id,$NSXTLogicalRouterStatus.high_availability_status,$NSXTLogicalRouterStatus.transport_node_id) } @@ -474,7 +478,7 @@ Function Get-NSXTLogicalRouter { $results.advanced_config =$NSXLogicalRouter.advanced_config; $results.firewall_sections =$NSXLogicalRouter.firewall_sections $results - } + } } } @@ -492,8 +496,8 @@ Function Get-NSXTRoutingTable { Get-NSXTLogicalRouter | where name -eq INT-T1 | Get-NSXTRoutingTable -transport_node_id ((Get-NSXTTransportNode | where name -match "INT")[0].transport_node_id) .EXAMPLE Get-NSXTLogicalRouter | where name -eq INT-T1 | Get-NSXTRoutingTable -transport_node_id (((Get-NSXTLogicalRouter | where name -eq INT-T1).per_node_status | where high_availability_status -eq ACTIVE).transport_node_id) -#> - +#> + Param ( [parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] [string]$Logical_router_id, @@ -515,14 +519,14 @@ Function Get-NSXTRoutingTable { hidden [string]$logical_router_port_id [long]$admin_distance } - } - + } + Process { $NSXTRoutingTable = $NSXTRoutingTableService.list($Logical_router_id,$transport_node_id,$null,$null,$null,$null,$null,'realtime') - + foreach ($NSXTRoute in $NSXTRoutingTable.results) { - + $results = [NSXTRoutingTable]::new() $results.Logical_router_id = $Logical_router_id; $results.lr_component_type = $NSXTRoute.lr_component_type; @@ -545,7 +549,7 @@ Function Get-NSXTFabricVM { Retrieves all VM's attached to the fabric. .EXAMPLE Get-NSXTFabricVM -#> +#> Begin { $NSXTVMService = Get-NsxtService -Name "com.vmware.nsx.fabric.virtual_machines" @@ -567,7 +571,7 @@ Function Get-NSXTFabricVM { { $NSXTVMs = $NSXTVMService.list().results - + foreach ($NSXTVM in $NSXTVMs) { $results = [NSXVM]::new() @@ -595,9 +599,9 @@ Function Get-NSXTBGPNeighbors { .EXAMPLE Get-NSXTBGPNeighbors -logical_router_id "LR ID" .EXAMPLE - Get-NSXTLogicalRouter | where name -eq "LR Name" | Get-NSXTBGPNeighbors -#> - + Get-NSXTLogicalRouter | where name -eq "LR Name" | Get-NSXTBGPNeighbors +#> + Param ( [parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] [Alias("Id")] @@ -639,7 +643,7 @@ Function Get-NSXTBGPNeighbors { $NSXTThings = $NSXTThingsService.list($logical_router_id).results foreach ($NSXTThing in $NSXTThings) { - + $results = [NSXTBGPNeighbors]::new() $results.Name = $NSXTThing.display_name; $results.logical_router_id = $NSXTThing.logical_router_id; @@ -664,7 +668,7 @@ Function Get-NSXTBGPNeighbors { $results.source_address = $NSXTThing.source_address; $results.source_addresses = $NSXTThing.source_addresses $results - } + } } } @@ -682,7 +686,7 @@ Function Get-NSXTForwardingTable { Get-NSXTLogicalRouter | where name -eq "LR Name" | Get-NSXTForwardingTable -transport_node_id ((Get-NSXTTransportNode | where name -match "Edge Name")[0].transport_node_id) .EXAMPLE Get-NSXTLogicalRouter | where name -eq "LR Name" | Get-NSXTForwardingTable -transport_node_id (((Get-NSXTLogicalRouter | where name -eq "Edge Name").per_node_status | where high_availability_status -eq ACTIVE).transport_node_id) -#> +#> Param ( [parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] @@ -704,14 +708,14 @@ Function Get-NSXTForwardingTable { [string]$route_type hidden [string]$logical_router_port_id } - } - + } + Process { $NSXTForwardingTable = $NSXTForwardingTableService.list($Logical_router_id,$transport_node_id,$null,$null,$null,$null,$null,$null,'realtime') - + foreach ($NSXTForwarding in $NSXTForwardingTable.results) { - + $results = [NSXTForwardingTable]::new() $results.Logical_router_id = $Logical_router_id; $results.lr_component_type = $NSXTForwarding.lr_component_type; @@ -730,12 +734,12 @@ Function Get-NSXTNetworkRoutes { .Synopsis Retrieves the network routes information .DESCRIPTION - Retrieves the network routes information for a single or multiple routes. + Retrieves the network routes information for a single or multiple routes. .EXAMPLE Get-NSXTNetworkRoutes .EXAMPLE Get-NSXTNetworkRoutes -route_id "Route ID" -#> +#> Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] @@ -759,8 +763,8 @@ Function Get-NSXTNetworkRoutes { $scope $src } - } - + } + Process { if ($route_id) { @@ -769,9 +773,9 @@ Function Get-NSXTNetworkRoutes { else { $NSXTNetworkRoutes = $NSXTNetworkRoutesService.list().results } - + foreach ($NSXTRoute in $NSXTNetworkRoutes) { - + $results = [NSXTNetworkRoutes]::new() $results.route_id = $NSXTRoute.route_id; $results.route_type = $NSXTRoute.route_type; @@ -803,8 +807,8 @@ Function Get-NSXTLogicalRouterPorts { Get-NSXTLogicalRouterPorts -logical_router_id "LR Name" .EXAMPLE Get-NSXTLogicalRouterPorts -logical_router_id (Get-NSXTLogicalRouter | where name -eq "LR Name") -#> - +#> + Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] [Alias("Id")] @@ -831,7 +835,7 @@ Function Get-NSXTLogicalRouterPorts { $this.prefix_length = $prefix_length } } - + class NSXTLogicalRouterPorts { [string]$Name $Id @@ -859,7 +863,7 @@ Function Get-NSXTLogicalRouterPorts { } foreach ($NSXTLogicalRouterPort in $NSXTLogicalRouterPorts) { - + $results = [NSXTLogicalRouterPorts]::new() foreach ($subnet in $NSXTLogicalRouterPort.subnets) { @@ -875,7 +879,7 @@ Function Get-NSXTLogicalRouterPorts { $results.mac_address = $NSXTLogicalRouterPort.mac_address $results.linked_logical_switch_port_id = $NSXTLogicalRouterPort.linked_logical_switch_port_id $results - } + } } } @@ -891,7 +895,7 @@ Function Get-NSXTTransportZone { Get-NSXTTransportZone -zone_id "Zone ID" .EXAMPLE Get-NSXTTransportZone -name "Zone1" -#> +#> Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] @@ -934,7 +938,7 @@ Function Get-NSXTTransportZone { } foreach ($NSXTTransportZone in $NSXTTransportZones) { - + $results = [NSXTTransportZone]::new() $results.Name = $NSXTTransportZone.display_name; $results.ID = $NSXTTransportZone.Id; @@ -948,7 +952,7 @@ Function Get-NSXTTransportZone { $results.protection = $NSXTTransportZone.protection; $results.uplink_teaming_policy_names = $NSXTTransportZone.uplink_teaming_policy_names $results - } + } } } @@ -964,7 +968,7 @@ Function Get-NSXTLogicalSwitch { Get-NSXTLogicalSwitch -lswitch_id "switch id" .EXAMPLE Get-NSXTLogicalSwitch -name "switch name" -#> +#> Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] @@ -1013,7 +1017,7 @@ Function Get-NSXTLogicalSwitch { } foreach ($NSXTLogicalSwitch in $NSXTLogicalSwitches) { - + $results = [NSXTLogicalSwitch]::new() $results.Name = $NSXTLogicalSwitch.display_name; $results.Id = $NSXTLogicalSwitch.Id; @@ -1033,7 +1037,7 @@ Function Get-NSXTLogicalSwitch { $results.vlan = $NSXTLogicalSwitch.vlan; $results.vlan_trunk_spec = $NSXTLogicalSwitch.vlan_trunk_spec $results - } + } } } @@ -1047,7 +1051,7 @@ Function Get-NSXTIPPool { Get-NSXTIPPool .EXAMPLE Get-NSXTThingTemplate -pool_id "Pool ID" -#> +#> Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] @@ -1084,12 +1088,12 @@ Function Get-NSXTIPPool { $NSXTIPPools = $NSXTIPPoolService.list().results | where {$_.display_name -eq $name} } else { - $NSXTIPPools = $NSXTIPPoolService.list().results + $NSXTIPPools = $NSXTIPPoolService.list().results } } foreach ($NSXTIPPool in $NSXTIPPools) { - + $results = [NSXTIPPool]::new() $results.Name = $NSXTIPPool.display_name; $results.ID = $NSXTIPPool.id; @@ -1102,7 +1106,7 @@ Function Get-NSXTIPPool { $results.RangeStart = $NSXTIPPool.subnets.allocation_ranges.start; $results.RangeEnd = $NSXTIPPool.subnets.allocation_ranges.end $results - } + } } } @@ -1119,7 +1123,7 @@ Function Get-NSXTIPAMIPBlock { .EXAMPLE Get-NSXTIPAMIPBlock -name "Block Name" -#> +#> Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] @@ -1158,7 +1162,7 @@ Function Get-NSXTIPAMIPBlock { } foreach ($NSXTIPAMIPBlock in $NSXTIPAMIPBlocks) { - + $results = [ip_block]::new() $results.Name = $NSXTIPAMIPBlock.display_name; $results.block_id = $NSXTIPAMIPBlock.id; @@ -1168,7 +1172,7 @@ Function Get-NSXTIPAMIPBlock { $results.resource_type = $NSXTIPAMIPBlock.resource_type $results - } + } } } @@ -1184,7 +1188,7 @@ Function Get-NSXTClusterNode { Get-NSXTClusterNode -node_id "Node Id" .EXAMPLE Get-NSXTClusterNode -name "Name" -#> +#> Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] @@ -1226,7 +1230,7 @@ Function Get-NSXTClusterNode { } foreach ($NSXTClusterNode in $NSXTClusterNodes) { - + $results = [NSXTClusterNode]::new() $results.Name = $NSXTClusterNode.display_name; $results.node_id = $NSXTClusterNode.Id; @@ -1246,7 +1250,7 @@ Function Get-NSXTClusterNode { } $results - } + } } } @@ -1263,9 +1267,9 @@ Function Set-NSXTLogicalRouter { Set-NSXTLogicalRouter -display_name "Name" -high_availability_mode "ACTIVE_ACTIVE" -router_type "TIER0" -edge_cluster_id "Edge Cluster ID" .EXAMPLE Set-NSXTLogicalRouter -display_name "Name" -high_availability_mode "ACTIVE_STANDBY" -router_type "TIER1" -description "this is my new tier1 lr" -#> +#> - [CmdletBinding(SupportsShouldProcess=$true, + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] # Paramameter Set variants will be needed Multicast & Broadcast Traffic Types as well as VM & Logical Port Types @@ -1275,20 +1279,20 @@ Function Set-NSXTLogicalRouter { [parameter(Mandatory=$false, ParameterSetName='TIER1')] [string]$description, - + [parameter(Mandatory=$true, ParameterSetName='TIER0')] [parameter(Mandatory=$true, ParameterSetName='TIER1')] [string]$display_name, - + [parameter(Mandatory=$true, ParameterSetName='TIER0')] [parameter(Mandatory=$true, ParameterSetName='TIER1')] - [ValidateSet("ACTIVE_ACTIVE","ACTIVE_STANDBY")] + [ValidateSet("ACTIVE_ACTIVE","ACTIVE_STANDBY")] [string]$high_availability_mode, - + [parameter(Mandatory=$true, ParameterSetName='TIER0')] [parameter(Mandatory=$true, @@ -1315,7 +1319,7 @@ Function Set-NSXTLogicalRouter { throw "Could not connect to an NSX-T Manager, please try again" } } - + $NSXTLogicalRouterService = Get-NsxtService -Name "com.vmware.nsx.logical_routers" } @@ -1340,13 +1344,13 @@ Function Set-NSXTLogicalRouter { if ($pscmdlet.ShouldProcess($logical_router_request.display_name, "Create logical router")) { $NSXTLogicalRouter = $NSXTLogicalRouterService.create($logical_router_request) - } + } } catch { throw $Error[0].Exception.ServerError.data - # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. + # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. } $NSXTLogicalRouter @@ -1363,22 +1367,22 @@ Function Set-NSXTLogicalSwitch { Set-NSXTLogicalSwitch -display_name "Name" -transport_zone_id "TP Zone ID" .EXAMPLE Set-NSXTLogicalSwitch -display_name "Name" -transport_zone_id "TP Zone ID" -admin_state "UP" -replication_mode "MTEP" -ip_pool_id "IP Pool Name" -#> +#> - [CmdletBinding(SupportsShouldProcess=$true, + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] # Paramameter Set variants will be needed Multicast & Broadcast Traffic Types as well as VM & Logical Port Types Param ( [parameter(Mandatory=$false)] [string]$description, - + [parameter(Mandatory=$true)] [string]$display_name, - + [parameter(Mandatory=$true)] [string]$transport_zone_id, - + [parameter(Mandatory=$true)] [ValidateSet("UP","DOWN")] [string]$admin_state, @@ -1405,7 +1409,7 @@ Function Set-NSXTLogicalSwitch { throw "Could not connect to an NSX-T Manager, please try again" } } - + $NSXTLogicalSwitchService = Get-NsxtService -Name "com.vmware.nsx.logical_switches" } @@ -1428,13 +1432,13 @@ Function Set-NSXTLogicalSwitch { { $NSXTLogicalSwitch = $NSXTLogicalSwitchService.create($logical_switch_request) } - + } catch { throw $Error[0].Exception.ServerError.data - # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. + # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. } $NSXTLogicalSwitch @@ -1446,23 +1450,23 @@ Function Set-NSXTIPAMIPBlock { .Synopsis Creates an IPAM IP Block .DESCRIPTION - Creates a IPAM IP Block with a cidr parameter. + Creates a IPAM IP Block with a cidr parameter. .EXAMPLE Set-NSXTIPAMIPBlock -name "IPAM Block Name" -cidr "192.168.0.0/24" -#> +#> - [CmdletBinding(SupportsShouldProcess=$true, + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] # Paramameter Set variants will be needed Multicast & Broadcast Traffic Types as well as VM & Logical Port Types Param ( [parameter(Mandatory=$false)] [string]$description, - + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$display_name, - + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$cidr @@ -1482,7 +1486,7 @@ Function Set-NSXTIPAMIPBlock { throw "Could not connect to an NSX-T Manager, please try again" } } - + $NSXTIPAMIPBlockService = Get-NsxtService -Name "com.vmware.nsx.pools.ip_blocks" } @@ -1500,7 +1504,7 @@ Function Set-NSXTIPAMIPBlock { { # Should process if ($pscmdlet.ShouldProcess($ip_pool.display_name, "Create IP Pool")) - { + { $NSXTIPAMIPBlock = $NSXTIPAMIPBlockService.create($IPAMIPBlock_request) } } @@ -1508,7 +1512,7 @@ Function Set-NSXTIPAMIPBlock { catch { throw $Error[0].Exception.ServerError.data - # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. + # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. } $NSXTIPAMIPBlock @@ -1525,9 +1529,9 @@ Function Set-NSXTIPPool { Set-NSXTIPPool -display_name "Pool Name" -allocation_start "192.168.1.2" -allocation_end "192.168.1.100" -cidr "192.168.1.0/24" .EXAMPLE Set-NSXTIPPool -display_name "Test Pool Name" -allocation_start "192.168.1.2" -allocation_end "192.168.1.100" -cidr "192.168.1.0/24" -dns_nameservers "192.168.1.1" -gateway_ip "192.168.1.1" -dns_suffix "evil corp" -#> +#> - [CmdletBinding(SupportsShouldProcess=$true, + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] # Paramameter Set variants will be needed Multicast & Broadcast Traffic Types as well as VM & Logical Port Types @@ -1535,13 +1539,13 @@ Function Set-NSXTIPPool { [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$display_name, - + [parameter(Mandatory=$false)] [string]$description, - + [parameter(Mandatory=$false)] [string]$dns_nameservers, - + [parameter(Mandatory=$false)] [string]$dns_suffix, @@ -1575,9 +1579,9 @@ Function Set-NSXTIPPool { throw "Could not connect to an NSX-T Manager, please try again" } } - + $NSXTIPPoolService = Get-NsxtService -Name "com.vmware.nsx.pools.ip_pools" - + # Classes unused - part of early testing class allocation_ranges { [string]$start @@ -1591,7 +1595,7 @@ Function Set-NSXTIPPool { [string]$dns_suffix [string]$cidr [string]$gateway_ip - #hidden $self + #hidden $self } class ip_pool { @@ -1632,12 +1636,12 @@ Function Set-NSXTIPPool { $ip_pool.subnets[0].gateway_ip = $gateway_ip $ip_pool.revision = 0 $ip_pool.tags = @() - + try { # Should process if ($pscmdlet.ShouldProcess($ip_pool.display_name, "Create IP Pool")) - { + { $NSXTIPPoolService.create($ip_pool) } } @@ -1657,14 +1661,14 @@ Function Remove-NSXTIPAMIPBlock { .Synopsis Removes an IPAM IP Block .DESCRIPTION - Removes a IPAM IP Block with a block_id parameter. + Removes a IPAM IP Block with a block_id parameter. .EXAMPLE Remove-NSXTIPAMIPBlock -block_id "id" .EXAMPLE Get-NSXTIPAMIPBlock | where name -eq "IPAM Test2" | Remove-NSXTIPAMIPBlock -#> +#> - [CmdletBinding(SupportsShouldProcess=$true, + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] Param ( @@ -1688,7 +1692,7 @@ Function Remove-NSXTIPAMIPBlock { throw "Could not connect to an NSX-T Manager, please try again" } } - + $NSXTIPAMIPBlockService = Get-NsxtService -Name "com.vmware.nsx.pools.ip_blocks" } @@ -1698,7 +1702,7 @@ Function Remove-NSXTIPAMIPBlock { { # Should process if ($pscmdlet.ShouldProcess($block_id, "Delete IP Pool")) - { + { $NSXTIPAMIPBlockService.delete($block_id) } } @@ -1706,7 +1710,7 @@ Function Remove-NSXTIPAMIPBlock { catch { throw $Error[0].Exception.ServerError.data - # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. + # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. } } } @@ -1719,14 +1723,14 @@ Function Set-NSXTTraceFlow { .DESCRIPTION Create a TraceFlow for later observation. .EXAMPLE - Set-NSXTTraceFlow -transport_type "UNICAST" -lport_id "LP ID" -src_ip "IP Address" -src_mac "MAC" -dst_ip "IP Address" -dst_mac "MAC" + Set-NSXTTraceFlow -transport_type "UNICAST" -lport_id "LP ID" -src_ip "IP Address" -src_mac "MAC" -dst_ip "IP Address" -dst_mac "MAC" .EXAMPLE Set-NSXTTraceFlow -transport_type "UNICAST" -lport_id "LP ID" -src_ip "IP Address" -src_mac "MAC" -dst_ip "IP Address" -dst_mac "MAC" | Get-NSXTTraceFlow .EXAMPLE Set-NSXTTraceFlow -transport_type "UNICAST" -lport_id "LP ID" -src_ip "IP Address" -src_mac "MAC" -dst_ip "IP Address" -dst_mac "MAC" | Get-NSXTTraceFlow | Get-NSXTTraceFlowObservations -#> +#> - [CmdletBinding(SupportsShouldProcess=$true, + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] # Paramameter Set variants will be needed Multicast & Broadcast Traffic Types as well as VM & Logical Port Types @@ -1747,7 +1751,7 @@ Function Set-NSXTTraceFlow { ValueFromPipeline=$true, ParameterSetName='Parameter Set VM Type')] [ValidateNotNullOrEmpty()] - [ValidateScript({$_ -match [IPAddress]$_})] + [ValidateScript({$_ -match [IPAddress]$_})] [string] $src_ip, [parameter(Mandatory=$true, @@ -1765,7 +1769,7 @@ Function Set-NSXTTraceFlow { ValueFromPipeline=$true, ParameterSetName='Parameter Set VM Type')] [ValidateNotNullOrEmpty()] - [ValidateScript({$_ -match [IPAddress]$_ })] + [ValidateScript({$_ -match [IPAddress]$_ })] [string] $dst_ip, [parameter(Mandatory=$true, @@ -1784,7 +1788,7 @@ Function Set-NSXTTraceFlow { { if (-not $global:DefaultNsxtServers.isconnected) { - + try { Connect-NsxtServer -Menu -ErrorAction Stop @@ -1795,11 +1799,11 @@ Function Set-NSXTTraceFlow { throw "Could not connect to an NSX-T Manager, please try again" } } - + $NSXTraceFlowsService = Get-NsxtService -Name "com.vmware.nsx.traceflows" - + # Comment out custom classes - <# + <# class ip_header { [string]$src_ip [string]$dst_ip @@ -1819,7 +1823,7 @@ Function Set-NSXTTraceFlow { [long]$frame_size [eth_header]$eth_header = [eth_header]::new() [ip_header]$ip_header = [ip_header]::new() - + packet_data(){ $this.routed = 'true' $this.transport_type = 'UNICAST' @@ -1845,7 +1849,7 @@ Function Set-NSXTTraceFlow { $traceflow_request.lport_id = $lport_id $traceflow_request.packet.transport_type = $transport_type - + $eth_header = [ordered]@{'src_mac' = $src_mac;'eth_type' = '2048';'dst_mac' = $dst_mac} $ip_header = [ordered]@{src_ip = $src_ip;protocol = '1';ttl = '64';dst_ip = $dst_ip} $traceflow_request.packet | Add-Member -NotePropertyMembers $eth_header -TypeName eth_header @@ -1894,7 +1898,7 @@ Function Get-NSXTThingTemplate { Get-NSXTThingTemplate -param2 "LR Name" .EXAMPLE Get-NSXTThingTemplate -param2 (Get-NSXTLogicalRouter | where name -eq "LR Name") -#> +#> Param ( [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] @@ -1938,7 +1942,7 @@ Function Get-NSXTThingTemplate { } foreach ($NSXTThing in $NSXTThings) { - + $results = [NSXTThing]::new() $results.Name = $NSXTThing.display_name; $results.Logical_router_id = $NSXTThing.Id; @@ -1947,7 +1951,7 @@ Function Get-NSXTThingTemplate { $results.thing2 = $NSXTThing.thing2 $results - } + } } } @@ -1957,29 +1961,29 @@ Function Set-NSXTThingTemplate { .Synopsis Creates a THING .DESCRIPTION - Creates a THING with a number of required parameters. + Creates a THING with a number of required parameters. .EXAMPLE Set-NSXTThingTemplateh -param1 "Name" -param2 "TP Zone ID" .EXAMPLE - Set-NSXTThingTemplateh -param1 "Name" -param2 "TP Zone ID" -#> + Set-NSXTThingTemplateh -param1 "Name" -param2 "TP Zone ID" +#> - [CmdletBinding(SupportsShouldProcess=$true, + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] # Paramameter Set variants will be needed Multicast & Broadcast Traffic Types as well as VM & Logical Port Types Param ( [parameter(Mandatory=$false)] [string]$description, - + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$display_name, - + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$transport_zone_id, - + [parameter(Mandatory=$true)] [ValidateSet("UP","DOWN")] [string]$admin_state, @@ -2007,7 +2011,7 @@ Function Set-NSXTThingTemplate { throw "Could not connect to an NSX-T Manager, please try again" } } - + $NSXTTHINGService = Get-NsxtService -Name "com.vmware.nsx.THING" } @@ -2027,7 +2031,7 @@ Function Set-NSXTThingTemplate { { # Should process if ($pscmdlet.ShouldProcess($ip_pool.display_name, "Create IP Pool")) - { + { $NSXTTHING = $NSXTTHINGService.create($logical_THING_request) } } @@ -2035,7 +2039,7 @@ Function Set-NSXTThingTemplate { catch { throw $Error[0].Exception.ServerError.data - # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. + # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. } $NSXTTHING @@ -2048,12 +2052,12 @@ Function Remove-NSXTThingTemplate { .Synopsis Removes an IPAM IP Block .DESCRIPTION - Removes a IPAM IP Block with a block_id parameter. + Removes a IPAM IP Block with a block_id parameter. .EXAMPLE Remove-NSXTIPAMIPBlock -block_id "id" -#> +#> - [CmdletBinding(SupportsShouldProcess=$true, + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] Param ( @@ -2077,7 +2081,7 @@ Function Remove-NSXTThingTemplate { throw "Could not connect to an NSX-T Manager, please try again" } } - + $NSXTTHINGkService = Get-NsxtService -Name "com.vmware.nsx.THING" } @@ -2087,7 +2091,7 @@ Function Remove-NSXTThingTemplate { { # Should process if ($pscmdlet.ShouldProcess($thing_id, "Delete IP Pool")) - { + { $NSXTTHINGkService.delete($thing_id) } } @@ -2095,7 +2099,7 @@ Function Remove-NSXTThingTemplate { catch { throw $Error[0].Exception.ServerError.data - # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. + # more error data found in the NSX-T Manager /var/log/vmware/nsx-manager.log file. } } } diff --git a/Modules/PSvLIMessage/PSvLIMessage.psm1 b/Modules/PSvLIMessage/PSvLIMessage.psm1 index 9cab209..928d1ee 100644 --- a/Modules/PSvLIMessage/PSvLIMessage.psm1 +++ b/Modules/PSvLIMessage/PSvLIMessage.psm1 @@ -30,18 +30,18 @@ add-type @" .SYNOPSIS Push Messages to VMware vRealize Log Insight. - + .DESCRIPTION Creates a Messages in VMware vRealize Log Insight via the Ingestion API .EXAMPLE Push-vLIMessage -vLIServer "loginsight.lan.local" -vLIAgentID "12862842-5A6D-679C-0E38-0E2BE888BB28" -Text "My Test" - + .EXAMPLE Push-vLIMessage -vLIServer "loginsight.lan.local" -vLIAgentID "12862842-5A6D-679C-0E38-0E2BE888BB28" -Text "My Test" -Hostname MyTEST -FieldName myTest -FieldContent myTest - + .PARAMETER vLIServer - Specify the FQDN of your vRealize Log Insight Appliance + Specify the FQDN of your vRealize Log Insight Appliance .PARAMETER vLIAgentID Specify the vRealize Log Insight Agent ID, e.g. "12862842-5A6D-679C-0E38-0E2BE888BB28" @@ -54,13 +54,13 @@ add-type @" .PARAMETER FieldName Specify the a Optional Field Name for vRealize Log Insight - + .PARAMETER FieldContent Specify the a Optional FieldContent for the Field in -FieldName for vRealize Log Insight If FielName is missing and FieldContent is given, it will be ignored - + #Requires PS -Version 3.0 - + #> function Push-vLIMessage { @@ -88,9 +88,9 @@ function Push-vLIMessage { name = "hostname" content = $Hostname } - + $Fields = @($Field_vLI, $Field_HostName) - + if ($FieldName) { $Field_Custom = [ordered]@{ name = $FieldName @@ -98,14 +98,14 @@ function Push-vLIMessage { } $Fields += @($Field_Custom) } - + $Restcall = @{ messages = ([Object[]]([ordered]@{ text = ($Text) fields = ([Object[]]$Fields) })) } | convertto-json -Depth 4 - + $Resturl = ("http://" + $vLIServer + ":9000/api/v1/messages/ingest/" + $vLIAgentID) try { diff --git a/Modules/PerVMEVC/PerVMEVC.psm1 b/Modules/PerVMEVC/PerVMEVC.psm1 index 05f8390..ad54d40 100644 --- a/Modules/PerVMEVC/PerVMEVC.psm1 +++ b/Modules/PerVMEVC/PerVMEVC.psm1 @@ -1,18 +1,22 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> function Get-VMEvcMode { -<# -.SYNOPSIS +<# +.SYNOPSIS Gathers information on the EVC status of a VM -.DESCRIPTION +.DESCRIPTION Will provide the EVC status for the specified VM -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com .PARAMETER Name VM name which the function should be ran against .EXAMPLE Get-VMEvcMode -Name vmName - Retreives the EVC status of the provided VM + Retreives the EVC status of the provided VM #> -[CmdletBinding()] +[CmdletBinding()] param( [Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)] $Name @@ -33,7 +37,7 @@ function Get-VMEvcMode { } elseif ($name -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]) {$evVM += $name} - + if ($evVM -eq $null) {Write-Warning "No VMs found."} else { $output = @() @@ -55,20 +59,20 @@ function Get-VMEvcMode { } function Remove-VMEvcMode { -<# -.SYNOPSIS +<# +.SYNOPSIS Removes the EVC status of a VM -.DESCRIPTION +.DESCRIPTION Will remove the EVC status for the specified VM -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com .PARAMETER Name VM name which the function should be ran against .EXAMPLE Remove-VMEvcMode -Name vmName - Removes the EVC status of the provided VM + Removes the EVC status of the provided VM #> -[CmdletBinding()] +[CmdletBinding()] param( [Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)] $Name @@ -90,7 +94,7 @@ function Remove-VMEvcMode { } elseif ($name -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]) {$evVM += $name} - + if ($evVM -eq $null) {Write-Warning "No VMs found."} else { foreach ($v in $evVM) { @@ -99,17 +103,17 @@ function Remove-VMEvcMode { $v.ExtensionData.ApplyEvcModeVM_Task($null, $true) | Out-Null $updateVM += $v.Name - + } else {Write-Warning $v.Name + " does not have the minimum requirements of being Hardware Version 14 and powered off."} } if ($updateVM) { - + Start-Sleep -Seconds 2 Get-VMEvcMode -Name $updateVM - + } } @@ -119,12 +123,12 @@ function Remove-VMEvcMode { } function Set-VMEvcMode { -<# -.SYNOPSIS +<# +.SYNOPSIS Configures the EVC status of a VM -.DESCRIPTION +.DESCRIPTION Will configure the EVC status for the specified VM -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com .PARAMETER Name VM name which the function should be ran against @@ -134,7 +138,7 @@ function Set-VMEvcMode { Set-VMEvcMode -Name vmName -EvcMode intel-sandybridge Configures the EVC status of the provided VM to be 'intel-sandybridge' #> -[CmdletBinding()] +[CmdletBinding()] param( [Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)] $Name, @@ -159,7 +163,7 @@ function Set-VMEvcMode { } elseif ($name -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]) {$evVM += $name} - + if ($evVM -eq $null) {Write-Warning "No VMs found."} else { @@ -172,17 +176,17 @@ function Set-VMEvcMode { $v.ExtensionData.ApplyEvcModeVM_Task($evcMask, $true) | Out-Null $updateVM += $v.Name - + } else {Write-Warning $v.Name + " does not have the minimum requirements of being Hardware Version 14 and powered off."} } if ($updateVM) { - + Start-Sleep -Seconds 2 Get-VMEvcMode -Name $updateVM - + } } diff --git a/Modules/ProactiveHA/ProactiveHA.psm1 b/Modules/ProactiveHA/ProactiveHA.psm1 index ea4e92f..8079f23 100644 --- a/Modules/ProactiveHA/ProactiveHA.psm1 +++ b/Modules/ProactiveHA/ProactiveHA.psm1 @@ -1,4 +1,8 @@ -Function New-PHAProvider { +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> +Function New-PHAProvider { <# .NOTES =========================================================================== diff --git a/Modules/Recommend-Sizing/Recommend-Sizing.psm1 b/Modules/Recommend-Sizing/Recommend-Sizing.psm1 index 0075e43..56068dd 100644 --- a/Modules/Recommend-Sizing/Recommend-Sizing.psm1 +++ b/Modules/Recommend-Sizing/Recommend-Sizing.psm1 @@ -1,17 +1,21 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> function Recommend-Sizing { -<# +<# .NOTES =========================================================================== Created by: Markus Kraus Twitter: @VMarkus_K Private Blog: mycloudrevolution.com =========================================================================== - Changelog: - 2016.11 ver 1.0 Base Release + Changelog: + 2016.11 ver 1.0 Base Release 2016.11 ver 1.1 Optional Stats Collection 2016.11 ver 1.2 VM Stats from Realtime Data and new Counters =========================================================================== - External Code Sources: + External Code Sources: http://www.lucd.info/2011/04/22/get-the-maximum-iops/ https://communities.vmware.com/thread/485386 =========================================================================== @@ -25,16 +29,16 @@ function Recommend-Sizing { =========================================================================== .DESCRIPTION - This Function collects Basic vSphere Informations for a Hardware Sizing Recommandation. Focus is in Compute Ressources. + This Function collects Basic vSphere Informations for a Hardware Sizing Recommandation. Focus is in Compute Ressources. .Example - Recommend-Sizing -ClusterNames Cluster01, Cluster02 -Stats -StatsRange 60 -Verbose + Recommend-Sizing -ClusterNames Cluster01, Cluster02 -Stats -StatsRange 60 -Verbose .Example - Recommend-Sizing -ClusterNames Cluster01, Cluster02 + Recommend-Sizing -ClusterNames Cluster01, Cluster02 .Example - Recommend-Sizing -ClusterNames Cluster01 + Recommend-Sizing -ClusterNames Cluster01 .PARAMETER ClusterNames List of your vSphere Cluser Names to process. @@ -53,14 +57,14 @@ function Recommend-Sizing { #> [CmdletBinding()] -param( +param( [Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)] [Array] $ClusterNames, [Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=1, ParameterSetName = "Stats")] [switch] $Stats, [Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=2, ParameterSetName = "Stats")] - [int] $StatsRange = 1440 - + [int] $StatsRange = 1440 + ) Begin { if ($Stats) { @@ -70,7 +74,7 @@ Begin { $Validate = $True #region: Check Clusters - Write-Verbose "$(Get-Date -Format G) Starting Cluster Validation..." + Write-Verbose "$(Get-Date -Format G) Starting Cluster Validation..." foreach ($ClusterName in $ClusterNames) { $TestCluster = Get-Cluster -Name $ClusterName -ErrorAction SilentlyContinue -Verbose:$False if(!($TestCluster)){ @@ -82,7 +86,7 @@ Begin { $Validate = $False } } - Write-Verbose "$(Get-Date -Format G) Cluster Validation completed" + Write-Verbose "$(Get-Date -Format G) Cluster Validation completed" #endregion } @@ -91,7 +95,7 @@ Process { if ($Validate -eq $True) { foreach ($ClusterName in $ClusterNames) { #region: Get Cluster Objects - Write-Verbose "$(Get-Date -Format G) Collect $ClusterName Cluster Objects..." + Write-Verbose "$(Get-Date -Format G) Collect $ClusterName Cluster Objects..." $Cluster = Get-Cluster -Name $ClusterName -Verbose:$False $ClusterVMs = $Cluster | Get-VM -Verbose:$False $ClusterVMsPoweredOn = $ClusterVMs | where {$_.PowerState -eq "PoweredOn"} @@ -101,24 +105,24 @@ Process { $HostsAverageMemoryUsage = $([math]::round( (($ClusterHosts | Measure-Object -Average -Property MemoryUsageGB).Average / ($ClusterHosts | Measure-Object -Average -Property MemoryTotalGB).Average) * 100,1 )) $HostsAverageCpuUsageMhz = [math]::round( ($ClusterHosts | Measure-Object -Average -Property CpuUsageMhz).Average,1 ) $HostsAverageCpuUsage = $([math]::round( (($ClusterHosts | Measure-Object -Average -Property CpuUsageMhz).Average / ($ClusterHosts | Measure-Object -Average -Property CpuTotalMhz).Average) * 100,1 )) - Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) Cluster Objects completed" + Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) Cluster Objects completed" #endregion #region: CPU Calculation - Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) CPU Details..." + Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) CPU Details..." $VMvCPUs = ($ClusterVMs | Measure-Object -Sum -Property NumCpu).sum $LogicalThreads = $Cluster.ExtensionData.Summary.NumCpuThreads $CpuCores = $Cluster.ExtensionData.Summary.NumCpuCores $vCPUpCPUratio = [math]::round( $VMvCPUs / $LogicalThreads,1 ) - Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) CPU Details completed." + Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) CPU Details completed." #endregion #region: Memory Calculation - Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) Memory Details..." + Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) Memory Details..." $AllocatedVMMemoryGB = [math]::round( ($ClusterVMs | Measure-Object -Sum -Property MemoryGB).sum ) $PhysicalMemory = [math]::round( $Cluster.ExtensionData.Summary.TotalMemory / 1073741824,1 ) $MemoryUsage = [math]::round( ($AllocatedVMMemoryGB / $PhysicalMemory) * 100 ,1 ) - Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) Memory Details completed" + Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) Memory Details completed" #endregion if ($Stats) { @@ -129,10 +133,10 @@ Process { $VMStats = Get-Stat -Realtime -Stat $VMMetrics -Entity $ClusterVMsPoweredOn -Start $Start -Verbose:$False Write-Verbose "$(Get-Date -Format G) Create $($Cluster.name) VM Stats completed" #endregion - + #region: Creating VM Stats Report Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) VM Stats Report..." - $ReportVMPerf = @() + $ReportVMPerf = @() $ReportVMPerf = $VMStats | Group-Object -Property {$_.Entity.Name},Instance | %{ New-Object PSObject -Property @{ IOPSWriteAvg = ($_.Group | ` @@ -168,7 +172,7 @@ Process { CapacityGB = $CapacityGB } $reportDiskSpace += $Report - } + } } } Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) VM Disk Space Report completed" @@ -188,9 +192,9 @@ Process { DrsEnabled = $Cluster.DrsEnabled Hosts = $Cluster.ExtensionData.Summary.NumHosts HostsAverageMemoryUsageGB = $HostsAverageMemoryUsageGB - HostsAverageMemoryUsage = "$HostsAverageMemoryUsage %" + HostsAverageMemoryUsage = "$HostsAverageMemoryUsage %" HostsAverageCpuUsageMhz = $HostsAverageCpuUsageMhz - HostsAverageCpuUsage = "$HostsAverageCpuUsage %" + HostsAverageCpuUsage = "$HostsAverageCpuUsage %" PhysicalCPUCores = $CpuCores LogicalCPUThreads = $LogicalThreads VMs = $ClusterVMs.count @@ -198,7 +202,7 @@ Process { VMvCPUs = $VMvCPUs vCPUpCPUratio = "$vCPUpCPUratio : 1" PhysicalMemoryGB = $PhysicalMemory - AllocatedVMMemoryGB = $AllocatedVMMemoryGB + AllocatedVMMemoryGB = $AllocatedVMMemoryGB ClusterMemoryUsage = "$MemoryUsage %" SumVMDiskSpaceGB = [math]::round( ($reportDiskSpace | Measure-Object -Sum -Property CapacityGB).sum, 1 ) SumDatastoreSpaceGB = [math]::round( ($DatastoreReport | Measure-Object -Sum -Property CapacityGB).sum, 1 ) @@ -217,7 +221,7 @@ Process { Else { Write-Error "Validation Failed! Processing Skipped" } - + } End { diff --git a/Modules/SRM/Examples/ReportConfiguration.ps1 b/Modules/SRM/Examples/ReportConfiguration.ps1 index f7a8036..eff303f 100644 --- a/Modules/SRM/Examples/ReportConfiguration.ps1 +++ b/Modules/SRM/Examples/ReportConfiguration.ps1 @@ -1,4 +1,13 @@ -# Depends on SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets +<# +Copyright 2017-2021 VMware, Inc. +SPDX-License-Identifier: Apache-2.0 +#> +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# Depends on SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets # It is assumed that the connection to VC and SRM Server have already been made Function Get-SrmConfigReportSite { @@ -151,7 +160,7 @@ Function Get-SrmConfigReportProtectedVm { @{Label="Final Power State"; Expression={$_.finalPowerState} }, @{Label="Pre-PowerOn Callouts"; Expression={$_.preCallouts} }, @{Label="Post-PowerOn Callouts"; Expression={$_.postCallouts} } - + } Function Get-SrmConfigReport { diff --git a/Modules/SRM/Examples/SrmTagging.ps1 b/Modules/SRM/Examples/SrmTagging.ps1 index 1e33659..4136a72 100644 --- a/Modules/SRM/Examples/SrmTagging.ps1 +++ b/Modules/SRM/Examples/SrmTagging.ps1 @@ -1,4 +1,13 @@ -# Depends on SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets +<# +Copyright 2017-2021 VMware, Inc. +SPDX-License-Identifier: Apache-2.0 +#> +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# Depends on SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets # It is assumed that the connections to active VC and SRM Server have already been made Import-Module Meadowcroft.SRM -Prefix Srm diff --git a/Modules/SRM/LICENSE.txt b/Modules/SRM/LICENSE.txt index 22896f0..a679316 100644 --- a/Modules/SRM/LICENSE.txt +++ b/Modules/SRM/LICENSE.txt @@ -2,7 +2,7 @@ Version 2.0, January 2004 http://www.apache.org/licenses/ - + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. @@ -55,7 +55,7 @@ APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2017-2021 VMware, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -65,9 +65,9 @@ To apply the Apache License to your work, attach the following boilerplate notic 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 + 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. diff --git a/Modules/SRM/Meadowcroft.Srm.Protection.ps1 b/Modules/SRM/Meadowcroft.Srm.Protection.ps1 index d522cb6..8860621 100644 --- a/Modules/SRM/Meadowcroft.Srm.Protection.ps1 +++ b/Modules/SRM/Meadowcroft.Srm.Protection.ps1 @@ -1,4 +1,13 @@ -# SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets +<# +Copyright 2017-2021 VMware, Inc. +SPDX-License-Identifier: Apache-2.0 +#> +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets <# .SYNOPSIS @@ -48,7 +57,7 @@ Function Get-ProtectionGroup { $pgi = $pg.GetInfo() $selected = (-not $Name -or ($Name -eq $pgi.Name)) -and (-not $Type -or ($Type -eq $pgi.Type)) if ($selected) { - Add-Member -InputObject $pg -MemberType NoteProperty -Name "Name" -Value $pgi.Name + Add-Member -InputObject $pg -MemberType NoteProperty -Name "Name" -Value $pgi.Name $pg } } @@ -95,7 +104,7 @@ Function Get-ProtectedVM { try { $_.Vm.UpdateViewData() } catch { - Write-Error $_ + Write-Error $_ } finally { $_ } @@ -359,7 +368,7 @@ Function New-ProtectionGroup { if ($pscmdlet.ShouldProcess($Name, "New")) { $task = $api.Protection.CreateHbrProtectionGroup($Folder.MoRef, $Name, $Description, $moRefs) } - + } elseif ($ArrayReplication) { #create list of managed object references from VM and/or VM view arrays $moRefs = @() @@ -373,7 +382,7 @@ Function New-ProtectionGroup { if ($pscmdlet.ShouldProcess($Name, "New")) { $task = $api.Protection.CreateAbrProtectionGroup($Folder.MoRef, $Name, $Description, $moRefs) } - + } else { throw "Undetermined protection group type" } @@ -386,7 +395,7 @@ Function New-ProtectionGroup { if ($pg) { $unProtectedVMs = Get-UnProtectedVM -ProtectionGroup $pg $unProtectedVMs | Protect-VM -ProtectionGroup $pg - } + } return $pg } diff --git a/Modules/SRM/Meadowcroft.Srm.Recovery.ps1 b/Modules/SRM/Meadowcroft.Srm.Recovery.ps1 index 1b2eaca..ba22b23 100644 --- a/Modules/SRM/Meadowcroft.Srm.Recovery.ps1 +++ b/Modules/SRM/Meadowcroft.Srm.Recovery.ps1 @@ -1,4 +1,13 @@ -# SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets +<# +Copyright 2017-2021 VMware, Inc. +SPDX-License-Identifier: Apache-2.0 +#> +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets <# .SYNOPSIS @@ -121,13 +130,13 @@ Function Get-RecoveryPlanResult { [DateTime] $startedBefore, [VMware.VimAutomation.Srm.Types.V1.SrmServer] $SrmServer ) - + $api = Get-ServerApiEndpoint -SrmServer $SrmServer # Get the history objects $history = $api.Recovery.GetHistory($RecoveryPlan.MoRef) $resultCount = $history.GetResultCount() - + if ($resultCount -gt 0) { $results = $history.GetRecoveryResult($resultCount) @@ -270,7 +279,7 @@ Function Set-RecoverySetting { [Parameter (Mandatory=$true, ValueFromPipeline=$true)][VMware.VimAutomation.Srm.Views.SrmRecoverySettings] $RecoverySettings ) - + $moRef = Get_MoRefFromVmObj -Vm $Vm -VmView $VmView -ProtectedVm $ProtectedVm if ($RecoveryPlan -and $moRef -and $RecoverySettings) { @@ -416,9 +425,9 @@ Function Add-PostRecoveryCommand { [Parameter (Mandatory=$true, ValueFromPipeline=$true)][VMware.VimAutomation.Srm.Views.SrmRecoverySettings] $RecoverySettings, [Parameter (Mandatory=$true)][VMware.VimAutomation.Srm.Views.SrmCommand] $SrmCommand ) - + Add_Command -RecoverySettings $RecoverySettings -SrmCommand $SrmCommand -PostRecovery $true - + return $RecoverySettings } @@ -446,7 +455,7 @@ Function Remove-PostRecoveryCommand { if ($pscmdlet.ShouldProcess($SrmCommand.Description, "Remove")) { $RecoverySettings.PostPowerOnCallouts.Remove($SrmCommand) } - + return $RecoverySettings } @@ -494,7 +503,7 @@ Function New-RecoveryPlan { $protectionGroupmRefs += @( $ProtectionGroups | ForEach-Object { $_.MoRef } | Select-Object -Unique) [VMware.VimAutomation.Srm.Views.CreateRecoveryPlanTask] $task = $null - + if ($PSCmdlet.ShouldProcess($Name, "New")) { $task = $api.Recovery.CreateRecoveryPlan( $Name, diff --git a/Modules/SRM/Meadowcroft.Srm.Storage.ps1 b/Modules/SRM/Meadowcroft.Srm.Storage.ps1 index 8880f36..b2c6192 100644 --- a/Modules/SRM/Meadowcroft.Srm.Storage.ps1 +++ b/Modules/SRM/Meadowcroft.Srm.Storage.ps1 @@ -1,4 +1,13 @@ -# SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets +<# +Copyright 2017-2021 VMware, Inc. +SPDX-License-Identifier: Apache-2.0 +#> +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets <# .SYNOPSIS diff --git a/Modules/SRM/Meadowcroft.Srm.psd1 b/Modules/SRM/Meadowcroft.Srm.psd1 index 996a493..b430309 100644 --- a/Modules/SRM/Meadowcroft.Srm.psd1 +++ b/Modules/SRM/Meadowcroft.Srm.psd1 @@ -1,4 +1,13 @@ -# +<# +Copyright 2017-2021 VMware, Inc. +SPDX-License-Identifier: Apache-2.0 +#> +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# # Module manifest for module 'Meadowcroft.Srm' # diff --git a/Modules/SRM/Meadowcroft.Srm.psm1 b/Modules/SRM/Meadowcroft.Srm.psm1 index ed7c042..8d4bac9 100644 --- a/Modules/SRM/Meadowcroft.Srm.psm1 +++ b/Modules/SRM/Meadowcroft.Srm.psm1 @@ -1,3 +1,11 @@ +<# +Copyright 2017-2021 VMware, Inc. +SPDX-License-Identifier: Apache-2.0 +#> +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> # SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets <# diff --git a/Modules/SRM/NOTICE.txt b/Modules/SRM/NOTICE.txt index 2eb2d48..a6a9158 100644 --- a/Modules/SRM/NOTICE.txt +++ b/Modules/SRM/NOTICE.txt @@ -1,7 +1,10 @@ -Copyright (c) 2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2017-2021 VMware, Inc. All Rights Reserved. -This product is licensed to you under the Apache License version 2.0 (the "License"). You may not use this product except in compliance with the License. +This product is licensed to you under the Apache License version 2.0 (the "License"). You may not use this product except in compliance with the License. -This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. +This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. +Copyright (c) 2021 VMware, Inc. All Rights Reserved. + +This product is licensed to you under the BSD-2-Clause License. You may not use this product except in compliance with the License. diff --git a/Modules/Set-CBT/Set-CBT.psm1 b/Modules/Set-CBT/Set-CBT.psm1 index 784aebb..1c17a01 100644 --- a/Modules/Set-CBT/Set-CBT.psm1 +++ b/Modules/Set-CBT/Set-CBT.psm1 @@ -1,15 +1,15 @@ function Set-CBT { -<# +<# .NOTES =========================================================================== Created by: Markus Kraus Twitter: @VMarkus_K Private Blog: mycloudrevolution.com =========================================================================== - Changelog: - 2016.11 ver 1.0 Base Release + Changelog: + 2016.11 ver 1.0 Base Release =========================================================================== - External Code Sources: + External Code Sources: http://wahlnetwork.com/2015/12/01/change-block-tracking-cbt-powercli/ =========================================================================== Tested Against Environment: @@ -22,13 +22,13 @@ function Set-CBT { =========================================================================== .DESCRIPTION - This Function enables or disables CBT. + This Function enables or disables CBT. .Example - Get-VN TST* | Set-CBT -DisableCBT + Get-VN TST* | Set-CBT -DisableCBT .Example - Get-VN TST* | Set-CBT -EnableCBT + Get-VN TST* | Set-CBT -EnableCBT .PARAMETER DisableCBT Disables CBT for any VMs found with it enabled @@ -41,7 +41,7 @@ function Set-CBT { #> [CmdletBinding()] - param( + param( [Parameter(Mandatory=$True, ValueFromPipeline=$True, Position=0, HelpMessage = "VMs to process")] [ValidateNotNullorEmpty()] [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]] $myVMs, @@ -52,7 +52,7 @@ function Set-CBT { [ValidateNotNullorEmpty()] [Switch]$DisableCBT ) -Process { +Process { $vmconfigspec = New-Object -TypeName VMware.Vim.VirtualMachineConfigSpec Write-Verbose -Message "Walking through given VMs" @@ -60,7 +60,7 @@ Process { { if ($DisableCBT -and $myVM.ExtensionData.Config.ChangeTrackingEnabled -eq $true -and $myVM.ExtensionData.Snapshot -eq $null) { - try + try { Write-Verbose -Message "Reconfiguring $($myVM.name) to disable CBT" -Verbose $vmconfigspec.ChangeTrackingEnabled = $false @@ -75,7 +75,7 @@ Process { } } - catch + catch { throw $myVM } @@ -94,13 +94,13 @@ Process { $SnapShot | Remove-Snapshot -Confirm:$false } } - else + else { - if ($myVM.ExtensionData.Snapshot -ne $null -and $EnableCBT) + if ($myVM.ExtensionData.Snapshot -ne $null -and $EnableCBT) { Write-Warning -Message "Skipping $($myVM.name) - Snapshots found" } - elseif ($myVM.ExtensionData.Snapshot -ne $null -and $DisableCBT) + elseif ($myVM.ExtensionData.Snapshot -ne $null -and $DisableCBT) { Write-Warning -Message "Skipping $($myVM.name) - Snapshots found" } diff --git a/Modules/Start-UNMAP/Start-UNMAP.psm1 b/Modules/Start-UNMAP/Start-UNMAP.psm1 index a8e9896..b899194 100644 --- a/Modules/Start-UNMAP/Start-UNMAP.psm1 +++ b/Modules/Start-UNMAP/Start-UNMAP.psm1 @@ -1,40 +1,44 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> function Start-UNMAP { <# .SYNOPSIS Process SCSI UNMAP on VMware Datastores - + .DESCRIPTION This Function will process SCSI UNMAP on VMware Datastores via ESXCLI -V2 .Example - Start-UNMAP -ClusterName myCluster -DSWildcard *RAID5* + Start-UNMAP -ClusterName myCluster -DSWildcard *RAID5* .Example Start-UNMAP -ClusterName myCluster -DSWildcard *RAID5* -Verbose -WhatIf .Notes NAME: Start-UNMAP.psm1 - AUTHOR: Markus Kraus + AUTHOR: Markus Kraus LASTEDIT: 23.09.2016 VERSION: 1.0 KEYWORDS: VMware, vSphere, ESXi, SCSI, VAAI, UNMAP - + .Link http://mycloudrevolution.com/ - + #Requires PS -Version 4.0 #Requires -Modules VMware.VimAutomation.Core, @{ModuleName="VMware.VimAutomation.Core";ModuleVersion="6.3.0.0"} #> [CmdletBinding(SupportsShouldProcess = $true,ConfirmImpact='High')] - param( + param( [Parameter(Mandatory=$true, Position=0)] [String]$ClusterName, [Parameter(Mandatory=$true, Position=1)] [String]$DSWildcard ) Process { - $Validate = $true + $Validate = $true #region: PowerCLI Session Timeout Write-Verbose "Set Session Timeout ..." $initialTimeout = (Get-PowerCLIConfiguration -Scope Session).WebOperationTimeoutSeconds @@ -90,10 +94,10 @@ function Start-UNMAP { } #endregion - #region: Revert PowerCLI Session Timeout + #region: Revert PowerCLI Session Timeout Write-Verbose "Revert Session Timeout ..." Set-PowerCLIConfiguration -Scope Session -WebOperationTimeoutSeconds $initialTimeout -Confirm:$False | Out-Null #endregion } - + } diff --git a/Modules/VAMI/VAMI.psm1 b/Modules/VAMI/VAMI.psm1 index ae1a985..6c51d34 100755 --- a/Modules/VAMI/VAMI.psm1 +++ b/Modules/VAMI/VAMI.psm1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + Function Get-VAMISummary { <# .NOTES @@ -201,7 +206,7 @@ Function Set-VAMITimeSync { [Parameter(Mandatory=$false,HelpMessage="NTP Servers need to be either a string separated by ',' or an array of servers")] $NTPServers ) - + $timeSyncMode = ( Get-VAMIServiceAPI -NameFilter "timesync").get() if ($timeSyncMode.gettype().name -eq "PSCustomObject") { if ($SyncMode.ToUpper() -ne $timeSyncMode.mode.toupper()) { @@ -746,7 +751,7 @@ Function New-VAMIUser { $CreateSpec.role = $Role $CreateSpec.email = $Email $CreateSpec.password = [VMware.VimAutomation.Cis.Core.Types.V1.Secret]$Password - + if ($CreateSpec.psobject.properties.name -contains "username") { $CreateSpec.username = $Name try { diff --git a/Modules/VCHA/VCHA.psm1 b/Modules/VCHA/VCHA.psm1 index 160f0e7..c59a414 100644 --- a/Modules/VCHA/VCHA.psm1 +++ b/Modules/VCHA/VCHA.psm1 @@ -1,3 +1,7 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> Function Get-VCHAConfig { <# .NOTES diff --git a/Modules/VCSA/VCSA.psm1 b/Modules/VCSA/VCSA.psm1 index a0bac0e..b02b5e9 100644 --- a/Modules/VCSA/VCSA.psm1 +++ b/Modules/VCSA/VCSA.psm1 @@ -1,3 +1,7 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> Function Get-VCSAPasswordPolicy { <# .DESCRIPTION Retrieves vCenter Server Appliance SSO and Local OS Password Policy Configuration diff --git a/Modules/VMCPFunctions/VMCPFunctions.psm1 b/Modules/VMCPFunctions/VMCPFunctions.psm1 index 4f9b16e..54d65a7 100644 --- a/Modules/VMCPFunctions/VMCPFunctions.psm1 +++ b/Modules/VMCPFunctions/VMCPFunctions.psm1 @@ -1,5 +1,9 @@ -function Get-VMCPSettings { -<# +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> +function Get-VMCPSettings { +<# .NOTES =========================================================================== Created on: 10/27/2015 9:25 PM @@ -11,7 +15,7 @@ Modified on: 10/11/2016 Modified by: Erwan Quélin Twitter: @erwanquelin - Github: https://github.com/equelin + Github: https://github.com/equelin =========================================================================== .DESCRIPTION This function will allow users to view the VMCP settings for their clusters @@ -94,7 +98,7 @@ } function Set-VMCPSettings { -<# +<# .NOTES =========================================================================== Created on: 10/27/2015 9:25 PM @@ -106,7 +110,7 @@ function Set-VMCPSettings { Modified on: 10/11/2016 Modified by: Erwan Quélin Twitter: @erwanquelin - Github: https://github.com/equelin + Github: https://github.com/equelin =========================================================================== .DESCRIPTION This function will allow users to enable/disable VMCP and also allow @@ -147,21 +151,21 @@ function Set-VMCPSettings { .EXAMPLE Set-VMCPSettings -cluster LAB-CL -enableVMCP:$True -VmStorageProtectionForPDL ` restartAggressive -VmStorageProtectionForAPD restartAggressive ` - -VmTerminateDelayForAPDSec 2000 -VmReactionOnAPDCleared reset + -VmTerminateDelayForAPDSec 2000 -VmReactionOnAPDCleared reset This will enable VMCP and configure the Settings on cluster LAB-CL .EXAMPLE Set-VMCPSettings -cluster LAB-CL -enableVMCP:$False -VmStorageProtectionForPDL ` disabled -VmStorageProtectionForAPD disabled ` - -VmTerminateDelayForAPDSec 600 -VmReactionOnAPDCleared none + -VmTerminateDelayForAPDSec 600 -VmReactionOnAPDCleared none This will disable VMCP and configure the Settings on cluster LAB-CL .EXAMPLE Set-VMCPSettings -enableVMCP:$False -VmStorageProtectionForPDL ` disabled -VmStorageProtectionForAPD disabled ` - -VmTerminateDelayForAPDSec 600 -VmReactionOnAPDCleared none + -VmTerminateDelayForAPDSec 600 -VmReactionOnAPDCleared none This will disable VMCP and configure the Settings on all clusters available #> @@ -173,7 +177,7 @@ function Set-VMCPSettings { ValueFromPipelineByPropertyName=$True, HelpMessage='What is the Cluster Name?')] $cluster, - + [Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage='$True=Enabled $False=Disabled')] @@ -184,24 +188,24 @@ function Set-VMCPSettings { HelpMessage='Actions that can be taken in response to a PDL event')] [ValidateSet("disabled","warning","restartAggressive")] [string]$VmStorageProtectionForPDL, - + [Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage='Options available for an APD response')] [ValidateSet("disabled","restartConservative","restartAggressive","warning")] [string]$VmStorageProtectionForAPD, - + [Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage='Value in seconds')] [Int]$VmTerminateDelayForAPDSec, - + [Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage='This setting will instruct vSphere HA to take a certain action if an APD event is cleared')] [ValidateSet("reset","none")] [string]$VmReactionOnAPDCleared, - + [Parameter(Mandatory=$False)] [VMware.VimAutomation.Types.VIServer[]]$Server = $global:DefaultVIServers ) @@ -232,14 +236,14 @@ function Set-VMCPSettings { # Create the object we will configure $settings = New-Object VMware.Vim.ClusterConfigSpecEx $settings.dasConfig = New-Object VMware.Vim.ClusterDasConfigInfo - - # Based on $enableVMCP switch - if ($enableVMCP -eq $false) { + + # Based on $enableVMCP switch + if ($enableVMCP -eq $false) { $settings.dasConfig.vmComponentProtecting = "disabled" - } - elseif ($enableVMCP -eq $true) { - $settings.dasConfig.vmComponentProtecting = "enabled" - } + } + elseif ($enableVMCP -eq $true) { + $settings.dasConfig.vmComponentProtecting = "enabled" + } #Create the VMCP object to work with $settings.dasConfig.defaultVmSettings = New-Object VMware.Vim.ClusterDasVmSettings @@ -295,7 +299,7 @@ function Set-VMCPSettings { } else { $settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmTerminateDelayForAPDSec = $ActualSettings.'APD Timeout (Seconds)' } - + # Reaction On APD Cleared If ($PSBoundParameters.ContainsKey('VmReactionOnAPDCleared')) { $settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmReactionOnAPDCleared = "$VmReactionOnAPDCleared" diff --git a/Modules/VMware.CSP/VMware.CSP.psm1 b/Modules/VMware.CSP/VMware.CSP.psm1 index 469bcad..b8fcda1 100644 --- a/Modules/VMware.CSP/VMware.CSP.psm1 +++ b/Modules/VMware.CSP/VMware.CSP.psm1 @@ -1,4 +1,8 @@ -Function Get-CSPAccessToken { +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> +Function Get-CSPAccessToken { <# .NOTES =========================================================================== diff --git a/Modules/VMware.Community.CISTag/VMware.Community.CISTag.psd1 b/Modules/VMware.Community.CISTag/VMware.Community.CISTag.psd1 index b20f2de..1d5fbac 100644 --- a/Modules/VMware.Community.CISTag/VMware.Community.CISTag.psd1 +++ b/Modules/VMware.Community.CISTag/VMware.Community.CISTag.psd1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + # # Module manifest for module 'VMware.Community.CISTag' # diff --git a/Modules/VMware.Community.CISTag/VMware.Community.CISTag.psm1 b/Modules/VMware.Community.CISTag/VMware.Community.CISTag.psm1 index 4ca717c..04296d1 100644 --- a/Modules/VMware.Community.CISTag/VMware.Community.CISTag.psm1 +++ b/Modules/VMware.Community.CISTag/VMware.Community.CISTag.psm1 @@ -1,25 +1,29 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> function Get-CISTag { -<# -.SYNOPSIS +<# +.SYNOPSIS Gathers tag information from the CIS REST API endpoint -.DESCRIPTION +.DESCRIPTION Will provide a list of tags -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy .PARAMETER Name Tag name which should be retreived .PARAMETER Category Tag category name which should be retreived .PARAMETER Id - Tag ID which should be retreived + Tag ID which should be retreived .EXAMPLE Get-CISTag - Retreives all tag information + Retreives all tag information .EXAMPLE Get-CISTag -Name tagName Retreives the tag information based on the specified name #> -[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Low')] +[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Low')] param( [Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)] [String]$Name, @@ -30,7 +34,7 @@ function Get-CISTag { ) If (-Not $global:DefaultCisServers) { Write-error "No CIS Connection found, please use the Connect-CisServer to connect" } Else { - $tagSvc = Get-CisService -Name com.vmware.cis.tagging.tag + $tagSvc = Get-CisService -Name com.vmware.cis.tagging.tag if ($PSBoundParameters.ContainsKey("Id")) { $tagOutput = $tagSvc.get($Id) } else { @@ -50,9 +54,9 @@ function Get-CISTag { if ($PSBoundParameters.ContainsKey("Name")) { if ($vCenterConn){ $tagOutput = $vCTagList | Where-Object {$_.Name -eq $Name} - } else {$tagOutput = $tagArray | Where-Object {$_.Name -eq $Name}} - } elseif ($PSBoundParameters.ContainsKey("Category")) { - if ($vCenterConn){ + } else {$tagOutput = $tagArray | Where-Object {$_.Name -eq $Name}} + } elseif ($PSBoundParameters.ContainsKey("Category")) { + if ($vCenterConn){ $tagOutput = $vCTagList | Where-Object {$_.Category -eq $Category} } else { $tagCatid = Get-CISTagCategory -Name $Category | Select-Object -ExpandProperty Id @@ -74,12 +78,12 @@ function Get-CISTag { } function New-CISTag { -<# -.SYNOPSIS +<# +.SYNOPSIS Creates a new tag from the CIS REST API endpoint -.DESCRIPTION +.DESCRIPTION Will create a new tag -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy .PARAMETER Name Tag name which should be created @@ -93,7 +97,7 @@ function New-CISTag { New-CISTag -Name tagName -Category categoryName -Description "Tag Descrition" Creates a new tag based on the specified name #> -[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Medium')] +[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Medium')] param( [Parameter(Mandatory=$true,Position=0)] [String]$Name, @@ -106,7 +110,7 @@ function New-CISTag { ) If (-Not $global:DefaultCisServers) { Write-error "No CIS Connection found, please use the Connect-CisServer to connect" } Else { - $tagSvc = Get-CisService -Name com.vmware.cis.tagging.tag + $tagSvc = Get-CisService -Name com.vmware.cis.tagging.tag $tagCreateHelper = $tagSvc.Help.create.create_spec.Create() $tagCreateHelper.name = $Name if ($PSBoundParameters.ContainsKey("Category")) { @@ -126,22 +130,22 @@ function New-CISTag { } function Remove-CISTag { -<# -.SYNOPSIS +<# +.SYNOPSIS Removes a tag from the CIS REST API endpoint -.DESCRIPTION +.DESCRIPTION Will delete a new tag -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy .PARAMETER Name Tag name which should be removed .PARAMETER ID Tag ID which should be removed .EXAMPLE - Remove-CISTag -Name tagName + Remove-CISTag -Name tagName Removes a new tag based on the specified name #> -[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'High')] +[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'High')] param( [Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)] [String]$Name, @@ -150,7 +154,7 @@ function Remove-CISTag { ) If (-Not $global:DefaultCisServers) { Write-error "No CIS Connection found, please use the Connect-CisServer to connect" } Else { - $tagSvc = Get-CisService -Name com.vmware.cis.tagging.tag + $tagSvc = Get-CisService -Name com.vmware.cis.tagging.tag if ($ID) { $tagSvc.delete($ID) } else { @@ -162,25 +166,25 @@ function Remove-CISTag { } function Get-CISTagCategory { -<# -.SYNOPSIS +<# +.SYNOPSIS Gathers tag category information from the CIS REST API endpoint -.DESCRIPTION +.DESCRIPTION Will provide a list of tag categories -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy .PARAMETER Name - Tag category name which should be retreived + Tag category name which should be retreived .PARAMETER Id Tag category ID which should be retreived .EXAMPLE Get-CISTagCategory - Retreives all tag category information + Retreives all tag category information .EXAMPLE Get-CISTagCategory -Name tagCategoryName Retreives the tag category information based on the specified name #> -[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Low')] +[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Low')] param( [Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)] [String]$Name, @@ -210,26 +214,26 @@ function Get-CISTagCategory { } function New-CISTagCategory { -<# -.SYNOPSIS +<# +.SYNOPSIS Creates a new tag category from the CIS REST API endpoint -.DESCRIPTION +.DESCRIPTION Will create a new tag category -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy .PARAMETER Name - Tag category name which should be created + Tag category name which should be created .PARAMETER Description Tag category ID which should be retreived .PARAMETER Cardinality Tag category ID which should be retreived .PARAMETER AssociableTypes - Tag category ID which should be retreived + Tag category ID which should be retreived .EXAMPLE - New-CISTagCategory -Name NewTagCategoryName -Description "New Tag Category Description" -Cardinality "Single" -AssociableTypes + New-CISTagCategory -Name NewTagCategoryName -Description "New Tag Category Description" -Cardinality "Single" -AssociableTypes Creates a new tag category with the specified information #> -[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Medium')] +[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Medium')] param( [Parameter(Mandatory=$true,Position=0)] [String]$Name, @@ -261,15 +265,15 @@ function New-CISTagCategory { } function Remove-CISTagCategory { -<# -.SYNOPSIS +<# +.SYNOPSIS Removes tag category information from the CIS REST API endpoint -.DESCRIPTION +.DESCRIPTION Will remove a tag category -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy .PARAMETER Name - Tag category name which should be removed + Tag category name which should be removed .PARAMETER Id Tag category ID which should be removed .EXAMPLE @@ -277,7 +281,7 @@ function Remove-CISTagCategory { Removes the tag category information based on the specified name #> -[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'High')] +[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'High')] param( [Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)] [String]$Name, @@ -297,12 +301,12 @@ function Remove-CISTagCategory { } function Get-CISTagAssignment { -<# -.SYNOPSIS +<# +.SYNOPSIS Displays a list of the tag assignments from the CIS REST API endpoint -.DESCRIPTION +.DESCRIPTION Will provide a list of the tag assignments -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy .PARAMETER Category Tag category name which should be referenced @@ -311,7 +315,7 @@ function Get-CISTagAssignment { .PARAMETER ObjectId Object ID which should be retreived .EXAMPLE - Get-CISTagAssignment + Get-CISTagAssignment Retreives all tag assignment information .EXAMPLE Get-CISTagAssignment -Entity VMName @@ -320,7 +324,7 @@ function Get-CISTagAssignment { Get-CISTagAssignment -ObjectId 'vm-11' Retreives all tag assignments for the VM object #> -[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Low')] +[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Low')] param( [Parameter(Mandatory=$false,Position=0)] [String]$Category, @@ -357,7 +361,7 @@ function Get-CISTagAssignment { $filterVmNameObj.names.add($Entity) | Out-Null $objId = $vmSvc.list($filterVmNameObj) | Select-Object -ExpandProperty vm if ($objId) {$objType = "VirtualMachine"} - else { + else { $dsSvc = Get-CisService com.vmware.vcenter.datastore $filterDsNameObj = $dsSvc.Help.list.filter.Create() $filterDsNameObj.names.add($Entity) | Out-Null @@ -371,7 +375,7 @@ function Get-CISTagAssignment { } $tagIdOutput = $tagAssocSvc.list_attached_tags($objObject) } else { - $tagSvc = Get-CisService -Name com.vmware.cis.tagging.tag + $tagSvc = Get-CisService -Name com.vmware.cis.tagging.tag $tagIdOutput = @() $tagCategories = Get-CISTagCategory | Sort-Object -Property Name if ($Category) { @@ -404,7 +408,7 @@ function Get-CISTagAssignment { $filterDsObj = $dsSvc.help.list.filter.create() $filterDsObj.datastores.add($obj.Id) | Out-Null $objName = $dsSvc.list($filterDsObj) | Select-Object -ExpandProperty Name - } else {$objName = 'Object Not Found'} + } else {$objName = 'Object Not Found'} $tempObject = "" | Select-Object Tag, Entity $tempObject.Tag = $tagReference | Where-Object {$_.id -eq $tagId} | Select-Object -ExpandProperty Name $tempObject.Entity = $objName @@ -436,7 +440,7 @@ function Get-CISTagAssignment { $filterDsObj = $dsSvc.help.list.filter.create() $filterDsObj.datastores.add($obj.Id) | Out-Null $objName = $dsSvc.list($filterDsObj) | Select-Object -ExpandProperty Name - } else {$objName = 'Object Not Found'} + } else {$objName = 'Object Not Found'} $tempObject = "" | Select-Object Tag, Entity $tempObject.Tag = $tagReference | Where-Object {$_.id -eq $tagId} | Select-Object -ExpandProperty Name $tempObject.Entity = $objName @@ -449,12 +453,12 @@ function Get-CISTagAssignment { } function New-CISTagAssignment { -<# -.SYNOPSIS +<# +.SYNOPSIS Creates new tag assignments from the CIS REST API endpoint -.DESCRIPTION +.DESCRIPTION Will create new tag assignments -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy .PARAMETER Tag Tag name which should be referenced @@ -471,7 +475,7 @@ function New-CISTagAssignment { New-CISTagAssignment -TagId $tagId -ObjectId 'vm-11' Creates a tag assignment between the Tag ID and the Object ID #> -[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Medium')] +[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'Medium')] param( [Parameter(Mandatory=$false,Position=0)] $Tag, @@ -603,19 +607,19 @@ function New-CISTagAssignment { $objObject.type = $objType $tagAssocSvc.attach($TagId,$objObject) | Out-Null } - + } else {Write-Output "Multiple tags with multiple objects are not a supported call."} } } function Remove-CISTagAssignment { -<# -.SYNOPSIS +<# +.SYNOPSIS Removes a tag assignment from the CIS REST API endpoint -.DESCRIPTION +.DESCRIPTION Will remove provided tag assignments -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy .PARAMETER Tag Tag name which should be removed @@ -632,7 +636,7 @@ function Remove-CISTagAssignment { Remove-CISTagAssignment -Tag TagName -Entity VMName Removes the tag assignment between the Tag name and the Entity name #> -[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'High')] +[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'High')] param( [Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)] $Tag, diff --git a/Modules/VMware.DRaaS/VMware.DRaaS.psd1 b/Modules/VMware.DRaaS/VMware.DRaaS.psd1 index fd5ab0692124655225f62337b7c4fa3c07651ab6..08c57c63be85f5653cec4ea39ac3b5797f8885d0 100755 GIT binary patch delta 146 zcmZ2xv%{A4|34cB<;jUG;`K%h1`I|Fh71Y}VGOROA35?*(1} diff --git a/Modules/VMware.DRaaS/VMware.DRaaS.psm1 b/Modules/VMware.DRaaS/VMware.DRaaS.psm1 index 7067d49..65060a8 100644 --- a/Modules/VMware.DRaaS/VMware.DRaaS.psm1 +++ b/Modules/VMware.DRaaS/VMware.DRaaS.psm1 @@ -1,3 +1,7 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> Function Connect-DRaas { <# .NOTES diff --git a/Modules/VMware.HCX/VMware.HCX.psd1 b/Modules/VMware.HCX/VMware.HCX.psd1 index 63af019..32b55f1 100644 --- a/Modules/VMware.HCX/VMware.HCX.psd1 +++ b/Modules/VMware.HCX/VMware.HCX.psd1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + # # Module manifest for module 'VMware.HCX' # diff --git a/Modules/VMware.HCX/VMware.HCX.psm1 b/Modules/VMware.HCX/VMware.HCX.psm1 index d869ea1..01b01b2 100644 --- a/Modules/VMware.HCX/VMware.HCX.psm1 +++ b/Modules/VMware.HCX/VMware.HCX.psm1 @@ -1,3 +1,7 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> Function Connect-HcxServer { <# .NOTES @@ -1057,7 +1061,7 @@ Function Set-HcxLocation { if(-not $cityDetails) { Write-Host -ForegroundColor Red "Invalid input for City and/or Country, please provide the exact input from Get-HcxCity cmdlet" - break + break } $locationConfig = @{ @@ -1089,7 +1093,7 @@ Function Set-HcxLocation { if($results.StatusCode -eq 204) { Write-Host -ForegroundColor Green "Successfully registered datacenter location $City to HCX Manager" } else { - Write-Error "Failed to registerd datacenter location in HCX Manager" + Write-Error "Failed to registerd datacenter location in HCX Manager" } } else { Write-Error "Failed to search for city $City" diff --git a/Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psd1 b/Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psd1 index 46e5fb2..6630af5 100644 --- a/Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psd1 +++ b/Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psd1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + # # Module manifest for module 'VMware.VMC.NSXT' # diff --git a/Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psm1 b/Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psm1 index 11f1cb1..1ab49ad 100644 --- a/Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psm1 +++ b/Modules/VMware.VMC.NSXT/VMware.VMC.NSXT.psm1 @@ -1,3 +1,7 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> Function Connect-NSXTProxy { <# .NOTES diff --git a/Modules/VMware.VMC/VMware.VMC.psd1 b/Modules/VMware.VMC/VMware.VMC.psd1 index 397ab8df97385b930488b229cabe25d0817ac0b1..5e98636b2094c55722998857839e25b5902eaced 100755 GIT binary patch delta 163 zcmZp2ndDmk|DO$mG6NTbGebT@0YfE25kn?JIzt9S34;QI5rY8`8v Function Get-VMCCommand { <# .NOTES @@ -34,7 +38,7 @@ Function Connect-VMCVIServer { Blog: http://vmware.com/go/powercli Twitter: @powercli =========================================================================== - + .SYNOPSIS Cmdlet to connect to your VMC vCenter Server .DESCRIPTION @@ -50,7 +54,7 @@ Function Connect-VMCVIServer { [switch]$Autologin, [switch]$UseManagementIP ) - + If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use the Connect-VMC to connect" } Else { $creds = Get-VMCSDDCDefaultCredential -Org $Org -Sddc $Sddc If($UseManagementIP){ @@ -297,7 +301,7 @@ Function Get-VMCSDDCVersion { Blog: http://vmware.com/go/powercli Twitter: @powercli =========================================================================== - + .SYNOPSIS Returns SDDC Version .DESCRIPTION @@ -707,7 +711,7 @@ Function Get-VMCLogicalNetwork { .DESCRIPTION Retruns VMC Logical Networks for a given SDDC .EXAMPLE - Get-VMCLogicalNetwork -OrgName -SDDCName + Get-VMCLogicalNetwork -OrgName -SDDCName .EXAMPLE Get-VMCLogicalNetwork -OrgName -SDDCName -LogicalNetworkName #> @@ -738,7 +742,7 @@ Function Get-VMCLogicalNetwork { $logicalNetworks = do{ $netData = $logicalNetworkService.get_0($orgId,$sddcId,$pagesize,$index) $netData.data | Sort-Object -Property id - $index = $index + $netdata.paging_info.page_size + $index = $index + $netdata.paging_info.page_size } until($index -ge $netData.paging_info.total_count) @@ -840,7 +844,7 @@ Function New-VMCLogicalNetwork { $orgId = (Get-VMCOrg -Name $OrgName).Id $sddcId = (Get-VMCSDDC -Name $SDDCName -Org $OrgName).Id - + if(-not $orgId) { Write-Host -ForegroundColor red "Unable to find Org $OrgName, please verify input" break @@ -1166,7 +1170,7 @@ Twitter: @LucD22 $edges = do{ $edgeData = $edgeService.get($orgId,$sddcId,$EdgeType,'',$index) $edgeData.edge_page.data | Sort-Object -Property id - $index = $index + $edgeData.edge_page.paging_info.page_size + $index = $index + $edgeData.edge_page.paging_info.page_size } until($index -ge $edgeData.paging_info.total_count) $edges | %{ @@ -1227,7 +1231,7 @@ Twitter: @LucD22 State = $_.edge_VM_status HAState = $_.ha_state Index = $_.index - } + } } $featureStatus = $status.feature_statuses | %{ [pscustomobject]@{ @@ -1333,7 +1337,7 @@ Twitter: @LucD22 $edgeId = Get-VMCEdge -SDDCName $SDDCName -Org $OrgName | where{$_.Name -eq $EdgeName} | select -ExpandProperty Id # $epoch = Get-Date 01/01/1970 -# +# # if($start){ # $startEpoch = (New-TimeSpan -Start $epoch -End $Start.ToUniversalTime()).TotalMilliseconds # } @@ -1398,7 +1402,7 @@ Twitter: @LucD22 $edgeId = Get-VMCEdge -SDDCName $SDDCName -Org $OrgName | where{$_.Name -eq $EdgeName} | select -ExpandProperty Id # $epoch = Get-Date 01/01/1970 -# +# # if($start){ # $startEpoch = (New-TimeSpan -Start $epoch -End $Start.ToUniversalTime()).TotalMilliseconds # } @@ -1436,7 +1440,7 @@ Function New-VMCSDDCCluster { Blog: https://www.kmruddy.com Twitter: @kmruddy =========================================================================== - + .SYNOPSIS Creates a new cluster for the designated SDDC .DESCRIPTION @@ -1485,7 +1489,7 @@ Function Get-VMCSDDCCluster { Blog: https://www.kmruddy.com Twitter: @kmruddy =========================================================================== - + .SYNOPSIS Retreives cluster information for the designated SDDC .DESCRIPTION @@ -1534,7 +1538,7 @@ Function New-VMCSDDCCluster { Blog: https://www.kmruddy.com Twitter: @kmruddy =========================================================================== - + .SYNOPSIS Creates a new cluster for the designated SDDC .DESCRIPTION @@ -1583,7 +1587,7 @@ Function Remove-VMCSDDCCluster { Blog: https://www.kmruddy.com Twitter: @kmruddy =========================================================================== - + .SYNOPSIS Removes a specified cluster from the designated SDDC .DESCRIPTION diff --git a/Modules/VMware.VMEncryption/VMware.VMEncryption.psd1 b/Modules/VMware.VMEncryption/VMware.VMEncryption.psd1 index 8a93a97..a827e22 100644 --- a/Modules/VMware.VMEncryption/VMware.VMEncryption.psd1 +++ b/Modules/VMware.VMEncryption/VMware.VMEncryption.psd1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + # # Module manifest for module 'VMware.VMEncryption' # diff --git a/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 b/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 index 21df608..e75af05 100644 --- a/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 +++ b/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + # Script Module : VMware.VMEncryption # Version : 1.2 diff --git a/Modules/VMware.VsanEncryption/VMware.VsanEncryption.psd1 b/Modules/VMware.VsanEncryption/VMware.VsanEncryption.psd1 index 47b0ca30d0fd967f4a1e9ee3b4b69b6b61d2b73d..da0eb03252f00105bb5ab0a779743ba486b009ec 100644 GIT binary patch delta 117 zcmaE*{zrrL|34cB<;i!M#o3J*3>b_U3@6L7NQZGT1TzFMxG+R8=rZ^)WHKZ(q%!0& z6az_J22X|*Fs}qCo(9CJ3`Go93UI+sKCqf2w diff --git a/Modules/VMware.VsanEncryption/VMware.VsanEncryption.psm1 b/Modules/VMware.VsanEncryption/VMware.VsanEncryption.psm1 index 870bd44..78d494c 100644 --- a/Modules/VMware.VsanEncryption/VMware.VsanEncryption.psm1 +++ b/Modules/VMware.VsanEncryption/VMware.VsanEncryption.psm1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + # Script Module : VMware.VsanEncryption # Version : 1.0 # Author : Jase McCarty, VMware Storage & Availability Business Unit @@ -26,19 +31,19 @@ Function Invoke-VsanEncryptionRekey { <# .SYNOPSIS - This function will initiate a ReKey of a vSAN Cluster. Shallow ReKeying (KEK Only) or Deep ReKeying (DEK Also) are supported, as well as Reduced Redundancy if necessary. + This function will initiate a ReKey of a vSAN Cluster. Shallow ReKeying (KEK Only) or Deep ReKeying (DEK Also) are supported, as well as Reduced Redundancy if necessary. .DESCRIPTION - This function will initiate a ReKey of a vSAN Cluster. Shallow ReKeying (KEK Only) or Deep ReKeying (DEK Also) are supported, as well as Reduced Redundancy if necessary. + This function will initiate a ReKey of a vSAN Cluster. Shallow ReKeying (KEK Only) or Deep ReKeying (DEK Also) are supported, as well as Reduced Redundancy if necessary. .PARAMETER Cluster Specifies the Cluster to perform the rekey process on .PARAMETER DeepRekey Use to invoke a Deep Rekey ($true) or a Shallow ($false or omit) - + .PARAMETER ReducedRedundancy - For clusters that have 4 or more hosts, this will allow for reduced redundancy. + For clusters that have 4 or more hosts, this will allow for reduced redundancy. For clusters that have 2 or 3 hosts, this does not need to be set (can be). .EXAMPLE @@ -53,7 +58,7 @@ Function Invoke-VsanEncryptionRekey { [Parameter(Mandatory = $False)][Boolean]$ReducedRedundancy ) - # Get the Cluster + # Get the Cluster $VsanCluster = Get-Cluster -Name $Cluster # Get the vSAN Cluster Configuration View @@ -95,71 +100,71 @@ Function Invoke-VsanEncryptionRekey { Function Set-VsanEncryptionKms { <# .SYNOPSIS - This function will set the KMS to be used with vSAN Encryption - + This function will set the KMS to be used with vSAN Encryption + .DESCRIPTION - This function will set the KMS to be used with vSAN Encryption - + This function will set the KMS to be used with vSAN Encryption + .PARAMETER Cluster Specifies the Cluster to set the KMS server for - + .PARAMETER KmsCluster Use to set the KMS Cluster to be used with vSAN Encryption - + .EXAMPLE C:\PS>Set-VsanEncryptionKms -Cluster "ClusterName" -KmsCluster "vCenter KMS Cluster Entry" - + #> - + # Set our Parameters [CmdletBinding()]Param( [Parameter(Mandatory = $True)][String]$Cluster, [Parameter(Mandatory = $False)][String]$KmsCluster ) - - # Get the Cluster + + # Get the Cluster $VsanCluster = Get-Cluster -Name $Cluster - - # Get the list of KMS Servers that are included + + # Get the list of KMS Servers that are included $KmsClusterList = Get-KmsCluster - # Was a KMS Cluster Specified? + # Was a KMS Cluster Specified? # Specified: Is it in the list? # Is it not in the list? - # Not Specified: Present a list + # Not Specified: Present a list If ($KmsCluster) { If ($KmsClusterList.Name.Contains($KmsCluster)) { Write-Host "$KmsCluster In the list, proceeding" -ForegroundColor Green $KmsClusterProfile = $KmsClusterList | Where-Object {$_.Name -eq $KmsCluster} } else { - + $Count = 0 Foreach ($KmsClusterItem in $KmsClusterList) { Write-Host "$Count) $KmsClusterItem " $Count = $Count + 1 } - $KmsClusterEntry = Read-Host -Prompt "$KmsCluster is not valid, please select one of the existing KMS Clusters to use" + $KmsClusterEntry = Read-Host -Prompt "$KmsCluster is not valid, please select one of the existing KMS Clusters to use" Write-Host $KmsClusterList[$KmsClusterEntry] $KmsClusterProfile = $KmsClusterList[$KmsClusterEntry] } } else { - + $Count = 0 Foreach ($KmsClusterItem in $KmsClusterList) { Write-Host "$Count) $KmsClusterItem " $Count = $Count + 1 } - $KmsClusterEntry = Read-Host -Prompt "No KMS provided, please select one of the existing KMS Clusters to use" + $KmsClusterEntry = Read-Host -Prompt "No KMS provided, please select one of the existing KMS Clusters to use" Write-Host $KmsClusterList[$KmsClusterEntry] $KmsClusterProfile = $KmsClusterList[$KmsClusterEntry] } # Get the vSAN Cluster Configuration View $VsanVcClusterConfig = Get-VsanView -Id "VsanVcClusterConfigSystem-vsan-cluster-config-system" - + # Get Encryption State $EncryptedVsan = $VsanVcClusterConfig.VsanClusterGetConfig($VsanCluster.ExtensionData.MoRef).DataEncryptionConfig - + # If vSAN is enabled and it is Encrypted If($VsanCluster.vSanEnabled -And $EncryptedVsan.EncryptionEnabled){ @@ -181,7 +186,7 @@ Function Set-VsanEncryptionKms { # Set the Reconfigure Specification to use the Data Encryption Configuration Spec $vsanReconfigSpec = New-Object VMware.Vsan.Views.VimVsanReconfigSpec $vsanReconfigSpec.DataEncryptionConfig = $DataEncryptionConfigSpec - + # Execute the task of changing the KMS Cluster Profile Being Used $ChangeKmsTask = $VsanVcClusterConfig.VsanClusterReconfig($VsanCluster.ExtensionData.MoRef,$vsanReconfigSpec) } @@ -192,74 +197,74 @@ Function Set-VsanEncryptionKms { Function Get-VsanEncryptionKms { <# .SYNOPSIS - This function will set the KMS to be used with vSAN Encryption - + This function will set the KMS to be used with vSAN Encryption + .DESCRIPTION - This function will set the KMS to be used with vSAN Encryption - + This function will set the KMS to be used with vSAN Encryption + .PARAMETER Cluster Specifies the Cluster to set the KMS server for - + .EXAMPLE C:\PS>Get-VsanEncryptionKms -Cluster "ClusterName" #> - + # Set our Parameters [CmdletBinding()]Param([Parameter(Mandatory = $True)][String]$Cluster) - - # Get the Cluster + + # Get the Cluster $VsanCluster = Get-Cluster -Name $Cluster - + # Get the vSAN Cluster Configuration View $VsanVcClusterConfig = Get-VsanView -Id "VsanVcClusterConfigSystem-vsan-cluster-config-system" - + # Get Encryption State $EncryptedVsan = $VsanVcClusterConfig.VsanClusterGetConfig($VsanCluster.ExtensionData.MoRef).DataEncryptionConfig - + # If vSAN is enabled and it is Encrypted If($VsanCluster.vSanEnabled -And $EncryptedVsan.EncryptionEnabled){ - $EncryptedVsan.KmsProviderId.Id + $EncryptedVsan.KmsProviderId.Id } } Function Set-VsanEncryptionDiskWiping { <# .SYNOPSIS - This function will update the Disk Wiping option in vSAN Encryption - + This function will update the Disk Wiping option in vSAN Encryption + .DESCRIPTION - This function will update the Disk Wiping option in vSAN Encryption - + This function will update the Disk Wiping option in vSAN Encryption + .PARAMETER Cluster Specifies the Cluster set the Disk Wiping Setting on - + .PARAMETER DiskWiping Use to set the Disk Wiping setting for vSAN Encryption - + .EXAMPLE C:\PS>Set-VsanEncryptionDiskWiping -Cluster "ClusterName" -DiskWiping $true - .EXAMPLE + .EXAMPLE C:\PS>Set-VsanEncryptionDiskWiping -Cluster "ClusterName" -DiskWiping $false - + #> - + # Set our Parameters [CmdletBinding()]Param( [Parameter(Mandatory = $True)][String]$Cluster, [Parameter(Mandatory = $True)][Boolean]$DiskWiping ) - - # Get the Cluster + + # Get the Cluster $VsanCluster = Get-Cluster -Name $Cluster # Get the vSAN Cluster Configuration View $VsanVcClusterConfig = Get-VsanView -Id "VsanVcClusterConfigSystem-vsan-cluster-config-system" - + # Get Encryption State $EncryptedVsan = $VsanVcClusterConfig.VsanClusterGetConfig($VsanCluster.ExtensionData.MoRef).DataEncryptionConfig - + # If vSAN is enabled and it is Encrypted If($VsanCluster.vSanEnabled -And $EncryptedVsan.EncryptionEnabled){ @@ -287,7 +292,7 @@ Function Set-VsanEncryptionDiskWiping { # Set the Reconfigure Specification to use the Data Encryption Configuration Spec $vsanReconfigSpec = New-Object VMware.Vsan.Views.VimVsanReconfigSpec $vsanReconfigSpec.DataEncryptionConfig = $DataEncryptionConfigSpec - + # Execute the task of changing the KMS Cluster Profile Being Used $VsanVcClusterConfig.VsanClusterReconfig($VsanCluster.ExtensionData.MoRef,$vsanReconfigSpec) @@ -298,31 +303,31 @@ Function Set-VsanEncryptionDiskWiping { Function Get-VsanEncryptionDiskWiping { <# .SYNOPSIS - This function will retrieve the Disk Wiping option setting in vSAN Encryption - + This function will retrieve the Disk Wiping option setting in vSAN Encryption + .DESCRIPTION - This function will retrieve the Disk Wiping option setting in vSAN Encryption - + This function will retrieve the Disk Wiping option setting in vSAN Encryption + .PARAMETER Cluster Specifies the Cluster set the Disk Wiping Setting on - + .EXAMPLE C:\PS>Get-VsanEncryptionDiskWiping -Cluster "ClusterName" - + #> - + # Set our Parameters [CmdletBinding()]Param([Parameter(Mandatory = $True)][String]$Cluster) - - # Get the Cluster + + # Get the Cluster $VsanCluster = Get-Cluster -Name $Cluster # Get the vSAN Cluster Configuration View $VsanVcClusterConfig = Get-VsanView -Id "VsanVcClusterConfigSystem-vsan-cluster-config-system" - + # Get Encryption State $EncryptedVsan = $VsanVcClusterConfig.VsanClusterGetConfig($VsanCluster.ExtensionData.MoRef).DataEncryptionConfig - + # If vSAN is enabled and it is Encrypted If($VsanCluster.vSanEnabled -And $EncryptedVsan.EncryptionEnabled){ diff --git a/Modules/VMware.WorkloadManagement/VMware.WorkloadManagement.psd1 b/Modules/VMware.WorkloadManagement/VMware.WorkloadManagement.psd1 index 85758ed..751d03c 100644 --- a/Modules/VMware.WorkloadManagement/VMware.WorkloadManagement.psd1 +++ b/Modules/VMware.WorkloadManagement/VMware.WorkloadManagement.psd1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + # # Module manifest for module 'VMware.WorkloadManagement' # diff --git a/Modules/VMware.WorkloadManagement/VMware.WorkloadManagement.psm1 b/Modules/VMware.WorkloadManagement/VMware.WorkloadManagement.psm1 index 6eda487..0c171e9 100644 --- a/Modules/VMware.WorkloadManagement/VMware.WorkloadManagement.psm1 +++ b/Modules/VMware.WorkloadManagement/VMware.WorkloadManagement.psm1 @@ -1,3 +1,7 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> Function New-WorkloadManagement { <# .NOTES @@ -106,7 +110,7 @@ Function New-WorkloadManagement { $mgmtNetworkMoRef = $networkService.list($networkFilterSpec).network.Value if ($mgmtNetworkMoRef -eq $NULL) { Write-Host -ForegroundColor Red "Unable to find vSphere Cluster ${MgmtNetwork}" - break + break } # Cluster Moref diff --git a/Modules/VMware.WorkspaceOneAccess/VMware.WorkspaceOneAccess.psd1 b/Modules/VMware.WorkspaceOneAccess/VMware.WorkspaceOneAccess.psd1 index d226ed5..511ddc4 100644 --- a/Modules/VMware.WorkspaceOneAccess/VMware.WorkspaceOneAccess.psd1 +++ b/Modules/VMware.WorkspaceOneAccess/VMware.WorkspaceOneAccess.psd1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + # # Module manifest for module 'VMware.HCX' # diff --git a/Modules/VMware.WorkspaceOneAccess/VMware.WorkspaceOneAccess.psm1 b/Modules/VMware.WorkspaceOneAccess/VMware.WorkspaceOneAccess.psm1 index 642e14f..46ffc8a 100644 --- a/Modules/VMware.WorkspaceOneAccess/VMware.WorkspaceOneAccess.psm1 +++ b/Modules/VMware.WorkspaceOneAccess/VMware.WorkspaceOneAccess.psm1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + Function Connect-WorkspaceOneAccess { <# .NOTES @@ -626,9 +631,9 @@ Function Get-UEMConfig { if($results.StatusCode -eq 200) { $config = ([System.Text.Encoding]::ASCII.GetString($results.Content) | ConvertFrom-Json) $config - } + } } - + Function Remove-UEMConfig { <# .NOTES diff --git a/Modules/VMware.vSphere.SsoAdmin/Connect.ps1 b/Modules/VMware.vSphere.SsoAdmin/Connect.ps1 index 278a978..bfd6fa4 100644 --- a/Modules/VMware.vSphere.SsoAdmin/Connect.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/Connect.ps1 @@ -1,5 +1,5 @@ <# -Copyright 2020-2021 VMware, Inc. +Copyright 2021 VMware, Inc. SPDX-License-Identifier: BSD-2-Clause #> diff --git a/Modules/VMware.vSphere.SsoAdmin/Group.ps1 b/Modules/VMware.vSphere.SsoAdmin/Group.ps1 index 9e0da4f..f1cd318 100644 --- a/Modules/VMware.vSphere.SsoAdmin/Group.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/Group.ps1 @@ -1,5 +1,5 @@ <# -Copyright 2020-2021 VMware, Inc. +Copyright 2021 VMware, Inc. SPDX-License-Identifier: BSD-2-Clause #> diff --git a/Modules/VMware.vSphere.SsoAdmin/IdentitySource.ps1 b/Modules/VMware.vSphere.SsoAdmin/IdentitySource.ps1 index 496ef65..2f83b76 100644 --- a/Modules/VMware.vSphere.SsoAdmin/IdentitySource.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/IdentitySource.ps1 @@ -1,5 +1,5 @@ <# -Copyright 2020-2021 VMware, Inc. +Copyright 2021 VMware, Inc. SPDX-License-Identifier: BSD-2-Clause #> diff --git a/Modules/VMware.vSphere.SsoAdmin/LockoutPolicy.ps1 b/Modules/VMware.vSphere.SsoAdmin/LockoutPolicy.ps1 index bfb9665..f44206d 100644 --- a/Modules/VMware.vSphere.SsoAdmin/LockoutPolicy.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/LockoutPolicy.ps1 @@ -1,5 +1,5 @@ <# -Copyright 2020-2021 VMware, Inc. +Copyright 2021 VMware, Inc. SPDX-License-Identifier: BSD-2-Clause #> diff --git a/Modules/VMware.vSphere.SsoAdmin/PasswordPolicy.ps1 b/Modules/VMware.vSphere.SsoAdmin/PasswordPolicy.ps1 index d5f8c46..66764bf 100644 --- a/Modules/VMware.vSphere.SsoAdmin/PasswordPolicy.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/PasswordPolicy.ps1 @@ -1,5 +1,5 @@ <# -Copyright 2020-2021 VMware, Inc. +Copyright 2021 VMware, Inc. SPDX-License-Identifier: BSD-2-Clause #> diff --git a/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psd1 b/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psd1 index 096afa3..e9795f8 100644 --- a/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psd1 +++ b/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psd1 @@ -1,3 +1,8 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + # # Module manifest for module 'VMware.vSphere.SsoAdmin' # diff --git a/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psm1 b/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psm1 index d7fff6e..d042711 100644 --- a/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psm1 +++ b/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psm1 @@ -1,6 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> # # Script module for module 'VMware.vSphere.SsoAdmin' diff --git a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.LsClient.dll b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.LsClient.dll index 2f0265631743da6815f19d1f241d35178442b7ea..d3e84ded0d12c192d165ec1d0c59d9b9ccd79c44 100644 GIT binary patch delta 107 zcmZqp!`SeLaY6@6oY2u_8+(343+$6&)=u`>>)oQiDQ&eyeczlo$^&7TtNz?@oSD z6d`;7A0V>#a7b*x;9qXL5XU#>Wf(Kl>)1GZsEV<7K E0A~L+FaQ7m diff --git a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll index 596e6615823acc8a36e8c1069b1c6a94bd3bdaa8..c2c69a6ac49e2e858598727e6e789fdd0ab97866 100644 GIT binary patch delta 105 zcmZp$Xt0>j!O~vR{&-{04_<-LMa3r5&YW_a?4z|P&XP59^Ax@_j4TJ0ZakTsA`l?Z z7hj!Qx-g^lW3#4_<-1NXDFR_w7BmGK3ypHC=V#<|%w<7+K_YZk;|kMIb<+ zQ|Z6@>-qrK89Utc_OSE>3241fOm0{{*?I2n)t}qE%wm^2$yT(^X_x&niGg7lcDaf$AAHMKsTj SXvi`0DRGnDE-1_To&x~bEH0t| diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.LsClient.dll b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.LsClient.dll index b83b8cd47380ec7d33ce49c5c1aad55d07cf74e7..6bd3948160ec9f6f36e006a8504069266ec62f7e 100644 GIT binary patch delta 107 zcmZqp!`SeLaY6^n;i-NTHuiMH2*}wutXgxM$8*Y;*k=Eb2fH_`#QKP_B)7kPHo2rY zK!BrTTjjM`3~tk_zcZVh6OfvGrTC-*R4_~&DhO1aX8uv6>9*JGRYzRqv^Vc9apnX7 DN#HOE delta 107 zcmZqp!`SeLaY6^nrnaRsHuiMH2$USwDcczS(rpRn8#d)jU22j!E##Mc-F?A3O)g&Q!@%VzjgSmURJavTU0l3vk3nVMiyT=*Y3#|1OfyC zeu!JIYxeS7(`@~TXNjEZWCOvg3Q$4LH&8*KYHmqatM~KdXUzB6J(X>j!D7G3?A6Ae3O<2lRSh0>e;)d`$4*e(FTng{vk3nVMi#Z@YyMBZAP^uR z-SXRhfAm_f^_Royoeg;<-ddyb#OAESbgj**Lbo{qeoih; diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdminClient.dll b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdminClient.dll index 4f3958cf0263831beaf74737efe5e0426032b4ef..f3a4acb8a32ae6d8388f044cefd12b880de8c8ea 100644 GIT binary patch delta 123 zcmZp;AkuI_WI_i^F6+;=jXkYBjIBLPtv$?JdssSx1q7C^KN93x;IvczoZigm%PY34 zgs{vx!J>L{*No{$WLN_P0+voK(cZb*r>VC5LWG@n-gFgN)~gCo(LYX5QIPty-+`42 SUz`1Q+o^eRyQCcJb4~yl(Kj#v delta 123 zcmZp;AkuI_WI_i^*6*_y8hcuM7+ZUoT6>tc_ONsW3v`^8u#$*~be*ZG@3@Y=*kHR# z2+N!kEJ0NX6Q&=LVGR)YG5^=h`UGpQRd2qWI@!=FJ6%PV^{N6?lq(A=3RExP`|`~7 TaslOMVU7ig+a={#pK}5L5B@f3 diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/LookupServiceClient.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/LookupServiceClient.cs index fb32c29..d97b0a4 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/LookupServiceClient.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/LookupServiceClient.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections; using System.Collections.Generic; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/AcceptAllX509CertificateValidator.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/AcceptAllX509CertificateValidator.cs index 83a2b4b..41336f7 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/AcceptAllX509CertificateValidator.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/AcceptAllX509CertificateValidator.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.IdentityModel.Selectors; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/StringToSecureStringArgumentTransformationAttribute.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/StringToSecureStringArgumentTransformationAttribute.cs index dcd0d4f..d7cc606 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/StringToSecureStringArgumentTransformationAttribute.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/StringToSecureStringArgumentTransformationAttribute.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/StringToSsoAdminServerArgumentTransformationAttribute.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/StringToSsoAdminServerArgumentTransformationAttribute.cs index 545c143..cfa6335 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/StringToSsoAdminServerArgumentTransformationAttribute.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/StringToSsoAdminServerArgumentTransformationAttribute.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; @@ -29,13 +30,13 @@ namespace VMware.vSphere.SsoAdmin.Utils var obnMatchingServers = new List(); var ssoAdminServerVariable = engineIntrinsics.SessionState.PSVariable.GetValue("DefaultSsoAdminServers"); - + if (ssoAdminServerVariable is PSObject ssoAdminServersPsObj && ssoAdminServersPsObj.BaseObject is List connectedServers) { foreach (var server in connectedServers) { if (!string.IsNullOrEmpty(Regex.Match(server.ToString(), csharpObnValue)?.Value)) { obnMatchingServers.Add(server); - } + } } } @@ -45,9 +46,9 @@ namespace VMware.vSphere.SsoAdmin.Utils // Non-terminating error for not matching value engineIntrinsics.Host.UI.WriteErrorLine($"'{obnValue}' doesn't match any objects in $global:DefaultSsoAdminServers variable"); } - + } - + return result; } } diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient.Tests/IntegrationTests.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient.Tests/IntegrationTests.cs index ff6f1d8..40941ab 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient.Tests/IntegrationTests.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient.Tests/IntegrationTests.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using NUnit.Framework; using System.Linq; using System.Security; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/ActiveDirectoryIdentitySource.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/ActiveDirectoryIdentitySource.cs index cb01a3c..c700f17 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/ActiveDirectoryIdentitySource.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/ActiveDirectoryIdentitySource.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/Group.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/Group.cs index 9a0d469..e84e084 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/Group.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/Group.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; using System.Linq; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/IdentitySource.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/IdentitySource.cs index 745590a..ca330ab 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/IdentitySource.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/IdentitySource.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/LocalOSIdentitySource.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/LocalOSIdentitySource.cs index f595392..4ee09a9 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/LocalOSIdentitySource.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/LocalOSIdentitySource.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; using System.Linq; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/LockoutPolicy.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/LockoutPolicy.cs index 0dc22b6..15f55e7 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/LockoutPolicy.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/LockoutPolicy.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PasswordPolicy.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PasswordPolicy.cs index e5e3132..b1e154e 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PasswordPolicy.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PasswordPolicy.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PersonUser.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PersonUser.cs index 35e9522..2f40523 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PersonUser.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PersonUser.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; using System.Linq; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/SsoAdminServer.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/SsoAdminServer.cs index 02bd4ca..4e2a958 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/SsoAdminServer.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/SsoAdminServer.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; @@ -17,9 +18,9 @@ namespace VMware.vSphere.SsoAdminClient.DataTypes private SsoAdminClient _client; - public SsoAdminServer(string hostname, - string user, - SecureString password, + public SsoAdminServer(string hostname, + string user, + SecureString password, X509CertificateValidator serverCertificateValidator) { Name = hostname; @@ -56,7 +57,7 @@ namespace VMware.vSphere.SsoAdminClient.DataTypes public void Disconnect() { if (--RefCount == 0) { _client = null; - } + } } public override string ToString() { diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/SystemIdentitySource.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/SystemIdentitySource.cs index 01ee93c..8294cc5 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/SystemIdentitySource.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/SystemIdentitySource.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/TokenLifetime.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/TokenLifetime.cs index f572c74..00747e2 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/TokenLifetime.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/TokenLifetime.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs index 8f4ccfa..afc4f80 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/UserPassSecurityContext.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/UserPassSecurityContext.cs index 6e5bce4..66378cf 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/UserPassSecurityContext.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/UserPassSecurityContext.cs @@ -1,6 +1,7 @@ -// ************************************************************************** -// Copyright 2020 VMware, Inc. -// ************************************************************************** +/* +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +*/ using System; using System.Collections.Generic; using System.IdentityModel.Selectors; @@ -21,9 +22,9 @@ namespace VMware.vSphere.SsoAdminClient private VmwareSecruityTokenService _stsClient; private SamlSecurityToken _validToken; public UserPassSecurityContext( - string user, - SecureString password, - Uri stsUri, + string user, + SecureString password, + Uri stsUri, X509CertificateValidator serverCertificateValidator) { if (user == null) throw new ArgumentNullException(nameof(user)); diff --git a/Modules/VMware.vSphere.SsoAdmin/src/build.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/build.ps1 index b7a5816..1320144 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/build.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/build.ps1 @@ -1,7 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** - +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [string] $TestVc, diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/ConnectDisconnect.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/ConnectDisconnect.Tests.ps1 index 222c610..39b41a7 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/ConnectDisconnect.Tests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/ConnectDisconnect.Tests.ps1 @@ -1,7 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** - +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [Parameter(Mandatory = $true)] [string] diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/Group.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/Group.Tests.ps1 index 311673a..4573af2 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/Group.Tests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/Group.Tests.ps1 @@ -1,6 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [Parameter(Mandatory = $true)] diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/IdentitySource.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/IdentitySource.Tests.ps1 index 6b858a3..04f158c 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/IdentitySource.Tests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/IdentitySource.Tests.ps1 @@ -1,6 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [Parameter(Mandatory = $true)] diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/LockoutPolicy.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/LockoutPolicy.Tests.ps1 index d96d4a9..6ae14a1 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/LockoutPolicy.Tests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/LockoutPolicy.Tests.ps1 @@ -1,6 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [Parameter(Mandatory = $true)] diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1 index edd8b69..ffbb9d9 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1 @@ -1,6 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [Parameter(Mandatory = $true)] diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/PasswordPolicy.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/PasswordPolicy.Tests.ps1 index 9c5ecc1..1fdd76d 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/PasswordPolicy.Tests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/PasswordPolicy.Tests.ps1 @@ -1,6 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [Parameter(Mandatory = $true)] diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1 index 22127b6..a7ef571 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1 @@ -1,6 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [Parameter(Mandatory = $true)] diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1 index cf996a0..2ffedf9 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1 @@ -1,6 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [Parameter(Mandatory = $true)] diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/TokenLifetime.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/TokenLifetime.Tests.ps1 index 843534e..581989d 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/TokenLifetime.Tests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/TokenLifetime.Tests.ps1 @@ -1,6 +1,7 @@ -# ************************************************************************** -# Copyright 2020 VMware, Inc. -# ************************************************************************** +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> param( [Parameter(Mandatory = $true)] diff --git a/Modules/Validate-ESXiPackages/Validate-ESXiPackages.psm1 b/Modules/Validate-ESXiPackages/Validate-ESXiPackages.psm1 index ccf5d85..81e0120 100644 --- a/Modules/Validate-ESXiPackages/Validate-ESXiPackages.psm1 +++ b/Modules/Validate-ESXiPackages/Validate-ESXiPackages.psm1 @@ -1,4 +1,9 @@ -function Validate-ESXiPackages { +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +function Validate-ESXiPackages { <# .DESCRIPTION Compares all ESXi Host VIBs within a vSphere with a reference Hosts. @@ -28,9 +33,9 @@ .PARAMETER RefernceHost The VIB Reference ESXi Host #> - + [CmdletBinding()] - param( + param( [Parameter(Mandatory=$True, ValueFromPipeline=$True, HelpMessage="vSphere Cluster to verify")] [ValidateNotNullorEmpty()] [VMware.VimAutomation.ViCore.Impl.V1.Inventory.ComputeResourceImpl] $Cluster, @@ -38,24 +43,24 @@ [ValidateNotNullorEmpty()] [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl] $RefernceHost ) - + Process { - + #region: Get reference VIBs $EsxCli2 = Get-ESXCLI -VMHost $RefernceHost -V2 $RefernceVibList = $esxcli2.software.vib.list.invoke() #endregion - + #region: Compare reference VIBs - $MyView = @() + $MyView = @() foreach ($VmHost in ($Cluster | Get-VMHost)) { - + $EsxCli2 = Get-ESXCLI -VMHost $VmHost -V2 $VibList = $esxcli2.software.vib.list.invoke() [Array]$VibDiff = Compare-Object -ReferenceObject $RefernceVibList.ID -DifferenceObject $VibList.ID if($VibDiff.Count -gt 0) { - $VibDiffSideIndicator = @() + $VibDiffSideIndicator = @() foreach ($Item in $VibDiff) { $VibDiffSideIndicator += $($Item.SideIndicator + " " + $Item.InputObject) } @@ -73,7 +78,7 @@ VibDiffSideIndicator = $VibDiffSideIndicator } $MyView += $Report - + } #region: Compare reference VIBs diff --git a/Modules/apply-hardening/apply-hardening.psm1 b/Modules/apply-hardening/apply-hardening.psm1 index 94b1279..68829f8 100644 --- a/Modules/apply-hardening/apply-hardening.psm1 +++ b/Modules/apply-hardening/apply-hardening.psm1 @@ -1,16 +1,16 @@ function Apply-Hardening { -<# +<# .NOTES =========================================================================== Created by: Markus Kraus Twitter: @VMarkus_K Private Blog: mycloudrevolution.com =========================================================================== - Changelog: - 2016.11 ver 2.0 Base Release + Changelog: + 2016.11 ver 2.0 Base Release =========================================================================== - External Code Sources: - + External Code Sources: + =========================================================================== Tested Against Environment: vSphere Version: 5.5 U2 @@ -24,14 +24,14 @@ function Apply-Hardening { Applys a set of Hardening options to your VMs .Example - Get-VM TST* | Apply-Hardening + Get-VM TST* | Apply-Hardening .Example $SampleVMs = Get-VM "TST*" Apply-Hardening -VMs $SampleVMs .PARAMETER VMs - Specify the VMs + Specify the VMs #Requires PS -Version 4.0 @@ -39,7 +39,7 @@ function Apply-Hardening { #> [CmdletBinding()] -param( +param( [Parameter(Mandatory=$true, ValueFromPipeline=$True, Position=0)] @@ -47,7 +47,7 @@ param( $VMs ) -Process { +Process { #region: Create Options $ExtraOptions = @{ "isolation.tools.diskShrink.disable"="true"; @@ -55,20 +55,20 @@ Process { "isolation.tools.copy.disable"="true"; "isolation.tools.paste.disable"="true"; "isolation.tools.dnd.disable"="true"; - "isolation.tools.setGUIOptions.enable"="false"; + "isolation.tools.setGUIOptions.enable"="false"; "log.keepOld"="10"; "log.rotateSize"="100000" "RemoteDisplay.maxConnections"="2"; - "RemoteDisplay.vnc.enabled"="false"; - + "RemoteDisplay.vnc.enabled"="false"; + } if ($DebugPreference -eq "Inquire") { Write-Output "VM Hardening Options:" $ExtraOptions | Format-Table -AutoSize } - + $VMConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec - + Foreach ($Option in $ExtraOptions.GetEnumerator()) { $OptionValue = New-Object VMware.Vim.optionvalue $OptionValue.Key = $Option.Key diff --git a/Modules/rCisTag/Examples/01-Get.ps1 b/Modules/rCisTag/Examples/01-Get.ps1 index 52cf4de..66cbaa6 100644 --- a/Modules/rCisTag/Examples/01-Get.ps1 +++ b/Modules/rCisTag/Examples/01-Get.ps1 @@ -1,4 +1,9 @@ -# Fetch Cis Server hostname and credentials +<# +Copyright 2016-2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# Fetch Cis Server hostname and credentials .\CisConfig.ps1 @@ -14,4 +19,3 @@ Get-rCisTagCategory Get-rCisTagAssignment Disconnect-rCisServer -Server $cisServer -Confirm:$false - \ No newline at end of file diff --git a/Modules/rCisTag/Examples/02-New.ps1 b/Modules/rCisTag/Examples/02-New.ps1 index 7fe9af2..a70bc77 100644 --- a/Modules/rCisTag/Examples/02-New.ps1 +++ b/Modules/rCisTag/Examples/02-New.ps1 @@ -1,4 +1,9 @@ -# Fetch Cis Server hostname and credentials +<# +Copyright 2016-2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# Fetch Cis Server hostname and credentials .\CisConfig.ps1 Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd @@ -11,4 +16,3 @@ New-rCisTagAssignment -Entity $vm -Tag MyTag1 Get-rCisTagAssignment -Tag MyTag1 Disconnect-rCisServer -Server $cisServer -Confirm:$false - \ No newline at end of file diff --git a/Modules/rCisTag/Examples/03-Set.ps1 b/Modules/rCisTag/Examples/03-Set.ps1 index 35d26b0..152a60e 100644 --- a/Modules/rCisTag/Examples/03-Set.ps1 +++ b/Modules/rCisTag/Examples/03-Set.ps1 @@ -1,4 +1,9 @@ -# Fetch Cis Server hostname and credentials +<# +Copyright 2016-2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# Fetch Cis Server hostname and credentials .\CisConfig.ps1 Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd @@ -8,4 +13,3 @@ Get-rCisTag -Name MyTag1 | Set-rCisTag -Name MyNewTag1 -Description 'Name change Get-rCisTagCategory -Name MyCat1 | Set-rCisTagCategory -Cardinality Multiple -Name MyNewCat1 -Description 'Name changed' Disconnect-rCisServer -Server $cisServer -Confirm:$false - \ No newline at end of file diff --git a/Modules/rCisTag/Examples/04-Remove.ps1 b/Modules/rCisTag/Examples/04-Remove.ps1 index 2f684f9..84edc14 100644 --- a/Modules/rCisTag/Examples/04-Remove.ps1 +++ b/Modules/rCisTag/Examples/04-Remove.ps1 @@ -1,4 +1,9 @@ -# Fetch Cis Server hostname and credentials +<# +Copyright 2016-2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# Fetch Cis Server hostname and credentials .\CisConfig.ps1 Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd @@ -10,4 +15,3 @@ Get-rCisTag -Name MyNewTag1 | Remove-rCisTag -Confirm:$false Get-rCisTagCategory -Name MyNewCat1 | Remove-rCisTagCategory -Confirm:$false Disconnect-rCisServer -Server $cisServer -Confirm:$false - \ No newline at end of file diff --git a/Modules/rCisTag/Examples/05-Tag-Datastore.ps1 b/Modules/rCisTag/Examples/05-Tag-Datastore.ps1 index f0ad343..fa3e134 100644 --- a/Modules/rCisTag/Examples/05-Tag-Datastore.ps1 +++ b/Modules/rCisTag/Examples/05-Tag-Datastore.ps1 @@ -1,4 +1,9 @@ -# Fetch Cis Server hostname and credentials +<# +Copyright 2016-2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +# Fetch Cis Server hostname and credentials .\CisConfig.ps1 Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd @@ -17,4 +22,3 @@ Get-Cluster -Name Cluster1 | Get-Datastore | %{ } Disconnect-rCisServer -Server $cisServer -Confirm:$false - \ No newline at end of file diff --git a/Modules/rCisTag/Examples/CisConfig.ps1 b/Modules/rCisTag/Examples/CisConfig.ps1 index de72021..fd53e92 100644 --- a/Modules/rCisTag/Examples/CisConfig.ps1 +++ b/Modules/rCisTag/Examples/CisConfig.ps1 @@ -1,3 +1,8 @@ -$cisServer = 'vcsa.my.domain' +<# +Copyright 2016-2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +$cisServer = 'vcsa.my.domain' $cisUser = 'administrator@vsphere.local' $cisPswd = 'VMware1!' diff --git a/Modules/vCenter.Alarms/New-vCenterAlarms.ps1 b/Modules/vCenter.Alarms/New-vCenterAlarms.ps1 index e3ba5c8..3e2ea13 100644 --- a/Modules/vCenter.Alarms/New-vCenterAlarms.ps1 +++ b/Modules/vCenter.Alarms/New-vCenterAlarms.ps1 @@ -1,10 +1,15 @@ -<# - +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +<# + =========================================================================== Created by: Jason Robinson Created on: 05/2017 Twitter: @jrob24 - Filename: New-vCenterAlarms.ps1 + Filename: New-vCenterAlarms.ps1 =========================================================================== .DESCRIPTION Examples of creating alarms using vCenter.Alarm module diff --git a/Modules/vCenter.Alarms/vCenter.Alarms.psm1 b/Modules/vCenter.Alarms/vCenter.Alarms.psm1 index 5f13f3f..75130dd 100644 --- a/Modules/vCenter.Alarms/vCenter.Alarms.psm1 +++ b/Modules/vCenter.Alarms/vCenter.Alarms.psm1 @@ -1,4 +1,9 @@ -<# +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +<# =========================================================================== Created by: Jason Robinson Created on: 05/2017 @@ -23,7 +28,7 @@ function New-AlarmDefinition { This cmdlet creates a new alarm defintion on the specified entity in vCenter. An alarm trigger is required in order to create a new alarm definition. They can be created by using the New-AlarmTrigger cmdlet. - + After the alarm definition is created, if alarm actions are required use the cmdlet New-AlarmAction to create actions for the alarm. .PARAMETER Name @@ -40,7 +45,7 @@ function New-AlarmDefinition { information about triggers, run Get-Help New-AlarmTrigger. .PARAMETER Enabled Specifies if the alarm is enabled when it is created. If unset, the - default value is true. + default value is true. .PARAMETER ActionRepeatMinutes Specifies the frequency how often the actions should repeat when an alarm does not change state. @@ -48,16 +53,16 @@ function New-AlarmDefinition { Specifies how often the alarm is triggered, measured in minutes. A zero value means the alarm is allowed to trigger as often as possible. A nonzero value means that any subsequent triggers are suppressed for a - period of minutes following a reported trigger. - - If unset, the default value is 0. Allowed range is 0 - 60. + period of minutes following a reported trigger. + + If unset, the default value is 0. Allowed range is 0 - 60. .PARAMETER ToleranceRange Specifies the tolerance range for the metric triggers, measure in percentage. A zero value means that the alarm triggers whenever the metric value is above or below the specified value. A nonzero means that the alarm triggers only after reaching a certain percentage above or below the nominal trigger value. - + If unset, the default value is 0. Allowed range is 0 - 100. .PARAMETER Server Specifies the vCenter Server system on which you want to run the cmdlet. @@ -77,7 +82,7 @@ function New-AlarmDefinition { Type Value ---- ----- Alarm alarm-1801 - + This will create a host connection state alarm trigger and store it in the variable $trigger. Then it will create a new alarm 'Host Connection' on the root level of vCenter and set the action to repeat every 10 mins. @@ -88,27 +93,27 @@ function New-AlarmDefinition { [ValidateNotNullOrEmpty()] [Alias('AlarmName')] [string]$Name, - + [string]$Description, - + [Parameter(Mandatory = $true)] [string]$Entity, - + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [VMware.Vim.AlarmExpression[]]$Trigger, - + [boolean]$Enabled = $true, - + [ValidateRange(0, 60)] [int32]$ActionRepeatMinutes, - + [ValidateRange(0, 60)] [int32]$ReportingFrequency = 0, - + [ValidateRange(0, 100)] [int32]$ToleranceRange = 0, - + [string]$Server ) BEGIN { @@ -129,7 +134,7 @@ function New-AlarmDefinition { $Object = Get-Inventory -Name $PSBoundParameters['Entity'] -ErrorAction Stop -Server $global:DefaultVIServer $AlarmMgr = Get-View AlarmManager -ErrorAction Stop -Server $global:DefaultVIServer } - + if ($PSCmdlet.ShouldProcess($global:DefaultVIServer, "Create alarm $($PSBoundParameters['Name'])")) { $Alarm = New-Object -TypeName VMware.Vim.AlarmSpec $Alarm.Name = $PSBoundParameters['Name'] @@ -158,12 +163,12 @@ function New-AlarmAction { This cmdlet differs from the VMware PowerCLI New-AlarmAction cmdlet as it will create the transitions of the alarm state. It requires an alarm action and at least one transition to be specified. - + The transition indicates when the action executes and if it repeats. There are only four acceptable transitions: green to yellow, yellow to red, red to yellow, and yellow to green. At least one pair must be specified or the results will be an invalid. - + If an alarm action already exists on the alarm definition, it will be overwritten if the same alarm action is specified. For example if the alarm definition already has an alarm action of Snmp on the transition @@ -171,7 +176,7 @@ function New-AlarmAction { Snmp on the transition of yellow to red, it will overwrite the existing action and transition. The end result will be one Snmp action on the transition of yellow to red. If you want the old to transition to remain - both should be specified during the usage of the cmdlet. + both should be specified during the usage of the cmdlet. .PARAMETER AlarmDefinition Specifies the alarm definition for which you want to configure actions. The alarm definition can be retreived by using the Get-AlarmDefinition @@ -209,18 +214,18 @@ function New-AlarmAction { remain unset. .NOTES This cmdlet requires a connection to vCenter to create the alarm action. - + When using this cmdlet specify the Module-Qualified cmdlet name to avoid using the New-AlarmAction cmdlet with VMware PowerCLI. .EXAMPLE PS C:\> vCenter.Alarms\New-AlarmAction -AlarmDefinition (Get-AlarmDefintion "Host CPU Usage") -Snmp -YellowToRed Repeat - + This will create an Snmp alarm action on the "Host CPU Usage" alarm transition of yellow to red. The alarm action will also repeat, as per the action frequency defined on the alarm. .EXAMPLE PS C:\> Get-AlarmDefintion "Cluster HA Status" | vCenter.Alarms\New-AlarmAction -Email -To helpdesk@company.com -GreenToYellow Once -YellowToRed Once - + This will create an Email alarm action on the "Cluster HA Status" alarm transition of green to yellow and yellow to red. The alarm action will send an email to helpdesk@company.com one time per transition. @@ -229,38 +234,38 @@ function New-AlarmAction { param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true)] [VMware.VimAutomation.ViCore.Types.V1.Alarm.AlarmDefinition]$AlarmDefinition, - + [Parameter(Mandatory = $true, ParameterSetName = 'Snmp')] [switch]$Snmp, - + [Parameter(Mandatory = $true, ParameterSetName = 'Email')] [switch]$Email, - + [Parameter(Mandatory = $true, ParameterSetName = 'Email')] [string[]]$To, - + [Parameter(ParameterSetName = 'Email')] [string[]]$Cc, - + [Parameter(ParameterSetName = 'Email')] [string]$Subject, - + [Parameter(ParameterSetName = 'Email')] [string]$Body, - + [ValidateSet('Once', 'Repeat')] [string]$GreenToYellow, - + [ValidateSet('Once', 'Repeat')] [string]$YellowToRed, - + [ValidateSet('Once', 'Repeat')] [string]$RedToYellow, - + [ValidateSet('Once', 'Repeat')] [string]$YellowToGreen ) - + BEGIN { } PROCESS { @@ -273,7 +278,7 @@ function New-AlarmAction { $Alarm.ActionFrequency = $AlarmView.Info.ActionFrequency $Alarm.Action = New-Object VMware.Vim.GroupAlarmAction $Trigger = New-Object VMware.Vim.AlarmTriggeringAction - + Write-Verbose -Message "Defining alarm actions" if ($PSCmdlet.ParameterSetName -eq 'Snmp') { $Trigger.Action = New-Object -TypeName VMware.Vim.SendSNMPAction @@ -292,7 +297,7 @@ function New-AlarmAction { $Trigger.Action.Subject = $PSBoundParameters['Subject'] $Trigger.Action.Body = $PSBoundParameters['Body'] } - + Write-Verbose -Message "Defining alarm transitions" if ($PSBoundParameters.ContainsKey('GreenToYellow')) { $Trans1 = New-Object -TypeName VMware.Vim.AlarmTriggeringActionTransitionSpec @@ -303,7 +308,7 @@ function New-AlarmAction { } $Trigger.TransitionSpecs += $Trans1 } - + if ($PSBoundParameters.ContainsKey('YellowToRed')) { $Trans2 = New-Object -TypeName VMware.Vim.AlarmTriggeringActionTransitionSpec $Trans2.StartState = 'yellow' @@ -315,7 +320,7 @@ function New-AlarmAction { } $Trigger.TransitionSpecs += $Trans2 } - + if ($PSBoundParameters.ContainsKey('RedToYellow')) { $Trans3 = New-Object -TypeName VMware.Vim.AlarmTriggeringActionTransitionSpec $Trans3.StartState = 'red' @@ -327,7 +332,7 @@ function New-AlarmAction { } $Trigger.TransitionSpecs += $Trans3 } - + if ($PSBoundParameters.ContainsKey('YellowToGreen')) { $Trans4 = New-Object -TypeName VMware.Vim.AlarmTriggeringActionTransitionSpec $Trans4.StartState = 'yellow' @@ -339,7 +344,7 @@ function New-AlarmAction { } $Trigger.TransitionSpecs += $Trans4 } - + $Alarm.Action.Action += $Trigger $Alarm.Expression = New-Object -TypeName VMware.Vim.OrAlarmExpression $Alarm.Expression.Expression += $AlarmView.Info.Expression.Expression @@ -408,40 +413,40 @@ function New-AlarmTrigger { .PARAMETER ObjectType Specifies the type of object on which the event is logged, the object type containing the state condition or the type of object containing the - metric. - + metric. + When creating a state alarm trigger the only acceptable values are 'HostSystem' or 'VirtualMachine'. The supported state types for each object are as follows: VirtualMachine type: runtime.powerState or summary.quickStats.guestHeartbeatStatus HostSystem type: runtime.connectionState .OUTPUTS - (Event|State|Metric)AlarmExpression + (Event|State|Metric)AlarmExpression .NOTES - This cmdlet requires the PowerCLI module to be imported. + This cmdlet requires the PowerCLI module to be imported. .LINK Event Alarm Trigger http://pubs.vmware.com/vsphere-6-0/topic/com.vmware.wssdk.apiref.doc/vim.alarm.EventAlarmExpression.html - + State Alarm Trigger http://pubs.vmware.com/vsphere-6-0/topic/com.vmware.wssdk.apiref.doc/vim.alarm.StateAlarmExpression.html - + Metric Alarm Trigger http://pubs.vmware.com/vsphere-6-0/topic/com.vmware.wssdk.apiref.doc/vim.alarm.MetricAlarmExpression.html .EXAMPLE PS C:\> New-AlarmTrigger -EventType "DasDisabledEvent" -Status Red -ObjectType ClusterComputeResource - + Comparisons : EventType : DasDisabledEvent ObjectType : ClusterComputeResource Status : red - + Creates an event trigger on 'DasDisabledEvent' (HA Disabled) with a status on 'Red'. The object type is a ClusterComputerResource because this event occurs at a cluster level. .EXAMPLE PS C:\> New-AlarmTrigger -MetricId (Get-MetricId | Where Name -EQ 'cpu.usage.average').Key -Operator isAbove -Yellow 90 -YellowInterval 30 -Red 98 -RedInterval 15 -ObjectType HostSytem - + Operator : isAbove Type : HostSytem Metric : VMware.Vim.PerfMetricId @@ -449,7 +454,7 @@ function New-AlarmTrigger { YellowInterval : 30 Red : 9800 RedInterval : 15 - + Creates a trigger on the 'cpu.usage.average' metric where the warning condition must be above 90% for 30mins and the alert condition must be above 98% for 15mins. The object type is a HostSystem. @@ -461,7 +466,7 @@ function New-AlarmTrigger { StatePath : runtime.connectionState Yellow : Disconnected Red : notResponding - + Creates a trigger on the 'runtime.connectionState' condition where the warning condition is 'disconnected' and the alert condition is 'notResponding'. The object type is a HostSystem. @@ -470,51 +475,51 @@ function New-AlarmTrigger { param ( [Parameter(Mandatory = $true, ParameterSetName = 'Event')] [string]$EventType, - + [Parameter(ParameterSetName = 'Event')] [string]$EventTypeId, - + [Parameter(Mandatory = $true, ParameterSetName = 'Event')] [ValidateSet('Green', 'Yellow', 'Red')] [string]$Status, - + [Parameter(Mandatory = $true, ParameterSetName = 'State')] [ValidateSet('runtime.powerState', 'summary.quickStats.guestHeartbeatStatus', 'runtime.connectionState')] [string]$StateType, - + [Parameter(Mandatory = $true, ParameterSetName = 'State')] [VMware.Vim.StateAlarmOperator]$StateOperator, - + [Parameter(ParameterSetName = 'State')] [ValidateSet('disconnected', 'notResponding', 'connected', 'noHeartbeat', 'intermittentHeartbeat', 'poweredOn', 'poweredOff', 'suspended')] [string]$YellowStateCondition, - + [Parameter(ParameterSetName = 'State')] [ValidateSet('disconnected', 'notResponding', 'connected', 'noHeartbeat', 'intermittentHeartbeat', 'poweredOn', 'poweredOff', 'suspended')] [string]$RedStateCondition, - + [Parameter(Mandatory = $true, ParameterSetName = 'Metric')] [string]$MetricId, - + [Parameter(Mandatory = $true, ParameterSetName = 'Metric')] [VMware.Vim.MetricAlarmOperator]$MetricOperator, - + [Parameter(ParameterSetName = 'Metric')] [ValidateRange(1, 100)] [int32]$Yellow, - + [Parameter(ParameterSetName = 'Metric')] [ValidateRange(1, 90)] [int32]$YellowInterval, - + [Parameter(ParameterSetName = 'Metric')] [ValidateRange(1, 100)] [int32]$Red, - + [Parameter(ParameterSetName = 'Metric')] [ValidateRange(1, 90)] [int32]$RedInterval, - + [Parameter(Mandatory = $true)] [ValidateSet('ClusterComputeResource', 'Datacenter', 'Datastore', 'DistributedVirtualSwitch', 'HostSystem', 'Network', 'ResourcePool', 'VirtualMachine')] [string]$ObjectType @@ -547,7 +552,7 @@ function New-AlarmTrigger { $Expression.Operator = $PSBoundParameters['StateOperator'] $Expression.Type = $PSBoundParameters['ObjectType'] $Expression.StatePath = $PSBoundParameters['StateType'] - + if ($PSBoundParameters.ContainsKey('RedStateCondition')) { if ($PSBoundParameters['RedStateCondition'] -eq 'intermittentHeartbeat') { $Expression.Red = 'yellow' @@ -557,7 +562,7 @@ function New-AlarmTrigger { $Expression.Red = $PSBoundParameters['RedStateCondition'] } } - + if ($PSBoundParameters.ContainsKey('YellowStateCondition')) { if ($PSBoundParameters['YellowStateCondition'] -eq 'intermittentHeartbeat') { $Expression.Yellow = 'yellow' @@ -583,13 +588,13 @@ function Get-MetricId { This cmdlet collects all of the available metrics from vCenter. It will provide the metric name, key, stats level, and summary of the metric. The information can be used to identify the available metrics on vCenter - as well as gathering the metric key needed for configuring an alarm. - - The metric keys are unique across vCenters. If you are connected to + as well as gathering the metric key needed for configuring an alarm. + + The metric keys are unique across vCenters. If you are connected to more than one vCenter metrics from each vCenter will be generated. A vCenter property is available to help determine the correct metric key on a given vCenter. This is extrememly useful when trying to create - a metric based vCenter alarm. + a metric based vCenter alarm. .PARAMETER MetricGroup Specifies the name of the metric group you would like to see. Allowed values are 'CPU', 'Mem', 'Disk', 'Net', and 'Datastore'. @@ -618,7 +623,7 @@ function Get-MetricId { Summary : Memory usage as percentage of total configured or available memory vCenter : vCenter01 ..... - + Collects all of the available memory metrics on the connected vCenter. #> [CmdletBinding()] @@ -626,7 +631,7 @@ function Get-MetricId { [ValidateSet('CPU', 'Mem', 'Disk', 'Net', 'Datastore')] [string]$MetricGroup ) - + foreach ($Mgr in (Get-View PerformanceManager-PerfMgr)) { $vCenter = $Mgr.Client.ServiceUrl.Split('/')[2] if ($PSBoundParameters.ContainsKey('MetricGroup')) { @@ -636,7 +641,7 @@ function Get-MetricId { } else { $Metrics += $Mgr.PerfCounter } - + $Metrics | ForEach-Object -Process { [pscustomobject] @{ Name = $_.GroupInfo.Key + "." + $_.NameInfo.key + "." + $_.RollupType @@ -659,12 +664,12 @@ function Get-EventId { description, and summary of the event. The information can be used to identify the available events on vCenter as well as gathering the event type and event type id (if applicable) required for configuring an alarm. - + If the event type is 'EventEx' or 'ExtendedEvent' both the event type and event type id will be required to create a new event based vCenter alarm. - - The event types can be unique across vCenters. If you are connected to + + The event types can be unique across vCenters. If you are connected to more than one vCenter events from each vCenter will be generated. A vCenter property is available to help determine the correct event type on a given vCenter. This is extrememly useful when trying to create @@ -678,7 +683,7 @@ function Get-EventId { This cmdlet requires a connection to vCenter to collect event data. .EXAMPLE PS C:\> Get-EventId -Category Error - + EventType : ExtendedEvent EventTypeId : ad.event.ImportCertFailedEvent Category : error @@ -705,7 +710,7 @@ function Get-EventId { param ( [VMware.Vim.EventCategory]$Category ) - + foreach ($Mgr in (Get-View EventManager)) { $vCenter = $Mgr.Client.ServiceUrl.Split('/')[2] if ($PSBoundParameters.ContainsKey('Category')) { @@ -715,7 +720,7 @@ function Get-EventId { } else { $Events += $Mgr.Description.EventInfo } - + $Events | ForEach-Object -Process { $Hash = [ordered]@{} $Hash.Add('EventType', $_.Key) diff --git a/Modules/vCenterCEIP/vCenterCEIP.psm1 b/Modules/vCenterCEIP/vCenterCEIP.psm1 index 3d5e903..9bfb894 100755 --- a/Modules/vCenterCEIP/vCenterCEIP.psm1 +++ b/Modules/vCenterCEIP/vCenterCEIP.psm1 @@ -1,4 +1,9 @@ -Function Get-VCenterCEIP { +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +Function Get-VCenterCEIP { <# .NOTES =========================================================================== diff --git a/Modules/vCenterManualMigration/vCenterManualMigration.psm1 b/Modules/vCenterManualMigration/vCenterManualMigration.psm1 index a7750b9..bdfcefb 100644 --- a/Modules/vCenterManualMigration/vCenterManualMigration.psm1 +++ b/Modules/vCenterManualMigration/vCenterManualMigration.psm1 @@ -1,4 +1,8 @@ -Function Export-DRSRules { +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> +Function Export-DRSRules { <# .NOTES =========================================================================== diff --git a/NOTICE.txt b/NOTICE.txt new file mode 100644 index 0000000..4caedc6 --- /dev/null +++ b/NOTICE.txt @@ -0,0 +1,3 @@ +Copyright (c) 2021 VMware, Inc. All Rights Reserved. + +This product is licensed to you under the BSD-2-Clause License. You may not use this product except in compliance with the License. diff --git a/Scripts/AutomaticVMFSUnmap.ps1 b/Scripts/AutomaticVMFSUnmap.ps1 index 2f32617..1aff2a4 100755 --- a/Scripts/AutomaticVMFSUnmap.ps1 +++ b/Scripts/AutomaticVMFSUnmap.ps1 @@ -1,4 +1,9 @@ <# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +<# .SYNOPSIS Retrieve the current VMFS Unmap priority for VMFS 6 datastore .NOTES Author: William Lam .NOTES Site: www.virtuallyghetto.com diff --git a/Scripts/Check-VMwareTools.ps1 b/Scripts/Check-VMwareTools.ps1 index 70bd552..914f725 100644 --- a/Scripts/Check-VMwareTools.ps1 +++ b/Scripts/Check-VMwareTools.ps1 @@ -1,5 +1,9 @@ -function Check-Tools { -<# +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> +function Check-Tools { +<# .NOTES =========================================================================== Created by: Brian Graf @@ -18,14 +22,14 @@ Check-Tools -VMs $SampleVMs #> [CmdletBinding()] - param( + param( [Parameter(Mandatory=$true, ValueFromPipeline=$True, Position=0)] [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]] $VMs ) -Process { +Process { #foreach ($VM in $VMs) { $OutofDate = $VMs | where {$_.ExtensionData.Guest.ToolsStatus -ne "toolsOk"} $Result = @($OutofDate | select Name,@{Name="ToolsVersion";Expression={$_.ExtensionData.Guest.Toolsversion}}) diff --git a/Scripts/DatastoreSIOCStatistics.ps1 b/Scripts/DatastoreSIOCStatistics.ps1 index 0121b07..4ea175f 100644 --- a/Scripts/DatastoreSIOCStatistics.ps1 +++ b/Scripts/DatastoreSIOCStatistics.ps1 @@ -1,18 +1,23 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + function Get-DatastoreSIOCStatCollection { -<# -.SYNOPSIS +<# +.SYNOPSIS Gathers information on the status of SIOC statistics collection for a datastore -.DESCRIPTION +.DESCRIPTION Will provide the status on a datastore's SIOC statistics collection -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com .PARAMETER Datastore Datastore to be ran against .EXAMPLE Get-DatastoreSIOCStatCollection -Datastore ExampleDatastore - Retreives the status of SIOC statistics collection for the provided datastore + Retreives the status of SIOC statistics collection for the provided datastore #> -[CmdletBinding()] +[CmdletBinding()] param( [Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)] $Datastore @@ -20,13 +25,13 @@ function Get-DatastoreSIOCStatCollection { Process { - #Collect information about the desired datastore/s and verify existance + #Collect information about the desired datastore/s and verify existance $ds = Get-Datastore $datastore -warningaction silentlycontinue -erroraction silentlycontinue if (!$ds) {Write-Warning -Message "No Datastore found"} else { $report = @() - + #Loops through each datastore provided and feeds back information about the SIOC Statistics Collection status foreach ($item in $ds) { @@ -36,7 +41,7 @@ function Get-DatastoreSIOCStatCollection { $report += $tempitem } - + #Returns the output to the user return $report @@ -48,20 +53,20 @@ function Get-DatastoreSIOCStatCollection { function Set-DatastoreSIOCStatCollection { -<# -.SYNOPSIS +<# +.SYNOPSIS Configures the status of SIOC statistics collection for a datastore -.DESCRIPTION +.DESCRIPTION Will modify the status on a datastore's SIOC statistics collection -.NOTES +.NOTES Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com .PARAMETER Datastore Datastore to be ran against .EXAMPLE Set-DatastoreSIOCStatCollection -Datastore ExampleDatastore -Enable - Enables SIOC statistics collection for the provided datastore + Enables SIOC statistics collection for the provided datastore #> -[CmdletBinding(SupportsShouldProcess)] +[CmdletBinding(SupportsShouldProcess)] param( [Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)] $Datastore, @@ -97,7 +102,7 @@ function Set-DatastoreSIOCStatCollection { $_this.ConfigureDatastoreIORM_Task($dsobj.ExtensionData.MoRef,$spec) | out-null start-sleep -s 1 $report += Get-View -Id $dsobj.ExtensionData.MoRef -Property Name,Iormconfiguration.statsCollectionEnabled | select Name,@{N='SIOCStatCollection';E={$_.Iormconfiguration.statsCollectionEnabled}} - + } #Returns the output to the user diff --git a/Scripts/ESXInstallDate.ps1 b/Scripts/ESXInstallDate.ps1 index 26a3edf..f069c82 100755 --- a/Scripts/ESXInstallDate.ps1 +++ b/Scripts/ESXInstallDate.ps1 @@ -1,4 +1,9 @@ <# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +<# .SYNOPSIS Retrieve the installation date of an ESXi host .NOTES Author: William Lam .NOTES Site: www.virtuallyghetto.com diff --git a/Scripts/ESXInstalledVIBs.ps1 b/Scripts/ESXInstalledVIBs.ps1 index c759f73..25f7b17 100755 --- a/Scripts/ESXInstalledVIBs.ps1 +++ b/Scripts/ESXInstalledVIBs.ps1 @@ -1,4 +1,9 @@ <# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> + +<# .SYNOPSIS Retrieve the installation date of an ESXi host .NOTES Author: William Lam .NOTES Site: www.virtuallyghetto.com diff --git a/Scripts/ExportImportTags.ps1 b/Scripts/ExportImportTags.ps1 index 27b8ae1..a662167 100644 --- a/Scripts/ExportImportTags.ps1 +++ b/Scripts/ExportImportTags.ps1 @@ -1,16 +1,20 @@ +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> function Export-Tag { [CmdletBinding()] Param ( [Parameter(Mandatory = $True, Position = 1)] - [VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server, - + [VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server, + [Parameter(Mandatory = $True, Position = 2)] [string]$Destination, - + [Parameter(Mandatory = $False, Position = 3)] [boolean]$ExportAssignments ) - + # Retrieve all categories $categoryList = Get-TagCategory -Server $server # Retrieve all tags @@ -30,24 +34,24 @@ function Import-Tag { [CmdletBinding()] Param ( [Parameter(Mandatory = $True, Position = 1)] - [VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server, - + [VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server, + [Parameter(Mandatory = $True, Position = 2)] [string]$Source, - + [Parameter(Mandatory = $False, Position = 3)] [boolean]$ImportAssignments ) - + # Import the tags and categories from the specified source $import = Import-Clixml -Path $source # Divide the input in separate lists for tags and categories $categoryList = $import[0] $tagList = $import[1] - + # Store the newly created categories to avoid retrieving them later $categories = @() - + # First create all categories on the server foreach ($category in $categoryList) { $categories += ` @@ -59,13 +63,13 @@ function Import-Tag { -Server $server ` | Out-Null } - + # Then create all tags in the corresponding categories foreach ($tag in $tagList) { # Find the category object in the list $category = $categories | where {$_.Name -eq $tag.Category.Name} if ($category -eq $null) {$category = $tag.Category.Name} - + New-Tag ` -Name $tag.Name ` -Description $tag.Description ` @@ -73,7 +77,7 @@ function Import-Tag { -Server $server ` | Out-Null } - + # Restore the assignments if selected If ($ImportAssignments) { # Check for assignments in the file diff --git a/Scripts/Get-BiosBootStatus.ps1 b/Scripts/Get-BiosBootStatus.ps1 index f104ee0..2de72c4 100644 --- a/Scripts/Get-BiosBootStatus.ps1 +++ b/Scripts/Get-BiosBootStatus.ps1 @@ -1,5 +1,9 @@ -function Get-BiosBootStatus { -<# +<# +Copyright 2021 VMware, Inc. +SPDX-License-Identifier: BSD-2-Clause +#> +function Get-BiosBootStatus { +<# .NOTES =========================================================================== Created by: Brian Graf @@ -17,10 +21,10 @@ .Example # Only returns VMs that are booting to BIOS Get-BiosBootStatus (Get-VM) -IsSetup - + #> [CmdletBinding()] - param( + param( [Parameter(Mandatory=$true, ValueFromPipeline=$True, Position=0)]