├── .gitattributes ├── .gitignore ├── DSC └── README.md ├── LICENSE.md ├── Modules ├── Backup-VCSA │ └── Backup-VCSA.psm1 ├── ContentLibrary │ └── ContentLibrary.psm1 ├── CrossvCentervmotion │ └── XVM.psm1 ├── DatastoreFunctions │ └── DatastoreFunctions.psm1 ├── Get-NICDetails │ └── Get-NICDetails.psm1 ├── Get-NewAndRemovedVMs │ └── Get-NewAndRemovedVMs.psm1 ├── Get-VMmaxIOPS │ └── Get-VMmaxIOPS.psm1 ├── InstantClone │ └── InstantClone.psm1 ├── Konfig-ESXi │ └── Konfig-ESXi.psm1 ├── NSXT │ ├── NSXT.psd1 │ └── NSXT.psm1 ├── PSvLIMessage │ └── PSvLIMessage.psm1 ├── PerVMEVC │ └── PerVMEVC.psm1 ├── ProactiveHA │ └── ProactiveHA.psm1 ├── README.md ├── Recommend-Sizing │ └── Recommend-Sizing.psm1 ├── SRM │ ├── .gitattributes │ ├── .gitignore │ ├── Examples │ │ ├── ReportConfiguration.ps1 │ │ └── SrmTagging.ps1 │ ├── LICENSE.txt │ ├── Meadowcroft.Srm.Protection.ps1 │ ├── Meadowcroft.Srm.Recovery.ps1 │ ├── Meadowcroft.Srm.Storage.ps1 │ ├── Meadowcroft.Srm.psd1 │ ├── Meadowcroft.Srm.psm1 │ ├── NOTICE.txt │ └── README.md ├── Set-CBT │ └── Set-CBT.psm1 ├── Start-UNMAP │ └── Start-UNMAP.psm1 ├── VAMI │ └── VAMI.psm1 ├── VCHA │ └── VCHA.psm1 ├── VCSA │ └── VCSA.psm1 ├── VMCPFunctions │ └── VMCPFunctions.psm1 ├── VMFSIncrease │ ├── LICENSE.txt.URL │ ├── VMFSIncrease.psd1 │ ├── VMFSIncrease.psm1 │ └── en-US │ │ ├── VMFSIncrease.psm1-Help.xml │ │ └── about_VMFSIncrease.help.txt ├── VMToolsManagement │ └── VMToolsManagement.psm1 ├── VMware-vCD-Module │ ├── LICENSE │ ├── README.md │ ├── VMware-vCD-Module.psd1 │ ├── examples │ │ └── OnBoarding.json │ ├── functions │ │ ├── Invoke-MyOnBoarding.psm1 │ │ ├── New-MyEdgeGateway.psm1 │ │ ├── New-MyOrg.psm1 │ │ ├── New-MyOrgAdmin.psm1 │ │ ├── New-MyOrgNetwork.psm1 │ │ └── New-MyOrgVdc.psm1 │ ├── media │ │ ├── Invoke-MyOnBoarding.png │ │ └── VSCode-Pester-Tests.png │ └── tests │ │ └── VMware-vCD-Module.Tests.ps1 ├── VMware-vCD-TenantReport │ ├── README.md │ ├── VMware-vCD-TenantReport.psd1 │ ├── functions │ │ └── Get-VcdTenantReport.psm1 │ ├── media │ │ └── Get-VcdTenantReport.png │ ├── modules │ │ └── PowerStartHTML │ │ │ ├── PowerStartHTML.psd1 │ │ │ └── PowerStartHTML.psm1 │ └── tests │ │ └── VMware-vCD-TenantReport.Tests.ps1 ├── VMware.CSP │ └── VMware.CSP.psm1 ├── VMware.Community.CISTag │ ├── VMware.Community.CISTag.psd1 │ └── VMware.Community.CISTag.psm1 ├── VMware.DRaaS │ ├── VMware.DRaaS.psd1 │ └── VMware.DRaaS.psm1 ├── VMware.HCX │ ├── VMware.HCX.psd1 │ └── VMware.HCX.psm1 ├── VMware.Hosted │ ├── VMware.Hosted.psd1 │ └── VMware.Hosted.psm1 ├── VMware.Hv.Helper │ ├── Json │ │ ├── Farm │ │ │ ├── AutomatedInstantCloneFarm.json │ │ │ ├── AutomatedLinkedCloneFarm.json │ │ │ ├── AutomatedLinkedCloneFarmVGPU.json │ │ │ └── ManualFarm.json │ │ └── Pool │ │ │ ├── FullClone.json │ │ │ ├── InstantClone.json │ │ │ ├── LinkedClone.json │ │ │ ├── ManualSpec.json │ │ │ └── RdsSpec.json │ ├── README.md │ ├── Set-HVFarm │ │ ├── AutomatedEditFarm.json │ │ └── ManualEditFarm.json │ ├── Set-HVGlobalSettings │ │ └── Set-HVGlobalSettings.json │ ├── Set-HVPool │ │ ├── AutomatedEditPool.Json │ │ ├── ManualEditPool.json │ │ └── RdsEditPool.json │ ├── VMware.HV.Helper.format.ps1xml │ ├── VMware.HV.Helper.psd1 │ ├── VMware.HV.Helper.psm1 │ └── docs │ │ ├── Add-HVDesktop.md │ │ ├── Add-HVRDSServer.md │ │ ├── Clear-HVEventDatabase.md │ │ ├── Connect-HVEvent.md │ │ ├── Disconnect-HVEvent.md │ │ ├── Get-HVApplication.md │ │ ├── Get-HVBaseImageVM.md │ │ ├── Get-HVEntitlement.md │ │ ├── Get-HVEvent.md │ │ ├── Get-HVEventDatabase.md │ │ ├── Get-HVFarm.md │ │ ├── Get-HVFarmSummary.md │ │ ├── Get-HVGlobalEntitlement.md │ │ ├── Get-HVGlobalSession.md │ │ ├── Get-HVGlobalSettings.md │ │ ├── Get-HVHealth.md │ │ ├── Get-HVHomeSite.md │ │ ├── Get-HVInternalName.md │ │ ├── Get-HVLocalSession.md │ │ ├── Get-HVMachine.md │ │ ├── Get-HVMachineSummary.md │ │ ├── Get-HVPodFederation.md │ │ ├── Get-HVPool.md │ │ ├── Get-HVPoolSpec.md │ │ ├── Get-HVPoolSummary.md │ │ ├── Get-HVPreInstalledApplication.md │ │ ├── Get-HVQueryFilter.md │ │ ├── Get-HVQueryResult.md │ │ ├── Get-HVResourceStructure.md │ │ ├── Get-HVSite.md │ │ ├── Get-HVlicense.md │ │ ├── Get-HVvCenterServer.md │ │ ├── Get-HVvCenterServerHealth.md │ │ ├── New-HVEntitlement.md │ │ ├── New-HVFarm.md │ │ ├── New-HVGlobalEntitlement.md │ │ ├── New-HVHomeSite.md │ │ ├── New-HVManualApplication.md │ │ ├── New-HVPodFederation.md │ │ ├── New-HVPool.md │ │ ├── New-HVPreInstalledApplication.md │ │ ├── New-HVSite.md │ │ ├── Register-HVPod.md │ │ ├── Remove-HVApplication.md │ │ ├── Remove-HVApplicationIcon.md │ │ ├── Remove-HVEntitlement.md │ │ ├── Remove-HVFarm.md │ │ ├── Remove-HVGlobalEntitlement.md │ │ ├── Remove-HVMachine.md │ │ ├── Remove-HVPodFederation.md │ │ ├── Remove-HVPool.md │ │ ├── Remove-HVSite.md │ │ ├── Reset-HVMachine.md │ │ ├── Set-HVApplication.md │ │ ├── Set-HVApplicationIcon.md │ │ ├── Set-HVEventDatabase.md │ │ ├── Set-HVFarm.md │ │ ├── Set-HVGlobalEntitlement.md │ │ ├── Set-HVGlobalSettings.md │ │ ├── Set-HVInstantCloneMaintenance.md │ │ ├── Set-HVMachine.md │ │ ├── Set-HVPodFederation.md │ │ ├── Set-HVPool.md │ │ ├── Set-HVSite.md │ │ ├── Set-HVlicense.md │ │ ├── Start-HVFarm.md │ │ ├── Start-HVPool.md │ │ └── Unregister-HVPod.md ├── VMware.TrustedInfrastructure.Helper │ ├── README.md │ ├── VMware.TrustedInfrastructure.Helper.psd1 │ └── VMware.TrustedInfrastructure.Helper.psm1 ├── VMware.VCGChecker │ ├── Export-VCGReport.ps1 │ ├── Get-VCGHWInfo.ps1 │ ├── Get-VCGStatus.ps1 │ ├── README.md │ ├── Save-VCGJsonFile.ps1 │ ├── VMware.VCGChecker.psd1 │ └── logger.ps1 ├── VMware.VMC.NSXT │ ├── VMware.VMC.NSXT.psd1 │ └── VMware.VMC.NSXT.psm1 ├── VMware.VMC │ ├── VMware.VMC.psd1 │ └── VMware.VMC.psm1 ├── VMware.VMEncryption │ ├── README.md │ ├── VMware.VMEncryption.psd1 │ └── VMware.VMEncryption.psm1 ├── VMware.VsanEncryption │ ├── README.md │ ├── VMware.VsanEncryption.psd1 │ └── VMware.VsanEncryption.psm1 ├── VMware.WorkloadManagement │ ├── VMware.WorkloadManagement.psd1 │ └── VMware.WorkloadManagement.psm1 ├── VMware.WorkspaceOneAccess │ ├── VMware.WorkspaceOneAccess.psd1 │ └── VMware.WorkspaceOneAccess.psm1 ├── VMware.vSphere.SsoAdmin │ ├── README.md │ ├── VMware.vSphere.SsoAdmin.psd1 │ ├── VMware.vSphere.SsoAdmin.psm1 │ ├── net45 │ │ ├── VMware.vSphere.LsClient.dll │ │ ├── VMware.vSphere.SsoAdmin.Format.ps1xml │ │ ├── VMware.vSphere.SsoAdmin.Utils.dll │ │ ├── VMware.vSphere.SsoAdmin.psd1 │ │ └── VMware.vSphere.SsoAdminClient.dll │ ├── netcoreapp2.0 │ │ ├── VMware.vSphere.LsClient.dll │ │ ├── VMware.vSphere.SsoAdmin.Format.ps1xml │ │ ├── VMware.vSphere.SsoAdmin.Utils.dll │ │ ├── VMware.vSphere.SsoAdmin.psd1 │ │ └── VMware.vSphere.SsoAdminClient.dll │ └── src │ │ ├── .gitignore │ │ ├── VMware.vSphere.SsoAdmin.Client │ │ ├── Nuget.config │ │ ├── VMware.vSphere.LsClient │ │ │ ├── Connected Services │ │ │ │ └── LookupServiceReference │ │ │ │ │ ├── ConnectedService.json │ │ │ │ │ └── Reference.cs │ │ │ ├── LookupServiceClient.cs │ │ │ └── VMware.vSphere.LsClient.csproj │ │ ├── VMware.vSphere.SsoAdmin.Client.sln │ │ ├── VMware.vSphere.SsoAdmin.Utils │ │ │ ├── AcceptAllX509CertificateValidator.cs │ │ │ ├── StirngToSecureStringArgumentTransformationAttribute.cs │ │ │ └── VMware.vSphere.SsoAdmin.Utils.csproj │ │ ├── VMware.vSphere.SsoAdminClient.Tests │ │ │ ├── IntegrationTests.cs │ │ │ └── VMware.vSphere.SsoAdminClient.Tests.csproj │ │ ├── VMware.vSphere.SsoAdminClient │ │ │ ├── DataTypes │ │ │ │ ├── Group.cs │ │ │ │ ├── LockoutPolicy.cs │ │ │ │ ├── PasswordPolicy.cs │ │ │ │ ├── PersonUser.cs │ │ │ │ ├── SsoAdminServer.cs │ │ │ │ └── TokenLifetime.cs │ │ │ ├── SsoAdminClient.cs │ │ │ ├── SsoAdminServiceReference │ │ │ │ └── ServiceRerference.cs │ │ │ ├── UserPassSecurityContext.cs │ │ │ └── VMware.vSphere.SsoAdminClient.csproj │ │ └── packages │ │ │ ├── VMware.Binding.Sts.12.0.0.15939652.nupkg │ │ │ ├── VMware.Binding.Sts.12.0.0.15939652.symbols.nupkg │ │ │ ├── VMware.Binding.WsTrust.12.0.0.15939652.nupkg │ │ │ ├── VMware.Binding.WsTrust.12.0.0.15939652.symbols.nupkg │ │ │ ├── VMware.Http.Handlers.12.0.0.15939652.nupkg │ │ │ ├── VMware.Http.Handlers.12.0.0.15939652.symbols.nupkg │ │ │ ├── VMware.System.Private.ServiceModel.4.4.4.nupkg │ │ │ ├── VMware.Util.Sspi.12.0.0.15939652.nupkg │ │ │ └── VMware.Util.Sspi.12.0.0.15939652.symbols.nupkg │ │ ├── build.ps1 │ │ └── test │ │ ├── ConnectDisconnect.Tests.ps1 │ │ ├── Group.Tests.ps1 │ │ ├── LockoutPolicy.Tests.ps1 │ │ ├── LsClient.Tests.ps1 │ │ ├── PasswordPolicy.Tests.ps1 │ │ ├── PersonUser.Tests.ps1 │ │ ├── RunTests.ps1 │ │ └── TokenLifetime.Tests.ps1 ├── Validate-ESXiPackages │ └── Validate-ESXiPackages.psm1 ├── Vi-Module │ ├── README.md │ ├── Vi-Module.psd1 │ └── Vi-Module.psm1 ├── VyOS │ ├── VyOS.psm1 │ └── vyos.template ├── apply-hardening │ └── apply-hardening.psm1 ├── rCisTag │ ├── Examples │ │ ├── 01-Get.ps1 │ │ ├── 02-New.ps1 │ │ ├── 03-Set.ps1 │ │ ├── 04-Remove.ps1 │ │ ├── 05-Tag-Datastore.ps1 │ │ └── CisConfig.ps1 │ ├── MITLicense.txt │ ├── README.md │ ├── en-US │ │ ├── about_rCISTag.Help.txt │ │ └── rCISTag-help.xml │ ├── rCISTag.psd1 │ └── rCISTag.psm1 ├── vCenter.Alarms │ ├── New-vCenterAlarms.ps1 │ └── vCenter.Alarms.psm1 ├── vCenterCEIP │ └── vCenterCEIP.psm1 ├── vCenterManualMigration │ └── vCenterManualMigration.psm1 └── vSphere_Hardening_Assess_VM_v1a │ └── vSphere_Hardening_Assess_VM_v1a.psm1 ├── Pester ├── 00 Test Connect-CISServer Connection to VC.Tests.ps1 ├── 00 Test Connect-VIServer Connection to VC.Tests.ps1 ├── Functions │ ├── Connect-VMCVIServer.tests.ps1 │ ├── Get-VMCCommand.tests.ps1 │ ├── Get-VMCFirewallRule.tests.ps1 │ ├── Get-VMCHost.tests.ps1 │ ├── Get-VMCOrg.tests.ps1 │ ├── Get-VMCSDDCDefaultCredential.tests.ps1 │ ├── Get-VMCSDDCPublicIP.tests.ps1 │ ├── Get-VMCSDDCVersion.tests.ps1 │ ├── Get-VmcSddc.tests.ps1 │ ├── Get-VmcTask.tests.ps1 │ └── Shared.ps1 ├── Get-DatastoreProvisioned.Tests.ps1 ├── Test Get-CISService.Tests.ps1 ├── VMCCode-Coverage.ps1 ├── ZZ Test Disconnect-CISServer to VC.Tests.ps1 └── ZZ Test Disconnect-VIServer to VC.Tests.ps1 ├── PowerActions ├── README.md ├── VM-CdDrive-Report.ps1 └── VM-Snapshot-Report.ps1 ├── README.md └── Scripts ├── Apply-OMRightsizing.ps1 ├── At_Your_Fingertips ├── NewProfile.ps1 └── install-profile.ps1 ├── AutomaticVMFSUnmap.ps1 ├── Check-VMwareTools.ps1 ├── CreateVLANonStandardSwitch ├── DatastoreSIOCStatistics.ps1 ├── ESXInstallDate.ps1 ├── ESXInstalledVIBs.ps1 ├── ExportImportTags.ps1 ├── Get-BasicVMCapacityReport ├── Get-BiosBootStatus.ps1 ├── Get-CIVMData.ps1 ├── Get-DatastoreProvisioned.ps1 ├── Get-Migrations.ps1 ├── Get-TotalDiskUsage.ps1 ├── Get-TotalMemoryAllocation.ps1 ├── Get-TriggeredAlarm.ps1 ├── Get-VMHostUplinkDetails.ps1 ├── Get-VMHostWWPN.ps1 ├── Get-VMID.ps1 ├── Get-VMNetworkPortId.ps1 ├── Get-VMToolsParts.ps1 ├── Get-VsanHclDatabase.ps1 ├── Home Lab ├── Home Lab Delete settings.ps1 └── Home Lab Deployment.ps1 ├── Horizon View Example Desktop Script.ps1 ├── Horizon-GetUsageStats.ps1 ├── Host_Memory_Assessment_Tool.ps1 ├── Install-HostClient.ps1 ├── Invoke-BiosBoot.ps1 ├── Move-DatastoreCluster.ps1 ├── NVME Info.ps1 ├── New-ClusterHostGroup.ps1 ├── New-ClusterVmGroup.ps1 ├── New-ClusterVmHostRule.ps1 ├── PowerCLI_FixNestedFolders.ps1 ├── README.md ├── ReadVMSnapshotConfig.ps1 ├── Remove-HostClient.ps1 ├── Remove-IPPool.ps1 ├── Report-LUNPath-ESXCLI.ps1 ├── Sample VMC firewall rules management.ps1 ├── Save-PowerCLI.ps1 ├── SecureBoot.ps1 ├── Set-ClusterDpm.ps1 ├── Set-CustomAttributesInGuestinfo.ps1 ├── Set-LockdownLevel.ps1 ├── Set-NetworkAdapterOpaqueNetwork.ps1 ├── Set-TagsInGuestinfo.ps1 ├── Set-VMHostSecureNTP.ps1 ├── SetClusterMultiPathToRoundRobin.ps1 ├── SetDatastoreTag.ps1 ├── SetLunReservation.ps1 ├── SetMultiPathToRoundRobin ├── Start-VMHostSsh.ps1 ├── Stop-VMHostSsh.ps1 ├── Sysprep_Automation_Script.ps1 ├── Update_PowerCLI_Scripts.ps1 ├── VMware_Cloud_on_AWS ├── AWS_Integrations_Examples │ ├── Serverless_VM_Deployment │ │ ├── index.html │ │ ├── readme.txt │ │ └── vm-request-form.zip │ └── Slack_Inventory │ │ ├── slackinventory.py │ │ └── vmc-inventory-to-slack.mp4 ├── Create100VMs.ps1 ├── L2VPN-vMotion-OnPrem-to-VMC.ps1 ├── VMC Example Script.ps1 ├── VMWonAWS_1nodeDeployment.ps1 ├── VMWonAWS_FirewallRuleAccelerator.ps1 ├── VMWonAWS_InviteUsers.ps1 └── XRef-VMC-Services.ps1 ├── VSANSmartsData.ps1 ├── VSANVersion.ps1 ├── backup-esxi-host-configuration.ps1 ├── esxi-image-comparator.ps1 ├── esxi-image-creator.ps1 ├── get-peakvms.ps1 ├── get-ping.ps1 ├── ha-vcenter-deploy-template.json ├── ha-vcenter-deploy.ps1 ├── modules.sh ├── vCenterSnapshot.ps1 ├── vRealize Operations Maintenance Mode.ps1 ├── vSphereLogins.ps1 ├── vTool_2016aug.ps1 └── vmCreationNotes.ps1 /.gitattributes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/.gitattributes -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # PowerShell Studio Files 2 | *.temppoint.* 3 | *.psproj.psbuild 4 | *.psbuild 5 | 6 | #VS Code Files 7 | *.vscode 8 | 9 | # Windows image file caches 10 | Thumbs.db 11 | ehthumbs.db 12 | 13 | # Folder config file 14 | Desktop.ini 15 | 16 | # Recycle Bin used on file shares 17 | $RECYCLE.BIN/ 18 | 19 | # Windows Installer files 20 | *.cab 21 | *.msi 22 | *.msm 23 | *.msp 24 | 25 | # Windows shortcuts 26 | *.lnk 27 | 28 | # ========================= 29 | # Operating System Files 30 | # ========================= 31 | 32 | # OSX 33 | # ========================= 34 | 35 | .DS_Store 36 | .AppleDouble 37 | .LSOverride 38 | 39 | # Thumbnails 40 | ._* 41 | 42 | # Files that might appear on external disk 43 | .Spotlight-V100 44 | .Trashes 45 | 46 | # Directories potentially created on remote AFP share 47 | .AppleDB 48 | .AppleDesktop 49 | Network Trash Folder 50 | Temporary Items 51 | .apdisk -------------------------------------------------------------------------------- /DSC/README.md: -------------------------------------------------------------------------------- 1 | DSC Resources 2 | -------------------------------------------------------------------------------- /Modules/NSXT/NSXT.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | ModuleToProcess = 'NSXT.psm1' 3 | ModuleVersion = '1.0.0.0' 4 | GUID = 'c72f4e3d-5d1d-498f-ba86-6fa03e4ae6dd' 5 | Author = 'William Lam' 6 | CompanyName = 'primp-industries.com' 7 | Copyright = '(c) 2017. All rights reserved.' 8 | Description = 'Powershell Module for NSX-T REST API Functions' 9 | PowerShellVersion = '5.0' 10 | FunctionsToExport = 'Get-NSXTBGPNeighbors', 11 | 'Get-NSXTComputeManager', 12 | 'Get-NSXTController', 13 | 'Get-NSXTEdgeCluster', 14 | 'Get-NSXTFabricNode', 15 | 'Get-NSXTFabricVM', 16 | 'Get-NSXTFirewallRule', 17 | 'Get-NSXTForwardingTable', 18 | 'Get-NSXTIPPool', 19 | 'Get-NSXTLogicalRouter', 20 | 'Get-NSXTLogicalRouterPorts', 21 | 'Get-NSXTLogicalSwitch', 22 | 'Get-NSXTManager', 23 | 'Get-NSXTNetworkRoutes', 24 | 'Get-NSXTRoutingTable', 25 | 'Get-NSXTTraceFlow', 26 | 'Get-NSXTTraceFlowObservations', 27 | 'Get-NSXTTransportNode', 28 | 'Get-NSXTTransportZone', 29 | 'Get-NSXTClusterNode', 30 | 'Set-NSXTIPPool', 31 | 'Set-NSXTLogicalRouter', 32 | 'Set-NSXTLogicalSwitch', 33 | 'Set-NSXTTraceFlow', 34 | 'Get-NSXTIPAMIPBlock', 35 | 'Set-NSXTIPAMIPBlock', 36 | 'Remove-NSXTIPAMIPBlock' 37 | 38 | 39 | PrivateData = @{ 40 | PSData = @{ 41 | Tags = @('NSX-T','REST') 42 | LicenseUri = 'https://www.tldrlegal.com/l/mit' 43 | ProjectUri = 'https://github.com/lamw/PowerCLI-Example-Scripts/tree/master/Modules/NSXT' 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Modules/README.md: -------------------------------------------------------------------------------- 1 | Modules 2 | -------------------------------------------------------------------------------- /Modules/SRM/.gitattributes: -------------------------------------------------------------------------------- 1 | *.psd1 diff 2 | -------------------------------------------------------------------------------- /Modules/SRM/.gitignore: -------------------------------------------------------------------------------- 1 | *.zip -------------------------------------------------------------------------------- /Modules/SRM/Examples/SrmTagging.ps1: -------------------------------------------------------------------------------- 1 | # Depends on SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets 2 | # It is assumed that the connections to active VC and SRM Server have already been made 3 | 4 | Import-Module Meadowcroft.SRM -Prefix Srm 5 | 6 | $TagCategoryName = 'Meadowcroft.SRM.VM' 7 | $TagCategoryDescription = 'Tag category for tagging VMs with SRM state' 8 | 9 | # If the tag category doesn't exist, create it and the relevant tags 10 | $TagCategory = Get-TagCategory -Name $TagCategoryName -ErrorAction SilentlyContinue 11 | if (-Not $TagCategory) { 12 | Write-Output "Creating Tag Category $TagCategoryName" 13 | $TagCategory = New-TagCategory -Name $TagCategoryName -Description $TagCategoryDescription -EntityType 'VirtualMachine' 14 | 15 | Write-Output "Creating Tag SrmProtectedVm" 16 | New-Tag -Name 'SrmProtectedVm' -Category $TagCategory -Description "VM protected by VMware SRM" 17 | Write-Output "Creating Tag SrmTestVm" 18 | New-Tag -Name 'SrmTestVm' -Category $TagCategory -Description "Test VM instantiated by VMware SRM" 19 | Write-Output "Creating Tag SrmPlaceholderVm" 20 | New-Tag -Name 'SrmPlaceholderVm' -Category $TagCategory -Description "Placeholder VM used by VMware SRM" 21 | } 22 | 23 | $protectedVmTag = Get-Tag -Name 'SrmProtectedVm' -Category $TagCategory 24 | $testVmTag = Get-Tag -Name 'SrmTestVm' -Category $TagCategory 25 | $placeholderVmTag = Get-Tag -Name 'SrmPlaceholderVm' -Category $TagCategory 26 | 27 | # Assign protected tag to a VM, use ready state to get "local" protected VMs 28 | Get-SrmProtectedVM -State Ready | %{ New-TagAssignment -Tag $protectedVmTag -Entity $(Get-VIObjectByVIView $_.Vm) | Out-Null } 29 | 30 | # Assign test tag to a VM 31 | Get-SrmTestVM | %{ New-TagAssignment -Tag $testVmTag -Entity $_ | Out-Null } 32 | 33 | # Assign placeholder tag to a VM 34 | Get-SrmPlaceholderVM | %{ New-TagAssignment -Tag $placeholderVmTag -Entity $_ | Out-Null } 35 | -------------------------------------------------------------------------------- /Modules/SRM/Meadowcroft.Srm.Storage.ps1: -------------------------------------------------------------------------------- 1 | # SRM Helper Methods - https://github.com/benmeadowcroft/SRM-Cmdlets 2 | 3 | <# 4 | .SYNOPSIS 5 | Trigger Discover Devices for Site Recovery Manager 6 | 7 | .OUTPUTS 8 | Returns discover devices task 9 | #> 10 | Function Start-DiscoverDevice { 11 | [cmdletbinding(SupportsShouldProcess=$True, ConfirmImpact="Medium")] 12 | [OutputType([VMware.VimAutomation.Srm.Views.DiscoverDevicesTask])] 13 | Param( 14 | [VMware.VimAutomation.Srm.Types.V1.SrmServer] $SrmServer 15 | ) 16 | 17 | $api = Get-ServerApiEndpoint -SrmServer $SrmServer 18 | $name = $SrmServer.Name 19 | [VMware.VimAutomation.Srm.Views.DiscoverDevicesTask] $task = $null 20 | if ($pscmdlet.ShouldProcess($name, "Rescan Storage Devices")) { 21 | $task = $api.Storage.DiscoverDevices() 22 | } 23 | return $task 24 | } 25 | -------------------------------------------------------------------------------- /Modules/SRM/NOTICE.txt: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2017 VMware, Inc. All Rights Reserved. 3 | 4 | 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. 5 | 6 | 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. 7 | 8 | -------------------------------------------------------------------------------- /Modules/VMFSIncrease/LICENSE.txt.URL: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=https://github.com/lucdekens/LogInsight/blob/v1.0/LICENSE.txt 3 | IDList= 4 | HotKey=0 5 | IconFile=C:\Users\ldekens\AppData\Local\Mozilla\Firefox\Profiles\2ahnnh1i.default\shortcutCache\ec4nFcIEAQBPFmSiPtTJ2w==.ico 6 | IconIndex=0 7 | -------------------------------------------------------------------------------- /Modules/VMFSIncrease/VMFSIncrease.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | ModuleToProcess = 'VMFSIncrease.psm1' 3 | ModuleVersion = '1.0.0.0' 4 | GUID = '9f167385-c5c6-4a65-ac14-949c67519001' 5 | Author = 'Luc Dekens ' 6 | CompanyName = 'Community' 7 | Copyright = '(c) 2016. All rights reserved.' 8 | Description = 'Expand and Extend VMFS DatastoresModule description' 9 | PowerShellVersion = '3.0' 10 | FunctionsToExport = 'Get-VmfsDatastoreInfo','Get-VmfsDatastoreIncrease','New-VmfsDatastoreIncrease' 11 | PrivateData = @{ 12 | PSData = @{ 13 | Tags = @('VMFS','Expand','Extend','vSphere') 14 | LicenseUri = 'https://www.tldrlegal.com/l/mit' 15 | ProjectUri = 'https://github.com/lucdekens/VMFSIncrease' 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Modules/VMFSIncrease/en-US/about_VMFSIncrease.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | VMFSIncrease 3 | 4 | SYNOPSIS 5 | The VMFSIncrease module offers the same functionality that is available 6 | through the Increase button in the vSphere Web Client. 7 | 8 | DESCRIPTION 9 | The VMFSIncrease offers functionality that allows to Expand or Extend 10 | VMFS Datastores. The module uses the vSphere API to implement this functionality. 11 | 12 | SEE ALSO 13 | http://www.lucd.info/2016/07/29/vmfs-datastores-expand-and-extend 14 | -------------------------------------------------------------------------------- /Modules/VMware-vCD-Module/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Markus Kraus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Modules/VMware-vCD-Module/README.md: -------------------------------------------------------------------------------- 1 | VMware-vCD-Module PowerShell Module 2 | =================================== 3 | 4 | ![Invoke-MyOnBoarding](/media/Invoke-MyOnBoarding.png) 5 | 6 | # About 7 | 8 | ## Project Owner: 9 | 10 | Markus Kraus [@vMarkus_K](https://twitter.com/vMarkus_K) 11 | 12 | MY CLOUD-(R)EVOLUTION [mycloudrevolution.com](http://mycloudrevolution.com/) 13 | 14 | 15 | ## Project WebSite: 16 | [PowerCLI vCloud Director Customer Provisioning](https://mycloudrevolution.com/2017/06/13/powercli-vcloud-director-customer-provisioning/) 17 | 18 | [PowerCLI – Create vCloud Director Edge Gateway](https://mycloudrevolution.com/2017/06/27/powercli-create-vcloud-director-edge-gateway/) 19 | 20 | 21 | ## Project Documentation: 22 | 23 | [Read the Docs - VMware-vCD-Module](http://vmware-vcd-module.readthedocs.io/) 24 | 25 | ## Project Description: 26 | 27 | The 'VMware-vCD-Module' PowerShell Module is focused on the initial creation of VMware vCloud Director Objects like Org, Org User, Org VDC with External Networks or Edge Gateway. 28 | 29 | All Functions in this Module can be used as standalone Cmdlet but also the ``Invoke-My OnBoarding`` Functions to process a JSON File and create all Objects at once. 30 | 31 | ### Fully tested Versions: 32 | 33 | Powershell: v4, v5 34 | 35 | PowerCLI: 6.5.1 36 | 37 | VMware vCloud Director: 8.10.1 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Modules/VMware-vCD-Module/examples/OnBoarding.json: -------------------------------------------------------------------------------- 1 | { 2 | "Org": { 3 | "Name":"TestOrg", 4 | "FullName": "Test Org", 5 | "Description":"Automation Test Org" 6 | }, 7 | "OrgAdmin": { 8 | "Name":"TestOrgAdmin", 9 | "Pasword": "myPassword1!", 10 | "FullName":"Test OrgAdmin", 11 | "EmailAddress":"test@admin.org" 12 | }, 13 | "OrgVdc": { 14 | "Name":"TestOrgVdc", 15 | "FixedSize": "M", 16 | "CPULimit": "1000", 17 | "MEMLimit":"1024", 18 | "StorageLimit":"1024", 19 | "StorageProfile":"Standard-DC01", 20 | "ProviderVDC":"Provider-VDC-DC01", 21 | "NetworkPool":"Provider-VDC-DC01-NetPool", 22 | "ExternalNetwork": "External-OrgVdcNet", 23 | "EdgeGateway": "Yes", 24 | "IPAddress":"192.168.100.1", 25 | "SubnetMask":"255.255.255.0", 26 | "Gateway":"192.168.100.254", 27 | "IPRangeStart":"192.168.100.2", 28 | "IPRangeEnd":"192.168.100.3" 29 | } 30 | } -------------------------------------------------------------------------------- /Modules/VMware-vCD-Module/media/Invoke-MyOnBoarding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware-vCD-Module/media/Invoke-MyOnBoarding.png -------------------------------------------------------------------------------- /Modules/VMware-vCD-Module/media/VSCode-Pester-Tests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware-vCD-Module/media/VSCode-Pester-Tests.png -------------------------------------------------------------------------------- /Modules/VMware-vCD-Module/tests/VMware-vCD-Module.Tests.ps1: -------------------------------------------------------------------------------- 1 | $moduleRoot = Resolve-Path "$PSScriptRoot\.." 2 | $moduleName = "VMware-vCD-Module" 3 | $ConfigFile = "$moduleRoot\examples\OnBoarding.json" 4 | 5 | Describe "General project validation: $moduleName" { 6 | 7 | $scripts = Get-ChildItem $moduleRoot -Include *.ps1, *.psm1, *.psd1 -Recurse 8 | 9 | # TestCases are splatted to the script so we need hashtables 10 | $testCase = $scripts | Foreach-Object {@{file = $_}} 11 | It "Script should be valid powershell" -TestCases $testCase { 12 | param($file) 13 | 14 | $file.fullname | Should Exist 15 | 16 | $contents = Get-Content -Path $file.fullname -ErrorAction Stop 17 | $errors = $null 18 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 19 | $errors.Count | Should Be 0 20 | } 21 | 22 | It "Module '$moduleName' prerequirements are met" { 23 | {Import-Module VMware.VimAutomation.Cloud -Force} | Should Not Throw 24 | } 25 | 26 | It "Module '$moduleName' can import cleanly" { 27 | {Import-Module (Join-Path $moduleRoot "$moduleName.psd1") -force } | Should Not Throw 28 | } 29 | 30 | It "Module '$moduleName' JSON example is valid" { 31 | {Get-Content -Raw -Path $ConfigFile | ConvertFrom-Json} | Should Not Throw 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Modules/VMware-vCD-TenantReport/README.md: -------------------------------------------------------------------------------- 1 | VMware-vCD-TenantReport PowerShell Module 2 | ============= 3 | 4 | # About 5 | 6 | ## Project Owner: 7 | 8 | Markus Kraus [@vMarkus_K](https://twitter.com/vMarkus_K) 9 | 10 | MY CLOUD-(R)EVOLUTION [mycloudrevolution.com](http://mycloudrevolution.com/) 11 | 12 | ## Project WebSite: 13 | 14 | [mycloudrevolution.com](http://mycloudrevolution.com/) 15 | 16 | ## Project Documentation: 17 | 18 | [Read the Docs](http://readthedocs.io/) 19 | 20 | ## Project Description: 21 | 22 | The 'VMware-vCD-TenantReport' PowerShell Module creates with the Fuction 'Get-VcdTenantReport' a HTML Report of your vCloud Director Objects. 23 | 24 | ![Get-VcdTenantReport](/media/Get-VcdTenantReport.png) 25 | 26 | Big thanks to [Timothy Dewin](https://twitter.com/tdewin) for his great [PowerStartHTML](https://github.com/tdewin/randomsamples/tree/master/powerstarthtml) PowerShell Module which is used to generate the Report for this Module. 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Modules/VMware-vCD-TenantReport/media/Get-VcdTenantReport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware-vCD-TenantReport/media/Get-VcdTenantReport.png -------------------------------------------------------------------------------- /Modules/VMware-vCD-TenantReport/modules/PowerStartHTML/PowerStartHTML.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware-vCD-TenantReport/modules/PowerStartHTML/PowerStartHTML.psd1 -------------------------------------------------------------------------------- /Modules/VMware-vCD-TenantReport/tests/VMware-vCD-TenantReport.Tests.ps1: -------------------------------------------------------------------------------- 1 | $moduleRoot = Resolve-Path "$PSScriptRoot\.." 2 | $moduleName = "VMware-vCD-TenantReport" 3 | 4 | Describe "General project validation: $moduleName" { 5 | 6 | $scripts = Get-ChildItem $moduleRoot -Include *.ps1, *.psm1, *.psd1 -Recurse 7 | 8 | # TestCases are splatted to the script so we need hashtables 9 | $testCase = $scripts | Foreach-Object {@{file = $_}} 10 | It "Script should be valid powershell" -TestCases $testCase { 11 | param($file) 12 | 13 | $file.fullname | Should Exist 14 | 15 | $contents = Get-Content -Path $file.fullname -ErrorAction Stop 16 | $errors = $null 17 | $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) 18 | $errors.Count | Should Be 0 19 | } 20 | 21 | It "Module '$moduleName' can import cleanly" { 22 | {Import-Module (Join-Path $moduleRoot "$moduleName.psd1") -force } | Should Not Throw 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Modules/VMware.DRaaS/VMware.DRaaS.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.DRaaS/VMware.DRaaS.psd1 -------------------------------------------------------------------------------- /Modules/VMware.Hosted/VMware.Hosted.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | ModuleToProcess = 'VMware.Hosted.psm1' 3 | ModuleVersion = '1.0.0.0' 4 | GUID = '11393D09-D6B8-4E79-B9BC-247F1BE66683' 5 | Author = 'William Lam' 6 | CompanyName = 'primp-industries.com' 7 | Copyright = '(c) 2017. All rights reserved.' 8 | Description = 'Powershell Module for VMware Fusion 10 REST API' 9 | PowerShellVersion = '5.0' 10 | FunctionsToExport = 'Get-HostedCommand','Connect-HostedServer','Disconnect-HostedServer','Get-HostedVM','Start-HostedVM','Stop-HostedVM','Suspend-HostedVM','Resume-HostedVM','New-HostedVM','Remove-HostedVM','Get-HostedVMSharedFolder','New-HostedVMSharedFolder','Remove-HostedVMSharedFolder','Get-HostedVMNic','Get-HostedNetworks' 11 | PrivateData = @{ 12 | PSData = @{ 13 | Tags = @('Fusion','REST','vmrest') 14 | LicenseUri = 'https://www.tldrlegal.com/l/mit' 15 | ProjectUri = 'https://github.com/lamw/PowerCLI-Example-Scripts/tree/master/Modules/VMware.Hosted' 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/Json/Farm/ManualFarm.json: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "MANUAL", 3 | "Data": { 4 | "Name": "manualFarmTest", 5 | "DisplayName": "manualFarmTest", 6 | "AccessGroup": "Root", 7 | "Description": "Manual PS Test", 8 | "Enabled": null, 9 | "Deleting": false, 10 | "Settings": { 11 | "DisconnectedSessionTimeoutPolicy" : "NEVER", 12 | "DisconnectedSessionTimeoutMinutes" : 1, 13 | "EmptySessionTimeoutPolicy" : "AFTER", 14 | "EmptySessionTimeoutMinutes" : 1, 15 | "LogoffAfterTimeout" : false 16 | }, 17 | "Desktop": null, 18 | "DisplayProtocolSettings": { 19 | "DefaultDisplayProtocol" : "PCOIP", 20 | "AllowDisplayProtocolOverride" : false, 21 | "EnableHTMLAccess" : false 22 | }, 23 | "ServerErrorThreshold": null, 24 | "MirageConfigurationOverrides": { 25 | "OverrideGlobalSetting" : false, 26 | "Enabled" : false, 27 | "Url" : null 28 | } 29 | }, 30 | "AutomatedFarmSpec": null, 31 | "ManualFarmSpec": { 32 | "RdsServers": [ 33 | { 34 | "rdsServer": "RDSServer.adviewdev.eng.vmware.com" 35 | } 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/Json/Pool/RdsSpec.json: -------------------------------------------------------------------------------- 1 | { 2 | "Base": { 3 | "Name" : "RdsJson", 4 | "DisplayName": "TestRDSPS", 5 | "AccessGroup": "Root", 6 | "Description": "Testing PS" 7 | }, 8 | "DesktopSettings": { 9 | "enabled": true, 10 | "deleting": false, 11 | "connectionServerRestrictions": null, 12 | "logoffSettings": null, 13 | "displayProtocolSettings": null, 14 | "flashSettings": { 15 | "quality": "NO_CONTROL", 16 | "throttling": "DISABLED" 17 | }, 18 | "mirageConfigurationOverrides": null 19 | }, 20 | "Type": "RDS", 21 | "AutomatedDesktopSpec": null, 22 | "ManualDesktopSpec": null, 23 | "RdsDesktopSpec": { 24 | "Farm": "test1" 25 | }, 26 | "GlobalEntitlementData": null 27 | } 28 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/README.md: -------------------------------------------------------------------------------- 1 | # Prerequisites/Steps to use this module 2 | 3 | 1. This module only works for Horizon product E.g. Horizon 7.0.2 and later. 4 | 2. Install the latest version of Powershell, PowerCLI(6.5) or (later version via psgallery). 5 | 3. Import HorizonView module by running: Import-Module VMware.VimAutomation.HorizonView. 6 | 4. Import "VMware.Hv.Helper" module by running: Import-Module -Name "location of this module" or Get-Module -ListAvailable 'VMware.Hv.Helper' | Import-Module. 7 | 5. Get-Command -Module "This module Name" to list all available functions or Get-Command -Module 'VMware.Hv.Helper'. 8 | 9 | # Example script to connect ViewAPI service 10 | 11 | ``` 12 | Import-Module VMware.VimAutomation.HorizonView 13 | 14 | # Connection to view API service 15 | $hvServer = Connect-HVServer -server 16 | $hvServices = $hvserver.ExtensionData 17 | 18 | # List Connection Servers 19 | $csList = $hvServices.ConnectionServer.ConnectionServer_List() 20 | ``` 21 | # Load this module 22 | ``` 23 | Get-Module -ListAvailable 'VMware.Hv.Helper' | Import-Module 24 | Get-Command -Module 'VMware.Hv.Helper' 25 | ``` 26 | # Use advanced functions of this module 27 | ``` 28 | New-HVPool -spec 'path to InstantClone.json file' 29 | ``` 30 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/Set-HVFarm/AutomatedEditFarm.json: -------------------------------------------------------------------------------- 1 | { 2 | "data.description" : "update through edit farm function", 3 | "data.displayName" : "LCFarmTestUpdated1", 4 | "data.displayProtocolSettings.defaultDisplayProtocol" : "PCOIP", 5 | "automatedFarmData.virtualCenterManagedCommonSettings.transparentPageSharingScope" : "FARM" 6 | } -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/Set-HVFarm/ManualEditFarm.json: -------------------------------------------------------------------------------- 1 | { 2 | "data.description" : "update through edit farm function", 3 | "data.displayName" : "ManualFarmTestUpdated1", 4 | "data.displayProtocolSettings.defaultDisplayProtocol" : "PCOIP" 5 | } -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/Set-HVGlobalSettings/Set-HVGlobalSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "generalData.clientMaxSessionTimePolicy": "TIMEOUT_AFTER", 3 | "generalData.clientMaxSessionTimeMinutes": 600, 4 | "generalData.clientIdleSessionTimeoutPolicy": "NEVER", 5 | "generalData.clientIdleSessionTimeoutMinutes": null, 6 | "generalData.clientSessionTimeoutMinutes": 1200, 7 | "generalData.desktopSSOTimeoutPolicy": "DISABLE_AFTER", 8 | "generalData.desktopSSOTimeoutMinutes": 15, 9 | "generalData.applicationSSOTimeoutPolicy": "ALWAYS_ENABLED", 10 | "generalData.applicationSSOTimeoutMinutes": null, 11 | "generalData.viewAPISessionTimeoutMinutes": 10, 12 | "generalData.preLoginMessage": null, 13 | "generalData.displayWarningBeforeForcedLogoff": true, 14 | "generalData.forcedLogoffTimeoutMinutes": 5, 15 | "generalData.forcedLogoffMessage": "Your desktop is scheduled for an important update and will shut down in 5 minutes. Please save any unsaved work now", 16 | "generalData.enableServerInSingleUserMode": false, 17 | "generalData.storeCALOnBroker": false, 18 | "generalData.storeCALOnClient": false, 19 | "securityData.reauthSecureTunnelAfterInterruption": true, 20 | "securityData.messageSecurityMode": "ENHANCED", 21 | "securityData.enableIPSecForSecurityServerPairing": true 22 | } -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/Set-HVPool/AutomatedEditPool.Json: -------------------------------------------------------------------------------- 1 | { 2 | "base.description" : "update through edit pool function", 3 | "base.displayName" : "Henry2DspNm", 4 | "desktopSettings.displayProtocolSettings.defaultDisplayProtocol" : "BLAST", 5 | "automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.useViewStorageAccelerator" : true, 6 | "automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.viewComposerDiskTypes" : "OS_DISKS", 7 | "automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.regenerateViewStorageAcceleratorDays" : 8 8 | } -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/Set-HVPool/ManualEditPool.json: -------------------------------------------------------------------------------- 1 | { 2 | "base.description" : "update through edit pool", 3 | "base.displayName" : "pooldisp", 4 | "desktopSettings.displayProtocolSettings.defaultDisplayProtocol" : "BLAST", 5 | "manualDesktopData.viewStorageAcceleratorSettings.useViewStorageAccelerator" : true, 6 | "manualDesktopData.viewStorageAcceleratorSettings.viewComposerDiskTypes" : "OS_DISKS", 7 | "manualDesktopData.viewStorageAcceleratorSettings.regenerateViewStorageAcceleratorDays" : 8 8 | } -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/Set-HVPool/RdsEditPool.json: -------------------------------------------------------------------------------- 1 | { 2 | "base.description" : "update through edit pool function", 3 | "base.displayName" : "RDS2DspNm", 4 | "desktopSettings.flashSettings.quality" : "LOW", 5 | "desktopSettings.flashSettings.throttling" : "CONSERVATIVE" 6 | } -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Clear-HVEventDatabase.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Clear-HVEventDatabase 9 | 10 | ## SYNOPSIS 11 | Clears configurationof the configured Event Database 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Clear-HVEventDatabase [[-HvServer] ] [-WhatIf] [-Confirm] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Clears configurationof the configured Event Database 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Clear-HVEventDatabase 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -HvServer 32 | Reference to Horizon View Server to query the virtual machines from. 33 | If the value is not passed or null then 34 | first element from global:DefaultHVServers would be considered in-place of hvServer 35 | 36 | ```yaml 37 | Type: Object 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### CommonParameters 80 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 81 | 82 | ## INPUTS 83 | 84 | ## OUTPUTS 85 | 86 | ## NOTES 87 | | | | 88 | |-|-| 89 | | Author | Wouter Kursten | 90 | | Author email | wouter@retouw.nl | 91 | | Version | 1.0 | 92 | 93 | ===Tested Against Environment==== 94 | | | | 95 | |-|-| 96 | | Horizon View Server Version | 7.4 | 97 | | PowerCLI Version | PowerCLI 10 | 98 | | PowerShell Version | 5.0 | 99 | 100 | ## RELATED LINKS 101 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Disconnect-HVEvent.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Disconnect-HVEvent 9 | 10 | ## SYNOPSIS 11 | This function is used to disconnect the database connection. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Disconnect-HVEvent [-HvDbServer] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | This function will disconnect the database connection made earlier during Connect-HVEvent function. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Disconnect-HVEvent -HvDbServer $hvDbServer 27 | ``` 28 | 29 | Disconnecting the database connection on $hvDbServer. 30 | 31 | ## PARAMETERS 32 | 33 | ### -HvDbServer 34 | Connection object returned by Connect-HVEvent advanced function. 35 | This is a mandatory input. 36 | 37 | ```yaml 38 | Type: PSObject 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: True 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### CommonParameters 50 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 51 | 52 | ## INPUTS 53 | 54 | ## OUTPUTS 55 | 56 | ### None 57 | ## NOTES 58 | | | | 59 | |-|-| 60 | | Author | Paramesh Oddepally. | 61 | | Author email | poddepally@vmware.com | 62 | | Version | 1.1 | 63 | 64 | ===Tested Against Environment==== 65 | | | | 66 | |-|-| 67 | | Horizon View Server Version | 7.0.2, 7.1.0 | 68 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 69 | | PowerShell Version | 5.0 | 70 | 71 | ## RELATED LINKS 72 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVEventDatabase.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVEventDatabase 9 | 10 | ## SYNOPSIS 11 | Retreives information about the configured Event Database 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVEventDatabase [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Collects information about the configured event database for aHorizon View pod 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-HVEventDatabase 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -HvServer 32 | Reference to Horizon View Server to query the virtual machines from. 33 | If the value is not passed or null then 34 | first element from global:DefaultHVServers would be considered in-place of hvServer 35 | 36 | ```yaml 37 | Type: Object 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ## OUTPUTS 54 | 55 | ## NOTES 56 | | | | 57 | |-|-| 58 | | Author | Wouter Kursten | 59 | | Author email | wouter@retouw.nl | 60 | | Version | 1.0 | 61 | 62 | ===Tested Against Environment==== 63 | | | | 64 | |-|-| 65 | | Horizon View Server Version | 7.4 | 66 | | PowerCLI Version | PowerCLI 10 | 67 | | PowerShell Version | 5.0 | 68 | 69 | ## RELATED LINKS 70 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVGlobalSession.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVGlobalSession 9 | 10 | ## SYNOPSIS 11 | Provides a list with all Global sessions in a Cloud Pod Architecture 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVGlobalSession [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The get-hvglobalsession gets all local session by using view API service object(hvServer) of Connect-HVServer cmdlet. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-hvglobalsession 27 | ``` 28 | 29 | Gets all global sessions 30 | 31 | ## PARAMETERS 32 | 33 | ### -HvServer 34 | View API service object of Connect-HVServer cmdlet. 35 | 36 | ```yaml 37 | Type: Object 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ## OUTPUTS 54 | 55 | ## NOTES 56 | | | | 57 | |-|-| 58 | | Author | Wouter Kursten. | 59 | | Author email | wouter@retouw.nl | 60 | | Version | 1.0 | 61 | 62 | ===Tested Against Environment==== 63 | | | | 64 | |-|-| 65 | | Horizon View Server Version | 7.0.2, 7.1.0, 7.3.2 | 66 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 67 | | PowerShell Version | 5.0 | 68 | 69 | ## RELATED LINKS 70 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVGlobalSettings.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVGlobalSettings 9 | 10 | ## SYNOPSIS 11 | Gets a list of Global Settings 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVGlobalSettings [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Queries and returns the Global Settings for the pod of the specified HVServer. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-HVGlobalSettings 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -HvServer 32 | Reference to Horizon View Server to query the virtual machines from. 33 | If the value is not passed or null then 34 | first element from global:DefaultHVServers would be considered inplace of hvServer 35 | 36 | ```yaml 37 | Type: Object 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ## OUTPUTS 54 | 55 | ### Returns list of object type VMware.Hv.GlobalSettingsInfo 56 | ## NOTES 57 | | | | 58 | |-|-| 59 | | Author | Matt Frey. | 60 | | Author email | mfrey@vmware.com | 61 | | Version | 1.0 | 62 | 63 | ===Tested Against Environment==== 64 | | | | 65 | |-|-| 66 | | Horizon View Server Version | 7.1 | 67 | | PowerCLI Version | PowerCLI 6.5.1 | 68 | | PowerShell Version | 5.0 | 69 | 70 | ## RELATED LINKS 71 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVHealth.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVHealth 9 | 10 | ## SYNOPSIS 11 | Pulls health information from Horizon View 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVHealth [[-Servicename] ] [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Queries and returns health information from the local Horizon Pod 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-HVHealth -service connectionserver 27 | ``` 28 | 29 | Returns health for the connectionserver(s) 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | Get-HVHealth -service ViewComposer 34 | ``` 35 | 36 | Returns health for the View composer server(s) 37 | 38 | ## PARAMETERS 39 | 40 | ### -Servicename 41 | The name of the service to query the health for. 42 | This will default to Connection server health. 43 | Available services are ADDomain,CertificateSSOConnector,ConnectionServer,EventDatabase,SAMLAuthenticator,SecurityServer,ViewComposer,VirtualCenter,Pod 44 | 45 | ```yaml 46 | Type: String 47 | Parameter Sets: (All) 48 | Aliases: 49 | 50 | Required: False 51 | Position: 1 52 | Default value: ConnectionServer 53 | Accept pipeline input: False 54 | Accept wildcard characters: False 55 | ``` 56 | 57 | ### -HvServer 58 | Reference to Horizon View Server to query the virtual machines from. 59 | If the value is not passed or null then 60 | first element from global:DefaultHVServers would be considered in-place of hvServer 61 | 62 | ```yaml 63 | Type: Object 64 | Parameter Sets: (All) 65 | Aliases: 66 | 67 | Required: False 68 | Position: 2 69 | Default value: None 70 | Accept pipeline input: False 71 | Accept wildcard characters: False 72 | ``` 73 | 74 | ### CommonParameters 75 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 76 | 77 | ## INPUTS 78 | 79 | ## OUTPUTS 80 | 81 | ## NOTES 82 | | | | 83 | |-|-| 84 | | Author | Wouter Kursten | 85 | | Author email | wouter@retouw.nl | 86 | | Version | 1.0 | 87 | 88 | ===Tested Against Environment==== 89 | | | | 90 | |-|-| 91 | | Horizon View Server Version | 7.3.2,7.4 | 92 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 93 | | PowerShell Version | 5.0 | 94 | 95 | ## RELATED LINKS 96 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVHomeSite.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVHomeSite 9 | 10 | ## SYNOPSIS 11 | Gets the configured Horizon View Homesites 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVHomeSite [[-Group] ] [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets the configured Horizon View Homesites 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-HVHomeSite 27 | ``` 28 | 29 | ### EXAMPLE 2 30 | ``` 31 | Get-HVHomeSite -group group@domain 32 | ``` 33 | 34 | ## PARAMETERS 35 | 36 | ### -Group 37 | User principal name of a group 38 | 39 | ```yaml 40 | Type: String 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: False 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### -HvServer 52 | Reference to Horizon View Server to query the virtual machines from. 53 | If the value is not passed or null then 54 | first element from global:DefaultHVServers would be considered in-place of hvServer 55 | 56 | ```yaml 57 | Type: Object 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: False 62 | Position: 2 63 | Default value: None 64 | Accept pipeline input: False 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### CommonParameters 69 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 70 | 71 | ## INPUTS 72 | 73 | ## OUTPUTS 74 | 75 | ## NOTES 76 | | | | 77 | |-|-| 78 | | Author | Wouter Kursten | 79 | | Author email | wouter@retouw.nl | 80 | | Version | 1.0 | 81 | 82 | ===Tested Against Environment==== 83 | | | | 84 | |-|-| 85 | | Horizon View Server Version | 7.4 | 86 | | PowerCLI Version | PowerCLI 10 | 87 | | PowerShell Version | 5.0 | 88 | 89 | ## RELATED LINKS 90 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVLocalSession.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVLocalSession 9 | 10 | ## SYNOPSIS 11 | Provides a list with all sessions on the local pod (works in CPA and non-CPA) 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVLocalSession [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Get-HVLocalSession gets all local session by using view API service object(hvServer) of Connect-HVServer cmdlet. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-HVLocalSession 27 | ``` 28 | 29 | Get all local sessions 30 | 31 | ## PARAMETERS 32 | 33 | ### -HvServer 34 | View API service object of Connect-HVServer cmdlet. 35 | 36 | ```yaml 37 | Type: Object 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ## OUTPUTS 54 | 55 | ## NOTES 56 | | | | 57 | |-|-| 58 | Author : Wouter Kursten. 59 | Author email : wouter@retouw.nl 60 | Version : 1.0 61 | 62 | ===Tested Against Environment==== 63 | | | | 64 | |-|-| 65 | Horizon View Server Version : 7.0.2, 7.1.0, 7.3.2 66 | PowerCLI Version : PowerCLI 6.5, PowerCLI 6.5.1 67 | PowerShell Version : 5.0 68 | 69 | ## RELATED LINKS 70 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVPodFederation.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVPodFederation 9 | 10 | ## SYNOPSIS 11 | Returns information about a Horizon View Pod Federation (Cloud Pod Architecture) 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVPodFederation [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Returns information about a Horizon View Pod Federation (Cloud Pod Architecture) 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-HVPodFederation 27 | ``` 28 | 29 | Returns information about a Horizon View Pod Federation 30 | 31 | ## PARAMETERS 32 | 33 | ### -HvServer 34 | Reference to Horizon View Server to query the virtual machines from. 35 | If the value is not passed or null then 36 | first element from global:DefaultHVServers would be considered in-place of hvServer 37 | 38 | ```yaml 39 | Type: Object 40 | Parameter Sets: (All) 41 | Aliases: 42 | 43 | Required: False 44 | Position: 1 45 | Default value: None 46 | Accept pipeline input: False 47 | Accept wildcard characters: False 48 | ``` 49 | 50 | ### CommonParameters 51 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 52 | 53 | ## INPUTS 54 | 55 | ## OUTPUTS 56 | 57 | ## NOTES 58 | | | | 59 | |-|-| 60 | | Author | Wouter Kursten | 61 | | Author email | wouter@retouw.nl | 62 | | Version | 1.0 | 63 | 64 | ===Tested Against Environment==== 65 | | | | 66 | |-|-| 67 | | Horizon View Server Version | 7.3.2,7.4 | 68 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 69 | | PowerShell Version | 5.0 | 70 | 71 | ## RELATED LINKS 72 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVPreInstalledApplication.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVPreInstalledApplication 9 | 10 | ## SYNOPSIS 11 | Gets the list of Pre-installed Applications from the RDS Server(s). 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVPreInstalledApplication [-FarmName] [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets the list of Pre-installed Applications from the RDS Server(s). 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-HVPreInstalledApplication -FarmName 'Farm1' -HvServer $HvServer 27 | ``` 28 | 29 | Gets the list of Applications present in 'Farm1', if exists. 30 | 31 | ## PARAMETERS 32 | 33 | ### -FarmName 34 | Name of the Farm on which to discover installed applications. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByValue) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -HvServer 49 | View API service object of Connect-HVServer cmdlet. 50 | 51 | ```yaml 52 | Type: Object 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ## OUTPUTS 69 | 70 | ### Gets the list of Applications from the specified Farm if exists. 71 | ## NOTES 72 | | | | 73 | |-|-| 74 | | Author | Samiullasha S | 75 | | Author email | ssami@vmware.com | 76 | | Version | 1.0 | 77 | 78 | ===Tested Against Environment==== 79 | | | | 80 | |-|-| 81 | | Horizon View Server Version | 7.8.0 | 82 | | PowerCLI Version | PowerCLI 11.1 | 83 | | PowerShell Version | 5.0 | 84 | 85 | ## RELATED LINKS 86 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVResourceStructure.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVResourceStructure 9 | 10 | ## SYNOPSIS 11 | Output the structure of the resource pools available to a HV. 12 | Primarily this is for debugging 13 | 14 | PS\> Get-HVResourceStructure 15 | vCenter vc.domain.local 16 | Container DC path /DC/host 17 | HostOrCluster Servers path /DC/host/Servers 18 | HostOrCluster VDI path /DC/host/VDI 19 | ResourcePool Servers path /DC/host/Servers/Resources 20 | ResourcePool VDI path /DC/host/VDI/Resources 21 | ResourcePool RP1 path /DC/host/VDI/Resources/RP1 22 | ResourcePool RP2 path /DC/host/VDI/Resources/RP1/RP2 23 | 24 | | Author | Mark Elvers \ | 25 | 26 | ## SYNTAX 27 | 28 | ``` 29 | Get-HVResourceStructure [[-HvServer] ] [] 30 | ``` 31 | 32 | ## DESCRIPTION 33 | {{ Fill in the Description }} 34 | 35 | ## EXAMPLES 36 | 37 | ### Example 1 38 | ```powershell 39 | PS C:\> {{ Add example code here }} 40 | ``` 41 | 42 | {{ Add example description here }} 43 | 44 | ## PARAMETERS 45 | 46 | ### -HvServer 47 | {{ Fill HvServer Description }} 48 | 49 | ```yaml 50 | Type: Object 51 | Parameter Sets: (All) 52 | Aliases: 53 | 54 | Required: False 55 | Position: 1 56 | Default value: None 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### CommonParameters 62 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 63 | 64 | ## INPUTS 65 | 66 | ## OUTPUTS 67 | 68 | ## NOTES 69 | 70 | ## RELATED LINKS -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVSite.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVSite 9 | 10 | ## SYNOPSIS 11 | Returns information about the sites within a Horizon View Pod Federation (Cloud Pod Architecture) 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVSite [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Returns information about the sites within a Horizon View Pod Federation (Cloud Pod Architecture) 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | get-hvsite 27 | ``` 28 | 29 | Returns information about the sites within a Horizon View Pod Federation. 30 | 31 | ## PARAMETERS 32 | 33 | ### -HvServer 34 | Reference to Horizon View Server to query the virtual machines from. 35 | If the value is not passed or null then 36 | first element from global:DefaultHVServers would be considered in-place of hvServer 37 | 38 | ```yaml 39 | Type: Object 40 | Parameter Sets: (All) 41 | Aliases: 42 | 43 | Required: False 44 | Position: 1 45 | Default value: None 46 | Accept pipeline input: False 47 | Accept wildcard characters: False 48 | ``` 49 | 50 | ### CommonParameters 51 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 52 | 53 | ## INPUTS 54 | 55 | ## OUTPUTS 56 | 57 | ## NOTES 58 | | | | 59 | |-|-| 60 | | Author | Wouter Kursten | 61 | | Author email | wouter@retouw.nl | 62 | | Version | 1.0 | 63 | 64 | ===Tested Against Environment==== 65 | | | | 66 | |-|-| 67 | | Horizon View Server Version | 7.3.2,7.4 | 68 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 69 | | PowerShell Version | 5.0 | 70 | 71 | ## RELATED LINKS 72 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVlicense.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVlicense 9 | 10 | ## SYNOPSIS 11 | Gets the license for Horizon View 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVlicense [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets the license for Horizon View 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | get-hvlicense 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### -HvServer 32 | Reference to Horizon View Server to query the virtual machines from. 33 | If the value is not passed or null then 34 | first element from global:DefaultHVServers would be considered in-place of hvServer 35 | 36 | ```yaml 37 | Type: Object 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ## OUTPUTS 54 | 55 | ## NOTES 56 | | | | 57 | |-|-| 58 | | Author | Wouter Kursten | 59 | | Author email | wouter@retouw.nl | 60 | | Version | 1.0 | 61 | 62 | ===Tested Against Environment==== 63 | | | | 64 | |-|-| 65 | | Horizon View Server Version | 7.4,7.5 | 66 | | PowerCLI Version | PowerCLI 10 | 67 | | PowerShell Version | 5.0 | 68 | 69 | ## RELATED LINKS 70 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVvCenterServer.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVvCenterServer 9 | 10 | ## SYNOPSIS 11 | Gets a list of all configured vCenter Servers 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVvCenterServer [[-HvServer] ] [[-Name] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Queries and returns the vCenter Servers configured for the pod of the specified HVServer. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-HVvCenterServer 27 | ``` 28 | 29 | ### EXAMPLE 2 30 | ``` 31 | Get-HVvCenterServer -Name 'vCenter1' 32 | ``` 33 | 34 | ## PARAMETERS 35 | 36 | ### -HvServer 37 | Reference to Horizon View Server to query the virtual machines from. 38 | If the value is not passed or null then 39 | first element from global:DefaultHVServers would be considered inplace of hvServer 40 | 41 | ```yaml 42 | Type: Object 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -Name 54 | A string value to query a vCenter Server by Name, if it is known. 55 | 56 | ```yaml 57 | Type: String 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: False 62 | Position: 2 63 | Default value: None 64 | Accept pipeline input: False 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### CommonParameters 69 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 70 | 71 | ## INPUTS 72 | 73 | ## OUTPUTS 74 | 75 | ### Returns array of object type VMware.Hv.VirtualCenterInfo 76 | ## NOTES 77 | | | | 78 | |-|-| 79 | | Author | Matt Frey. | 80 | | Author email | mfrey@vmware.com | 81 | | Version | 1.0 | 82 | 83 | ===Tested Against Environment==== 84 | | | | 85 | |-|-| 86 | | Horizon View Server Version | 7.7 | 87 | | PowerCLI Version | PowerCLI 11.2.0 | 88 | | PowerShell Version | 5.1 | 89 | 90 | ## RELATED LINKS 91 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Get-HVvCenterServerHealth.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-HVvCenterServerHealth 9 | 10 | ## SYNOPSIS 11 | Gets a the health info for a given vCenter Server. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-HVvCenterServerHealth [[-HvServer] ] [[-VirtualCenter] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Queries and returns the VirtualCenterHealthInfo specified HVServer. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-HVvCenterServerHealth -VirtualCenter 'vCenter1' 27 | ``` 28 | 29 | ### EXAMPLE 2 30 | ``` 31 | Get-HVvCenterServerHealth -VirtualCenter $vCenter1 32 | ``` 33 | 34 | ### EXAMPLE 3 35 | ``` 36 | Get-HVvCenterServerHealth 37 | ``` 38 | 39 | ## PARAMETERS 40 | 41 | ### -HvServer 42 | Reference to Horizon View Server to query the virtual machines from. 43 | If the value is not passed or null then 44 | first element from global:DefaultHVServers would be considered inplace of hvServer 45 | 46 | ```yaml 47 | Type: Object 48 | Parameter Sets: (All) 49 | Aliases: 50 | 51 | Required: False 52 | Position: 1 53 | Default value: None 54 | Accept pipeline input: False 55 | Accept wildcard characters: False 56 | ``` 57 | 58 | ### -VirtualCenter 59 | A parameter to specify which vCenter Server to check health for. 60 | If not specified, this function will return the 61 | health info for all vCenter Servers. 62 | 63 | ```yaml 64 | Type: Object 65 | Parameter Sets: (All) 66 | Aliases: 67 | 68 | Required: False 69 | Position: 2 70 | Default value: None 71 | Accept pipeline input: False 72 | Accept wildcard characters: False 73 | ``` 74 | 75 | ### CommonParameters 76 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 77 | 78 | ## INPUTS 79 | 80 | ## OUTPUTS 81 | 82 | ### Returns array of object type VMware.Hv.VirtualCenterInfo 83 | ## NOTES 84 | | | | 85 | |-|-| 86 | | Author | Matt Frey. | 87 | | Author email | mfrey@vmware.com | 88 | | Version | 1.0 | 89 | 90 | ===Tested Against Environment==== 91 | | | | 92 | |-|-| 93 | | Horizon View Server Version | 7.7 | 94 | | PowerCLI Version | PowerCLI 11.2.0 | 95 | | PowerShell Version | 5.1 | 96 | 97 | ## RELATED LINKS 98 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/New-HVPodFederation.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-HVPodFederation 9 | 10 | ## SYNOPSIS 11 | Initiates a Horizon View Pod Federation (Cloud Pod Architecture) 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-HVPodFederation [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Starts the initialisation of a Horizon View Pod Federation. 21 | Other pod's can be joined to this federation to form the Cloud Pod Architecture 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | new-hvpodfederation 28 | ``` 29 | 30 | Returns health for the connectionserver(s) 31 | 32 | ## PARAMETERS 33 | 34 | ### -HvServer 35 | Reference to Horizon View Server to query the virtual machines from. 36 | If the value is not passed or null then 37 | first element from global:DefaultHVServers would be considered in-place of hvServer 38 | 39 | ```yaml 40 | Type: Object 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: False 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### CommonParameters 52 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 53 | 54 | ## INPUTS 55 | 56 | ## OUTPUTS 57 | 58 | ## NOTES 59 | | | | 60 | |-|-| 61 | | Author | Wouter Kursten | 62 | | Author email | wouter@retouw.nl | 63 | | Version | 1.0 | 64 | 65 | ===Tested Against Environment==== 66 | | | | 67 | |-|-| 68 | | Horizon View Server Version | 7.3.2,7.4 | 69 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 70 | | PowerShell Version | 5.0 | 71 | 72 | ## RELATED LINKS 73 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/New-HVSite.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-HVSite 9 | 10 | ## SYNOPSIS 11 | Creates a new site within a Horizon View Pod Federation (Cloud Pod Architecture) 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-HVSite [-name] [-description] [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Creates a new site within a Horizon View Pod Federation (Cloud Pod Architecture) 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | new-hvsite -name "NAME" -description "DESCRIPTION" 27 | ``` 28 | 29 | Returns information about the sites within a Horizon View Pod Federation. 30 | 31 | ## PARAMETERS 32 | 33 | ### -name 34 | Name of the site (required) 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -description 49 | Description of the site (required) 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -HvServer 64 | Reference to Horizon View Server to query the virtual machines from. 65 | If the value is not passed or null then 66 | first element from global:DefaultHVServers would be considered in-place of hvServer 67 | 68 | ```yaml 69 | Type: Object 70 | Parameter Sets: (All) 71 | Aliases: 72 | 73 | Required: False 74 | Position: 3 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### CommonParameters 81 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 82 | 83 | ## INPUTS 84 | 85 | ## OUTPUTS 86 | 87 | ## NOTES 88 | | | | 89 | |-|-| 90 | | Author | Wouter Kursten | 91 | | Author email | wouter@retouw.nl | 92 | | Version | 1.0 | 93 | 94 | ===Tested Against Environment==== 95 | | | | 96 | |-|-| 97 | | Horizon View Server Version | 7.3.2,7.4 | 98 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 99 | | PowerShell Version | 5.0 | 100 | 101 | ## RELATED LINKS 102 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Remove-HVPodFederation.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-HVPodFederation 9 | 10 | ## SYNOPSIS 11 | Uninitiates a Horizon View Pod Federation (Cloud Pod Architecture) 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-HVPodFederation [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Starts the uninitialisation of a Horizon View Pod Federation. 21 | It does NOT remove a pod from a federation. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Starts the Uninitiates a Horizon View Pod Federation. 28 | ``` 29 | 30 | Unintialises 31 | 32 | ## PARAMETERS 33 | 34 | ### -HvServer 35 | Reference to Horizon View Server to query the virtual machines from. 36 | If the value is not passed or null then 37 | first element from global:DefaultHVServers would be considered in-place of hvServer 38 | 39 | ```yaml 40 | Type: Object 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: False 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### CommonParameters 52 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 53 | 54 | ## INPUTS 55 | 56 | ## OUTPUTS 57 | 58 | ## NOTES 59 | | | | 60 | |-|-| 61 | | Author | Wouter Kursten | 62 | | Author email | wouter@retouw.nl | 63 | | Version | 1.0 | 64 | 65 | ===Tested Against Environment==== 66 | | | | 67 | |-|-| 68 | | Horizon View Server Version | 7.3.2,7.4 | 69 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 70 | | PowerShell Version | 5.0 | 71 | 72 | ## RELATED LINKS 73 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Remove-HVSite.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-HVSite 9 | 10 | ## SYNOPSIS 11 | renames a new site within a Horizon View Pod Federation (Cloud Pod Architecture) 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-HVSite [-name] [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | renames a new site within a Horizon View Pod Federation (Cloud Pod Architecture) 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | set-hvsite -site "CURRENTSITENAME" -name "NAME" -description "DESCRIPTION" 27 | ``` 28 | 29 | Returns information about the sites within a Horizon View Pod Federation. 30 | 31 | ## PARAMETERS 32 | 33 | ### -name 34 | Name of the site (required) 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -HvServer 49 | Reference to Horizon View Server to query the virtual machines from. 50 | If the value is not passed or null then 51 | first element from global:DefaultHVServers would be considered in-place of hvServer 52 | 53 | ```yaml 54 | Type: Object 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: False 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### CommonParameters 66 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 67 | 68 | ## INPUTS 69 | 70 | ## OUTPUTS 71 | 72 | ## NOTES 73 | | | | 74 | |-|-| 75 | | Author | Wouter Kursten | 76 | | Author email | wouter@retouw.nl | 77 | | Version | 1.0 | 78 | 79 | ===Tested Against Environment==== 80 | | | | 81 | |-|-| 82 | | Horizon View Server Version | 7.3.2,7.4 | 83 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 84 | | PowerShell Version | 5.0 | 85 | 86 | ## RELATED LINKS 87 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Set-HVPodFederation.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-HVPodFederation 9 | 10 | ## SYNOPSIS 11 | Used to change the name of a Horizon View Pod Federation (Cloud Pod Architecture) 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-HVPodFederation [-name] [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Used to change the name of a Horizon View Pod Federation (Cloud Pod Architecture) 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | set-hvpodfederation -name "New Name" 27 | ``` 28 | 29 | Will update the name of the current podfederation. 30 | 31 | ## PARAMETERS 32 | 33 | ### -name 34 | The new name of the Pod Federation. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -HvServer 49 | Reference to Horizon View Server to query the virtual machines from. 50 | If the value is not passed or null then 51 | first element from global:DefaultHVServers would be considered in-place of hvServer 52 | 53 | ```yaml 54 | Type: Object 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: False 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### CommonParameters 66 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 67 | 68 | ## INPUTS 69 | 70 | ## OUTPUTS 71 | 72 | ## NOTES 73 | | | | 74 | |-|-| 75 | | Author | Wouter Kursten | 76 | | Author email | wouter@retouw.nl | 77 | | Version | 1.0 | 78 | 79 | ===Tested Against Environment==== 80 | | | | 81 | |-|-| 82 | | Horizon View Server Version | 7.3.2,7.4 | 83 | | PowerCLI Version | PowerCLI 6.5, PowerCLI 6.5.1 | 84 | | PowerShell Version | 5.0 | 85 | 86 | ## RELATED LINKS 87 | -------------------------------------------------------------------------------- /Modules/VMware.Hv.Helper/docs/Set-HVlicense.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: VMware.HV.Helper-help.xml 3 | Module Name: VMware.HV.Helper 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-HVlicense 9 | 10 | ## SYNOPSIS 11 | Sets or changes the license for Horizon View 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-HVlicense [-license] [[-HvServer] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Sets or changes the license for Horizon View 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Set-HVlicense -license "LICENSE-KEY" 27 | ``` 28 | 29 | Returns information about the sites within a Horizon View Pod Federation. 30 | 31 | ## PARAMETERS 32 | 33 | ### -license 34 | License key (string) 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -HvServer 49 | Reference to Horizon View Server to query the virtual machines from. 50 | If the value is not passed or null then 51 | first element from global:DefaultHVServers would be considered in-place of hvServer 52 | 53 | ```yaml 54 | Type: Object 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: False 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### CommonParameters 66 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 67 | 68 | ## INPUTS 69 | 70 | ## OUTPUTS 71 | 72 | ## NOTES 73 | | | | 74 | |-|-| 75 | | Author | Wouter Kursten | 76 | | Author email | wouter@retouw.nl | 77 | | Version | 1.0 | 78 | 79 | ===Tested Against Environment==== 80 | | | | 81 | |-|-| 82 | | Horizon View Server Version | 7.4,7.5 | 83 | | PowerCLI Version | PowerCLI 10 | 84 | | PowerShell Version | 5.0 | 85 | 86 | ## RELATED LINKS 87 | -------------------------------------------------------------------------------- /Modules/VMware.TrustedInfrastructure.Helper/README.md: -------------------------------------------------------------------------------- 1 | Prerequisites/Steps to use this module: 2 | 1. You must be a Trust Authority Administrator, a part of the TrustedAdmins group and also have the "Host.Inventory.Add Host To Cluster" privilege on vCenter system. 3 | 2. The ESXi host must be wiped from existing Trusted Infrastructure configuration. If the ESXi host has been previously configured as part of vSphere Trust Authority (part of a vCenter configured for vSphere Trust Authority, a Trust Authority Cluster or Trusted Cluster), you must use the decommission script first. 4 | 3. Clusters should be in a healthy state (check all vSphere Trust Authority APIs which return Health field). 5 | 4. The ESXi host must be removed from vCenter. 6 | 5. You must know the ESXi host root credentials (username and password). 7 | 6. You must have purchased sufficient license for vSphere Trust Authority. 8 | 7. You must have PowerCLI 12.0.0 and above. 9 | 8. Following PowerCLI module is required to be imported: VMware.VimAutomation.Security. 10 | 9. Run the command Get-Command -Module VMware.TrustedInfrastructure.Helper. This should inform the following functions are available: 11 | - Add-TrustAuthorityVMHost 12 | - Add-TrustedVMHost 13 | If you do not see these functions listed, the PowerCLI module is not loaded correctly. 14 | 10. Run Get-Help Add-TrustAuthorityVMHost -full and Get-Help Add-TrustedVMHost -full to see how to use these two functions. 15 | 11. Others, please refer vSphere documentation. 16 | -------------------------------------------------------------------------------- /Modules/VMware.VCGChecker/Save-VCGJsonFile.ps1: -------------------------------------------------------------------------------- 1 | Function Save-VCGJsonFile{ 2 | Param( 3 | [Parameter(Mandatory=$true)] $FileName, 4 | [Parameter(Mandatory=$true)] $Data, 5 | [Parameter(Mandatory=$true)] $Dir 6 | ) 7 | $json = @() 8 | $Data | ForEach-Object { $json += $_.to_jsonobj()} 9 | 10 | if (!(Test-Path $Dir)) { 11 | New-Item -Type directory -Confirm:$false -Path $Dir -Force |Out-Null 12 | } 13 | 14 | $Path= $Dir + '\' + $FileName + '.json' 15 | info ("Saving data to " + $Path) 16 | ConvertTo-Json -Depth 10 -Compress $json | Out-File -encoding 'UTF8' -FilePath $Path 17 | } -------------------------------------------------------------------------------- /Modules/VMware.VCGChecker/logger.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Copyright 2018 VMware, Inc. All rights reserved. 3 | 4 | #> 5 | 6 | # Messages 7 | $HEADER_OK = "[OK] " 8 | $HEADER_INFO = "[INFO] " 9 | $HEADER_WARNING = "[WARNING] " 10 | $HEADER_ERR = "[ERROR] " 11 | 12 | Class DebugLog 13 | { 14 | # Static variables of the logger class 15 | static [string] $CAFILE_PATH = "./.certs/" 16 | 17 | [boolean] $debug 18 | [string] $logfile 19 | 20 | DebugLog() 21 | { 22 | $this.debug = $false 23 | $this.logfile = $null 24 | if (!(Test-Path $this::CAFILE_PATH)) 25 | { 26 | New-Item -Type directory -Confirm:$false -Path $this::CAFILE_PATH 27 | } 28 | } 29 | 30 | [void] SetDebug( 31 | [boolean] $debug, 32 | [string] $hostname 33 | ){ 34 | if (!$hostname) {$hostname = ''} 35 | $this.debug = $debug 36 | if ($this.debug) 37 | { 38 | $this.logfile = $this::CAFILE_PATH + $hostname + [DateTime]::Now.ToString("_yyyy-MM-dd_HH-mm") + ".log" 39 | }else{ 40 | $this.logfile = $null 41 | } 42 | } 43 | 44 | [void] log_vars( 45 | [string] $message, 46 | [object] $var 47 | ){ 48 | $this.log($message + $var) 49 | } 50 | 51 | [void] log( 52 | [string] $message 53 | ){ 54 | if (!$this.debug -or !$this.logfile) {return} 55 | try 56 | { 57 | $message | Out-File $this.logfile -Append 58 | }catch { 59 | Out-Host -InputObject ("[Exception] Failed to write to a logfile: " + $this.logfile) 60 | Out-Host -InputObject $_ 61 | } 62 | } 63 | } 64 | 65 | Function debug_vars( 66 | [string] $message, 67 | [object] $var) 68 | { 69 | $logger.log_vars($message, $var) 70 | } 71 | 72 | Function debug( 73 | [string] $message) 74 | { 75 | $logger.log($message) 76 | } 77 | 78 | Function vcglog( 79 | [string] $message, 80 | [string] $header="") 81 | { 82 | $msg = $header + $message 83 | $logger.log($msg) 84 | Out-Host -InputObject $msg 85 | } 86 | 87 | Function ok( 88 | [string] $message) 89 | { 90 | vcglog $message $HEADER_OK 91 | } 92 | 93 | Function warning( 94 | [string] $message) 95 | { 96 | vcglog $message $HEADER_WARNING 97 | } 98 | 99 | Function info( 100 | [string] $message) 101 | { 102 | vcglog $message $HEADER_INFO 103 | } 104 | 105 | Function error( 106 | [string] $message) 107 | { 108 | vcglog $message $HEADER_ERR 109 | } 110 | 111 | $logger = [DebugLog]::new() 112 | $logger.SetDebug($true, "vcc-debug") -------------------------------------------------------------------------------- /Modules/VMware.VMC/VMware.VMC.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.VMC/VMware.VMC.psd1 -------------------------------------------------------------------------------- /Modules/VMware.VMEncryption/README.md: -------------------------------------------------------------------------------- 1 | Prerequisites/Steps to use this module: 2 | 3 | 1. This module only works for vSphere products that support VM Encryption. E.g. vSphere 6.5 and later. 4 | 2. All the functions in this module only work for KMIP Servers. 5 | 3. Install the latest version of Powershell and PowerCLI. 6 | 4. Import this module by running: Import-Module -Name "location of this module" 7 | 5. Get-Command -Module "This module Name" to list all available functions. 8 | 9 | Note: 10 | Deprecating the below functions related to KMServer and KMSCluster from VMware.VMEncryption and using instead the ones from VMware.VimAutomation.Storage, 11 | 12 | 1, VMware.VMEncryption\Get-DefaultKMSCluster, use instead 13 | VMware.VimAutomation.Storage\Get-KmsCluster|where {$_.UseAsDefaultKeyProvider}|foreach {$_.id} 14 | 15 | 2, VMware.VMEncryption\Get-KMSCluster, use instead 16 | VMware.VimAutomation.Storage\Get-KmsCluster|select id 17 | 18 | 3, VMware.VMEncryption\Get-KMSClusterInfo, use instead 19 | VMware.VimAutomation.Storage\Get-KmsCluster|foreach {$_.extensiondata} 20 | 21 | 4, VMware.VMEncryption\Get-KMServerInfo, use instead 22 | VMware.VimAutomation.Storage\Get-KeyManagementServer|foreach {$_.extensiondata} 23 | 24 | 5, VMware.VMEncryption\New-KMServer, use instead 25 | VMware.VimAutomation.Storage\Add-KeyManagementServer 26 | 27 | 6, VMware.VMEncryption\Remove-KMServer, use instead 28 | VMware.VimAutomation.Storage\Remove-KeyManagementServer 29 | 30 | 7, VMware.VMEncryption\Set-DefaultKMSCluster, use instead 31 | VMware.VimAutomation.Storage\Set-KmsCluster -UseAsDefaultKeyProvider 32 | 33 | -------------------------------------------------------------------------------- /Modules/VMware.VsanEncryption/README.md: -------------------------------------------------------------------------------- 1 | Prerequisites/Steps to use this module: 2 | 3 | 1. This module only works for vSphere products that support vSAN Encryption. E.g. vSAN 6.6 and later with a vSAN Enterprise license 4 | 2. All the functions in this module only work for KMIP Servers. 5 | 3. Install the latest version of Powershell and PowerCLI(11). 6 | 4. Import this module by running: Import-Module -Name "location of this module" 7 | 5. Get-Command -Module "This module Name" to list all available functions. -------------------------------------------------------------------------------- /Modules/VMware.VsanEncryption/VMware.VsanEncryption.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.VsanEncryption/VMware.VsanEncryption.psd1 -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/README.md: -------------------------------------------------------------------------------- 1 | # PowerCLI Example module for managing vSphere SSO Admin 2 | This module is combination of .NET binary libraries for accessing vSphere SSO Admin API and PowerShell advanced functions exposing cmdlet-like interface to the SSO Admin features.
3 |
4 | The module supports PowerShell 5.1 and PowerShell 7.0 and above.
5 | 6 | # Using the module 7 | The module can be used without the '/src' directory. The '/src' directory contains the source code of the module.
8 | 9 | This module depends on PowerCLI 'VMware.VimAutomation.Common', Version 12.0 module
10 | 11 | # Using the source code 12 | ## '/src' directory 13 | This directory contains the .NET binaries sources code and Pester integration tests that cover both the binaries and the module advanced functions functionality.
14 | 15 | ## Required build tools 16 | - PowerShell 7.0
17 | - dotnet sdk
18 | 19 | ## Required test tools 20 | - PowerShell 7.0 21 | - PowerCLI 12.0
22 | - Pester 4.8.1
23 | 24 | ## '/src/build.ps1' script 25 | The script builds the binaries and publishes them to the 'net45' and 'netcoreapp2.0' directories of the module.
26 | 27 | It has also the option to run module Pester tests. The optional parameters for VC server and credentials has to be specified in order the script to run the tests. Tests run in separate PowreShell process because PowerShell has to load the module binaries which are build output.
28 | 29 | ## '/src/test/RunTests.ps1' script 30 | This script can be used to run the tests
-------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Module manifest for module 'VMware.vSphere.SsoAdmin' 3 | # 4 | # Generated by: dmilov@vmware.com 5 | # 6 | # Generated on: 9/25/20 7 | 8 | @{ 9 | 10 | # Script module or binary module file associated with this manifest 11 | RootModule = 'VMware.vSphere.SsoAdmin.psm1' 12 | 13 | # Version number of this module. 14 | ModuleVersion = '1.0.0' 15 | 16 | # ID used to uniquely identify this module 17 | GUID = 'b3e25326-e809-4d68-a252-ca5fcaf1eb8b' 18 | 19 | # Author of this module 20 | Author = 'Dimitar Milov' 21 | 22 | # Company or vendor of this module 23 | CompanyName = 'VMware, Inc.' 24 | 25 | # Copyright statement for this module 26 | Copyright = 'Copyright (c) VMware, Inc. All rights reserved.' 27 | 28 | # Description of the functionality provided by this module 29 | Description = 'PowerShell Module for Managing VMware vSphere SSO Admin functionality.' 30 | 31 | # Modules that must be imported into the global environment prior to importing this module 32 | RequiredModules = @( 33 | @{"ModuleName"="VMware.VimAutomation.Common";"ModuleVersion"="12.0.0.15939652"} 34 | ) 35 | 36 | # Functions to export from this module 37 | FunctionsToExport = @('Connect-SsoAdminServer', 'Disconnect-SsoAdminServer', 'New-SsoPersonUser', 'Get-SsoPersonUser', 'Set-SsoPersonUser', 'Remove-SsoPersonUser', 'Get-SsoGroup', 'Get-SsoPasswordPolicy', 'Set-SsoPasswordPolicy', 'Get-SsoLockoutPolicy', 'Set-SsoLockoutPolicy', 'Get-SsoTokenLifetime', 'Set-SsoTokenLifetime', 'Add-ActiveDirectoryIdentitySource') 38 | 39 | # Cmdlets to export from this module 40 | CmdletsToExport = @() 41 | 42 | # Variables to export from this module 43 | VariablesToExport = '' 44 | 45 | # Aliases to export from this module 46 | AliasesToExport = '*' 47 | } -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.LsClient.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.LsClient.dll -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Format.ps1xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Format.ps1xml -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Module manifest for module 'VMware.vSphere.SsoAdmin' 3 | # 4 | # Generated by: dmilov@vmware.com 5 | # 6 | # Generated on: 9/25/20 7 | 8 | @{ 9 | 10 | # Version number of this module. 11 | ModuleVersion = '1.0.0' 12 | 13 | # ID used to uniquely identify this module 14 | GUID = 'dd2b1928-e8ee-4c3a-a364-1caec6d3bd58' 15 | 16 | # Author of this module 17 | Author = 'Dimitar Milov' 18 | 19 | # Company or vendor of this module 20 | CompanyName = 'VMware, Inc.' 21 | 22 | # Copyright statement for this module 23 | Copyright = 'Copyright (c) VMware, Inc. All rights reserved.' 24 | 25 | # Description of the functionality provided by this module 26 | Description = 'PowerShell Module for Managing VMware vSphere SSO Admin functionality.' 27 | 28 | # Minimum version of the Windows PowerShell engine required by this module 29 | PowerShellVersion = '5.1' 30 | 31 | # Name of the Windows PowerShell host required by this module 32 | PowerShellHostName = '' 33 | 34 | # Minimum version of the Windows PowerShell host required by this module 35 | PowerShellHostVersion = '' 36 | 37 | # Minimum version of the .NET Framework required by this module 38 | DotNetFrameworkVersion = '4.5' 39 | 40 | # Minimum version of the common language runtime (CLR) required by this module 41 | CLRVersion = '4.0' 42 | 43 | # Processor architecture (None, X86, Amd64, IA64) required by this module 44 | ProcessorArchitecture = '' 45 | 46 | # Assemblies that must be loaded prior to importing this module 47 | RequiredAssemblies = @( 48 | 'VMware.vSphere.SsoAdmin.Utils.dll', 49 | 'VMware.vSphere.SsoAdminClient.dll', 50 | 'VMware.vSphere.LsClient.dll' 51 | ) 52 | 53 | # Script files (.ps1) that are run in the caller's environment prior to importing this module 54 | # ScriptsToProcess = @() 55 | 56 | # Type files (.ps1xml) to be loaded when importing this module 57 | # TypesToProcess = @() 58 | 59 | # Format files (.ps1xml) to be loaded when importing this module 60 | #FormatsToProcess = 'VMware.vSphere.SsoAdmin.Format.ps1xml' 61 | 62 | # Modules to import as nested modules of the module specified in ModuleToProcess 63 | #NestedModules= @() 64 | 65 | # Functions to export from this module 66 | FunctionsToExport = '*' 67 | 68 | # Cmdlets to export from this module 69 | CmdletsToExport = '*' 70 | 71 | # Variables to export from this module 72 | VariablesToExport = '*' 73 | 74 | # Aliases to export from this module 75 | AliasesToExport = '*' 76 | 77 | # List of all modules packaged with this module 78 | ModuleList = @() 79 | 80 | # List of all files packaged with this module 81 | FileList = '' 82 | 83 | # Private data to pass to the module specified in ModuleToProcess 84 | PrivateData = '' 85 | 86 | } -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.LsClient.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.LsClient.dll -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.Format.ps1xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.Format.ps1xml -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.Utils.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.Utils.dll -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Module manifest for module 'VMware.vSphere.SsoAdmin' 3 | # 4 | # Generated by: dmilov@vmware.com 5 | # 6 | # Generated on: 9/25/20 7 | 8 | @{ 9 | 10 | # Version number of this module. 11 | ModuleVersion = '1.0.0' 12 | 13 | # ID used to uniquely identify this module 14 | GUID = '29f1ed8b-311a-4ea1-80a6-0f3ec56e8259' 15 | 16 | # Author of this module 17 | Author = 'Dimitar Milov' 18 | 19 | # Company or vendor of this module 20 | CompanyName = 'VMware, Inc.' 21 | 22 | # Copyright statement for this module 23 | Copyright = 'Copyright (c) VMware, Inc. All rights reserved.' 24 | 25 | # Description of the functionality provided by this module 26 | Description = 'PowerShell Module for Managing VMware vSphere SSO Admin functionality.' 27 | 28 | # Minimum version of the Windows PowerShell engine required by this module 29 | PowerShellVersion = '6.0.1' 30 | 31 | # Specifies the compatible PSEditions of the module. 32 | CompatiblePSEditions = @('Core') 33 | 34 | # Name of the Windows PowerShell host required by this module 35 | PowerShellHostName = '' 36 | 37 | # Minimum version of the Windows PowerShell host required by this module 38 | PowerShellHostVersion = '' 39 | 40 | # Processor architecture (None, X86, Amd64, IA64) required by this module 41 | ProcessorArchitecture = '' 42 | 43 | # Assemblies that must be loaded prior to importing this module 44 | RequiredAssemblies = @( 45 | 'VMware.vSphere.SsoAdmin.Utils.dll', 46 | 'VMware.vSphere.SsoAdminClient.dll', 47 | 'VMware.vSphere.LsClient.dll' 48 | ) 49 | 50 | # Script files (.ps1) that are run in the caller's environment prior to importing this module 51 | # ScriptsToProcess = @() 52 | 53 | # Type files (.ps1xml) to be loaded when importing this module 54 | # TypesToProcess = @() 55 | 56 | # Format files (.ps1xml) to be loaded when importing this module 57 | #FormatsToProcess = 'VMware.vSphere.SsoAdmin.Format.ps1xml' 58 | 59 | # Modules to import as nested modules of the module specified in ModuleToProcess 60 | #NestedModules= @() 61 | 62 | # Functions to export from this module 63 | FunctionsToExport = '*' 64 | 65 | # Cmdlets to export from this module 66 | CmdletsToExport = '*' 67 | 68 | # Variables to export from this module 69 | VariablesToExport = '*' 70 | 71 | # Aliases to export from this module 72 | AliasesToExport = '*' 73 | 74 | # List of all modules packaged with this module 75 | ModuleList = @() 76 | 77 | # List of all files packaged with this module 78 | FileList = '' 79 | 80 | # Private data to pass to the module specified in ModuleToProcess 81 | PrivateData = '' 82 | 83 | } -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdminClient.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdminClient.dll -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/.gitignore: -------------------------------------------------------------------------------- 1 | **/.vs 2 | **/bin 3 | **/obj -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/Nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/Connected Services/LookupServiceReference/ConnectedService.json: -------------------------------------------------------------------------------- 1 | { 2 | "ProviderId": "Microsoft.VisualStudio.ConnectedService.Wcf", 3 | "Version": "15.0.20628.921", 4 | "ExtendedData": { 5 | "Uri": "https://10.23.80.205/lookupservice/wsdl/lookup.wsdl", 6 | "Namespace": "LookupServiceReference", 7 | "SelectedAccessLevelForGeneratedClass": "Public", 8 | "GenerateMessageContract": false, 9 | "ReuseTypesinReferencedAssemblies": true, 10 | "ReuseTypesinAllReferencedAssemblies": true, 11 | "CollectionTypeReference": { 12 | "Item1": "System.Array", 13 | "Item2": "System.Runtime.dll" 14 | }, 15 | "DictionaryCollectionTypeReference": { 16 | "Item1": "System.Collections.Generic.Dictionary`2", 17 | "Item2": "System.Collections.dll" 18 | }, 19 | "CheckedReferencedAssemblies": [], 20 | "InstanceId": null, 21 | "Name": "LookupServiceReference", 22 | "Metadata": {} 23 | } 24 | } -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/VMware.vSphere.LsClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | VMware.vSphere.LsClient 5 | VMware.vSphere.LsClient 6 | vSphere Lookup Service API client. 7 | net45;netcoreapp2.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/AcceptAllX509CertificateValidator.cs: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // Copyright 2020 VMware, Inc. 3 | // ************************************************************************** 4 | 5 | using System; 6 | using System.IdentityModel.Selectors; 7 | using System.Security.Cryptography.X509Certificates; 8 | 9 | namespace VMware.vSphere.SsoAdmin.Utils 10 | { 11 | public class AcceptAllX509CertificateValidator : X509CertificateValidator 12 | { 13 | public override void Validate(X509Certificate2 certificate) { 14 | // Check that there is a certificate. 15 | if (certificate == null) { 16 | throw new ArgumentNullException(nameof(certificate)); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/StirngToSecureStringArgumentTransformationAttribute.cs: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // Copyright 2020 VMware, Inc. 3 | // ************************************************************************** 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Management.Automation; 9 | using System.Security; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | 13 | namespace VMware.vSphere.SsoAdmin.Utils 14 | { 15 | public class StirngToSecureStringArgumentTransformationAttribute : ArgumentTransformationAttribute 16 | { 17 | private static class SecureStringConverter 18 | { 19 | public static SecureString ToSecureString(string value) { 20 | var result = new SecureString(); 21 | 22 | foreach (var c in value.ToCharArray()) { 23 | result.AppendChar(c); 24 | } 25 | 26 | return result; 27 | } 28 | } 29 | 30 | public override object Transform(EngineIntrinsics engineIntrinsics, object inputData) { 31 | object result = inputData; 32 | if (inputData is string s) { 33 | result = SecureStringConverter.ToSecureString(s); 34 | } 35 | return result; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/VMware.vSphere.SsoAdmin.Utils.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | VMware.vSphere.SsoAdmin.Utils 5 | VMware.vSphere.SsoAdmin.Utils 6 | vSphere Lookup SsoAdmin utility types. 7 | net45;netcoreapp2.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient.Tests/VMware.vSphere.SsoAdminClient.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/Group.cs: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // Copyright 2020 VMware, Inc. 3 | // ************************************************************************** 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace VMware.vSphere.SsoAdminClient.DataTypes 11 | { 12 | public class Group 13 | { 14 | public string Name { get; set; } 15 | public string Domain { get; set; } 16 | 17 | public override string ToString() { 18 | return $"{Name}@{Domain}"; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/LockoutPolicy.cs: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // Copyright 2020 VMware, Inc. 3 | // ************************************************************************** 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.ServiceModel.Security; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace VMware.vSphere.SsoAdminClient.DataTypes 13 | { 14 | public class LockoutPolicy 15 | { 16 | SsoAdminClient _client; 17 | public LockoutPolicy(SsoAdminClient client) { 18 | _client = client; 19 | } 20 | 21 | public SsoAdminClient GetClient() { 22 | return _client; 23 | } 24 | 25 | public string Description { get; set; } 26 | public long AutoUnlockIntervalSec { get; set; } 27 | public long FailedAttemptIntervalSec { get; set; } 28 | public int MaxFailedAttempts { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PasswordPolicy.cs: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // Copyright 2020 VMware, Inc. 3 | // ************************************************************************** 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace VMware.vSphere.SsoAdminClient.DataTypes 12 | { 13 | public class PasswordPolicy 14 | { 15 | SsoAdminClient _client; 16 | public PasswordPolicy(SsoAdminClient client) { 17 | _client = client; 18 | } 19 | 20 | public string Description { get; set; } 21 | public int ProhibitedPreviousPasswordsCount { get; set; } 22 | public int MinLength { get; set; } 23 | public int MaxLength { get; set; } 24 | public int MinNumericCount { get; set; } 25 | public int MinSpecialCharCount { get; set; } 26 | public int MaxIdenticalAdjacentCharacters { get; set; } 27 | public int MinAlphabeticCount { get; set; } 28 | public int MinUppercaseCount { get; set; } 29 | public int MinLowercaseCount { get; set; } 30 | public int PasswordLifetimeDays { get; set; } 31 | 32 | public SsoAdminClient GetClient() { 33 | return _client; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PersonUser.cs: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // Copyright 2020 VMware, Inc. 3 | // ************************************************************************** 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace VMware.vSphere.SsoAdminClient.DataTypes 11 | { 12 | public class PersonUser 13 | { 14 | SsoAdminClient _client; 15 | public PersonUser(SsoAdminClient client) { 16 | _client = client; 17 | } 18 | 19 | public string Name { get; set; } 20 | public string Domain { get; set; } 21 | public string Description { get; set; } 22 | public string FirstName { get; set; } 23 | public string LastName { get; set; } 24 | public string EmailAddress { get; set; } 25 | 26 | public SsoAdminClient GetClient() { 27 | return _client; 28 | } 29 | 30 | public override string ToString() { 31 | return $"{Name}@{Domain}"; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/SsoAdminServer.cs: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // Copyright 2020 VMware, Inc. 3 | // ************************************************************************** 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.IdentityModel.Selectors; 8 | using System.Linq; 9 | using System.Security; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | using VMware.Binding.Sts.StsService; 13 | 14 | namespace VMware.vSphere.SsoAdminClient.DataTypes 15 | { 16 | public class SsoAdminServer { 17 | 18 | private SsoAdminClient _client; 19 | 20 | public SsoAdminServer(string hostname, 21 | string user, 22 | SecureString password, 23 | X509CertificateValidator serverCertificateValidator) { 24 | 25 | Name = hostname; 26 | 27 | _client = new SsoAdminClient( 28 | hostname, 29 | user, 30 | password, 31 | serverCertificateValidator); 32 | 33 | Id = $"/SsoAdminServer={NormalizeUserName()}@{Name}"; 34 | } 35 | 36 | private string NormalizeUserName() { 37 | string result = User; 38 | if (User.Contains('@')) { 39 | var parts = User.Split('@'); 40 | var userName = parts[0]; 41 | var domain = parts[1]; 42 | result = $"{domain}/{userName}"; 43 | } 44 | return result; 45 | } 46 | 47 | public string Name { get; } 48 | public Uri ServiceUri => _client?.ServiceUri; 49 | public string User => _client?.User; 50 | public string Id { get; set; } 51 | public bool IsConnected => _client != null; 52 | public SsoAdminClient Client => _client; 53 | 54 | public void Disconnect() { 55 | _client = null; 56 | } 57 | 58 | public override string ToString() { 59 | return Name; 60 | } 61 | 62 | public override int GetHashCode() { 63 | return Id != null ? Id.GetHashCode() : base.GetHashCode(); 64 | } 65 | 66 | public override bool Equals(object obj) { 67 | bool result = false; 68 | if (obj is SsoAdminServer target) { 69 | result = string.Equals(Id, target.Id); 70 | } 71 | return result; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/TokenLifetime.cs: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // Copyright 2020 VMware, Inc. 3 | // ************************************************************************** 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace VMware.vSphere.SsoAdminClient.DataTypes 12 | { 13 | public class TokenLifetime 14 | { 15 | SsoAdminClient _client; 16 | public TokenLifetime(SsoAdminClient client) { 17 | _client = client; 18 | } 19 | 20 | public SsoAdminClient GetClient() { 21 | return _client; 22 | } 23 | 24 | public long MaxHoKTokenLifetime { get; set; } 25 | public long MaxBearerTokenLifetime { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/UserPassSecurityContext.cs: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // Copyright 2020 VMware, Inc. 3 | // ************************************************************************** 4 | using System; 5 | using System.Collections.Generic; 6 | using System.IdentityModel.Selectors; 7 | using System.Linq; 8 | using System.Security; 9 | using System.Security.Cryptography.X509Certificates; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | using System.Xml; 13 | using VMware.Binding.Sts; 14 | 15 | namespace VMware.vSphere.SsoAdminClient 16 | { 17 | public class UserPassSecurityContext 18 | { 19 | private string _user; 20 | private SecureString _password; 21 | private VmwareSecruityTokenService _stsClient; 22 | private SamlSecurityToken _validToken; 23 | public UserPassSecurityContext( 24 | string user, 25 | SecureString password, 26 | Uri stsUri, 27 | X509CertificateValidator serverCertificateValidator) { 28 | 29 | if (user == null) throw new ArgumentNullException(nameof(user)); 30 | if (password == null) throw new ArgumentNullException(nameof(password)); 31 | if (stsUri == null) throw new ArgumentNullException(nameof(stsUri)); 32 | 33 | _user = user; 34 | _password = password; 35 | 36 | Action certHandler = null; 37 | if (serverCertificateValidator != null) { 38 | certHandler = serverCertificateValidator.Validate; 39 | } 40 | _stsClient = new VmwareSecruityTokenService(stsUri, false, certHandler); 41 | } 42 | 43 | private void RenewIfNeeded() { 44 | if (_validToken == null || 45 | _validToken.Expires < (DateTime.Now + new TimeSpan(0, 0, 30))) { 46 | _validToken = _stsClient.IssueBearerTokenByUserCredential( 47 | _user, 48 | _password); 49 | } 50 | } 51 | 52 | public XmlElement GetToken() { 53 | RenewIfNeeded(); 54 | return _validToken.RawToken; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/VMware.vSphere.SsoAdminClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | VMware.vSphere.SsoAdminClient 5 | VMware.vSphere.SsoAdminClient 6 | SSO Admin API client. 7 | net45;netcoreapp2.0 8 | 9 | 10 | 11 | $(DefineConstants);NET45 12 | 13 | 14 | 15 | $(DefineConstants);NETCORE20 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Binding.Sts.12.0.0.15939652.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Binding.Sts.12.0.0.15939652.nupkg -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Binding.Sts.12.0.0.15939652.symbols.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Binding.Sts.12.0.0.15939652.symbols.nupkg -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Binding.WsTrust.12.0.0.15939652.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Binding.WsTrust.12.0.0.15939652.nupkg -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Binding.WsTrust.12.0.0.15939652.symbols.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Binding.WsTrust.12.0.0.15939652.symbols.nupkg -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Http.Handlers.12.0.0.15939652.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Http.Handlers.12.0.0.15939652.nupkg -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Http.Handlers.12.0.0.15939652.symbols.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Http.Handlers.12.0.0.15939652.symbols.nupkg -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.System.Private.ServiceModel.4.4.4.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.System.Private.ServiceModel.4.4.4.nupkg -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Util.Sspi.12.0.0.15939652.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Util.Sspi.12.0.0.15939652.nupkg -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Util.Sspi.12.0.0.15939652.symbols.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/packages/VMware.Util.Sspi.12.0.0.15939652.symbols.nupkg -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/test/Group.Tests.ps1: -------------------------------------------------------------------------------- 1 | # ************************************************************************** 2 | # Copyright 2020 VMware, Inc. 3 | # ************************************************************************** 4 | 5 | param( 6 | [Parameter(Mandatory = $true)] 7 | [string] 8 | $VcAddress, 9 | 10 | [Parameter(Mandatory = $true)] 11 | [string] 12 | $User, 13 | 14 | [Parameter(Mandatory = $true)] 15 | [string] 16 | $Password 17 | ) 18 | 19 | # Import Vmware.vSphere.SsoAdmin Module 20 | $modulePath = Join-Path (Split-Path $PSScriptRoot | Split-Path) "VMware.vSphere.SsoAdmin.psd1" 21 | Import-Module $modulePath 22 | 23 | Describe "Get-SsoGroup Tests" { 24 | BeforeEach { 25 | Connect-SsoAdminServer ` 26 | -Server $VcAddress ` 27 | -User $User ` 28 | -Password $Password ` 29 | -SkipCertificateCheck 30 | } 31 | 32 | AfterEach { 33 | $connectionsToCleanup = $global:DefaultSsoAdminServers.ToArray() 34 | foreach ($connection in $connectionsToCleanup) { 35 | Disconnect-SsoAdminServer -Server $connection 36 | } 37 | } 38 | 39 | Context "Get-SsoGroup" { 40 | It 'Gets groups without filters' { 41 | # Act 42 | $actual = Get-SsoGroup 43 | 44 | # Assert 45 | $actual | Should Not Be $null 46 | $actual.Count | Should BeGreaterThan 0 47 | $actual[0].Name | Should Not Be $null 48 | $actual[0].Domain | Should Be 'localos' 49 | } 50 | 51 | It 'Gets groups for default domain' { 52 | # Arrange 53 | $newUserName = "NewUser1" 54 | $password = '$tr0NG_TestPa$$w0rd' 55 | 56 | ## Create Person User to determine default domain name 57 | ## Person Users are created in the default domain 58 | $newPersonUser = New-SsoPersonUser ` 59 | -UserName $newUserName ` 60 | -Password $password 61 | 62 | # Act 63 | $actual = Get-SsoGroup ` 64 | -Domain $newPersonUser.Domain 65 | 66 | # Assert 67 | $actual | Should Not Be $null 68 | $actual.Count | Should BeGreaterThan 0 69 | $actual[0].Name | Should Not Be $null 70 | $actual[0].Domain | Should Be $newPersonUser.Domain 71 | 72 | # Cleanup 73 | Remove-SsoPersonUser -User $newPersonUser 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/test/LockoutPolicy.Tests.ps1: -------------------------------------------------------------------------------- 1 | # ************************************************************************** 2 | # Copyright 2020 VMware, Inc. 3 | # ************************************************************************** 4 | 5 | param( 6 | [Parameter(Mandatory = $true)] 7 | [string] 8 | $VcAddress, 9 | 10 | [Parameter(Mandatory = $true)] 11 | [string] 12 | $User, 13 | 14 | [Parameter(Mandatory = $true)] 15 | [string] 16 | $Password 17 | ) 18 | 19 | # Import Vmware.vSphere.SsoAdmin Module 20 | $modulePath = Join-Path (Split-Path $PSScriptRoot | Split-Path) "VMware.vSphere.SsoAdmin.psd1" 21 | Import-Module $modulePath 22 | 23 | Describe "LockoutPolicy Tests" { 24 | BeforeEach { 25 | Connect-SsoAdminServer ` 26 | -Server $VcAddress ` 27 | -User $User ` 28 | -Password $Password ` 29 | -SkipCertificateCheck 30 | } 31 | 32 | AfterEach { 33 | $connectionsToCleanup = $global:DefaultSsoAdminServers.ToArray() 34 | foreach ($connection in $connectionsToCleanup) { 35 | Disconnect-SsoAdminServer -Server $connection 36 | } 37 | } 38 | 39 | Context "Get-SsoLockoutPolicy" { 40 | It 'Gets lockout policy' { 41 | # Act 42 | $actual = Get-SsoLockoutPolicy 43 | 44 | # Assert 45 | $actual | Should Not Be $null 46 | } 47 | } 48 | 49 | Context "Set-SsoLockoutPolicy" { 50 | It 'Updates lockout policy AutoUnlockIntervalSec and MaxFailedAttempts' { 51 | # Arrange 52 | $lockoutPolicyToUpdate = Get-SsoLockoutPolicy 53 | $expectedAutoUnlockIntervalSec = 33 54 | $expectedMaxFailedAttempts = 7 55 | 56 | # Act 57 | $actual = Set-SsoLockoutPolicy ` 58 | -LockoutPolicy $lockoutPolicyToUpdate ` 59 | -AutoUnlockIntervalSec $expectedAutoUnlockIntervalSec ` 60 | -MaxFailedAttempts $expectedMaxFailedAttempts 61 | 62 | # Assert 63 | $actual | Should Not Be $null 64 | $actual.AutoUnlockIntervalSec | Should Be $expectedAutoUnlockIntervalSec 65 | $actual.MaxFailedAttempts | Should Be $expectedMaxFailedAttempts 66 | $actual.FailedAttemptIntervalSec | Should Be $lockoutPolicyToUpdate.FailedAttemptIntervalSec 67 | $actual.Description | Should Be $lockoutPolicyToUpdate.Description 68 | 69 | # Cleanup 70 | $lockoutPolicyToUpdate | Set-SsoLockoutPolicy 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1: -------------------------------------------------------------------------------- 1 | # ************************************************************************** 2 | # Copyright 2020 VMware, Inc. 3 | # ************************************************************************** 4 | 5 | param( 6 | [Parameter(Mandatory = $true)] 7 | [string] 8 | $VcAddress, 9 | 10 | [Parameter(Mandatory = $true)] 11 | [string] 12 | $User, 13 | 14 | [Parameter(Mandatory = $true)] 15 | [string] 16 | $Password 17 | ) 18 | 19 | # Import Vmware.vSphere.SsoAdmin Module 20 | $modulePath = Join-Path (Split-Path $PSScriptRoot | Split-Path) "VMware.vSphere.SsoAdmin.psd1" 21 | Import-Module $modulePath 22 | 23 | $script:lsClient = $null 24 | 25 | Describe "Lookup Service Client Integration Tests" { 26 | Context "Retrieval of Service API Url" { 27 | BeforeAll { 28 | ## Create LsClient 29 | $skipCertificateCheckValidator = New-Object ` 30 | 'VMware.vSphere.SsoAdmin.Utils.AcceptAllX509CertificateValidator' 31 | 32 | $script:lsClient = New-Object ` 33 | 'VMware.vSphere.LsClient.LookupServiceClient' ` 34 | -ArgumentList @($VCAddress, $skipCertificateCheckValidator) 35 | 36 | } 37 | 38 | It 'Gets SsoAdmin API Url' { 39 | # Act 40 | $actual = $script:lsClient.GetSsoAdminEndpointUri() 41 | 42 | # Assert 43 | $actual | Should Not Be $null 44 | $actual.ToString().StartsWith("https://$VCAddress/sso-adminserver/sdk/") | Should Be $true 45 | } 46 | 47 | It 'Gets STS API Url' { 48 | # Act 49 | $actual = $script:lsClient.GetStsEndpointUri() 50 | 51 | # Assert 52 | $actual | Should Not Be $null 53 | $actual.ToString().StartsWith("https://$VCAddress/sts/STSService") | Should Be $true 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1: -------------------------------------------------------------------------------- 1 | # ************************************************************************** 2 | # Copyright 2020 VMware, Inc. 3 | # ************************************************************************** 4 | 5 | param( 6 | [Parameter(Mandatory = $true)] 7 | [string] 8 | $VcAddress, 9 | 10 | [Parameter(Mandatory = $true)] 11 | [string] 12 | $User, 13 | 14 | [Parameter(Mandatory = $true)] 15 | [string] 16 | $Password 17 | ) 18 | 19 | function Test-PesterIsAvailable() { 20 | $pesterModule = Get-Module Pester -List 21 | if ($pesterModule -eq $null) { 22 | throw "Pester Module is not available" 23 | } 24 | } 25 | 26 | Test-PesterIsAvailable 27 | 28 | Invoke-Pester ` 29 | -Script @{ 30 | Path = $PSScriptRoot 31 | Parameters = @{ 32 | VcAddress = $VcAddress 33 | User = $User 34 | Password = $Password 35 | } 36 | } -------------------------------------------------------------------------------- /Modules/VMware.vSphere.SsoAdmin/src/test/TokenLifetime.Tests.ps1: -------------------------------------------------------------------------------- 1 | # ************************************************************************** 2 | # Copyright 2020 VMware, Inc. 3 | # ************************************************************************** 4 | 5 | param( 6 | [Parameter(Mandatory = $true)] 7 | [string] 8 | $VcAddress, 9 | 10 | [Parameter(Mandatory = $true)] 11 | [string] 12 | $User, 13 | 14 | [Parameter(Mandatory = $true)] 15 | [string] 16 | $Password 17 | ) 18 | 19 | # Import Vmware.vSphere.SsoAdmin Module 20 | $modulePath = Join-Path (Split-Path $PSScriptRoot | Split-Path) "VMware.vSphere.SsoAdmin.psd1" 21 | Import-Module $modulePath 22 | 23 | Describe "TokenLifetime Tests" { 24 | BeforeEach { 25 | Connect-SsoAdminServer ` 26 | -Server $VcAddress ` 27 | -User $User ` 28 | -Password $Password ` 29 | -SkipCertificateCheck 30 | } 31 | 32 | AfterEach { 33 | $connectionsToCleanup = $global:DefaultSsoAdminServers.ToArray() 34 | foreach ($connection in $connectionsToCleanup) { 35 | Disconnect-SsoAdminServer -Server $connection 36 | } 37 | } 38 | 39 | Context "Get-SsoTokenLifetime" { 40 | It 'Gets token lifetime settings' { 41 | # Act 42 | $actual = Get-SsoTokenLifetime 43 | 44 | # Assert 45 | $actual | Should Not Be $null 46 | $actual.MaxHoKTokenLifetime | Should BeGreaterThan 0 47 | $actual.MaxBearerTokenLifetime | Should BeGreaterThan 0 48 | } 49 | } 50 | 51 | Context "Set-SsoTokenLifetime" { 52 | It 'Updates MaxHoKTokenLifetime and MaxBearerTokenLifetime' { 53 | # Arrange 54 | $tokenLifetimeToUpdate = Get-SsoTokenLifetime 55 | $expectedMaxHoKTokenLifetime = 60 56 | $expectedMaxBearerTokenLifetime = 30 57 | 58 | # Act 59 | $actual = Set-SsoTokenLifetime ` 60 | -TokenLifetime $tokenLifetimeToUpdate ` 61 | -MaxHoKTokenLifetime $expectedMaxHoKTokenLifetime ` 62 | -MaxBearerTokenLifetime $expectedMaxBearerTokenLifetime 63 | 64 | # Assert 65 | $actual | Should Not Be $null 66 | $actual.MaxHoKTokenLifetime | Should Be $expectedMaxHoKTokenLifetime 67 | $actual.MaxBearerTokenLifetime | Should Be $expectedMaxBearerTokenLifetime 68 | 69 | # Cleanup 70 | $tokenLifetimeToUpdate | Set-SsoTokenLifetime ` 71 | -MaxHoKTokenLifetime $tokenLifetimeToUpdate.MaxHoKTokenLifetime ` 72 | -MaxBearerTokenLifetime $tokenLifetimeToUpdate.MaxBearerTokenLifetime 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /Modules/rCisTag/Examples/01-Get.ps1: -------------------------------------------------------------------------------- 1 | # Fetch Cis Server hostname and credentials 2 | .\CisConfig.ps1 3 | 4 | 5 | Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd 6 | 7 | # Get Tag information 8 | Get-rCisTag 9 | 10 | # Get Tag Category information 11 | Get-rCisTagCategory 12 | 13 | # Get Tag Assignment information 14 | Get-rCisTagAssignment 15 | 16 | Disconnect-rCisServer -Server $cisServer -Confirm:$false 17 | -------------------------------------------------------------------------------- /Modules/rCisTag/Examples/02-New.ps1: -------------------------------------------------------------------------------- 1 | # Fetch Cis Server hostname and credentials 2 | .\CisConfig.ps1 3 | 4 | Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd 5 | 6 | New-rCisTagCategory -Name MyCat1 -Cardinality Single -Description 'Test Tag Category' -EntityType 'VirtualMachine' 7 | New-rCisTag -Name MyTag1 -Category MyCat1 -Description 'Test Tag' 8 | $vm = Get-VM | Get-Random 9 | New-rCisTagAssignment -Entity $vm -Tag MyTag1 10 | 11 | Get-rCisTagAssignment -Tag MyTag1 12 | 13 | Disconnect-rCisServer -Server $cisServer -Confirm:$false 14 | -------------------------------------------------------------------------------- /Modules/rCisTag/Examples/03-Set.ps1: -------------------------------------------------------------------------------- 1 | # Fetch Cis Server hostname and credentials 2 | .\CisConfig.ps1 3 | 4 | Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd 5 | 6 | Get-rCisTag -Name MyTag1 | Set-rCisTag -Name MyNewTag1 -Description 'Name changed' 7 | 8 | Get-rCisTagCategory -Name MyCat1 | Set-rCisTagCategory -Cardinality Multiple -Name MyNewCat1 -Description 'Name changed' 9 | 10 | Disconnect-rCisServer -Server $cisServer -Confirm:$false 11 | -------------------------------------------------------------------------------- /Modules/rCisTag/Examples/04-Remove.ps1: -------------------------------------------------------------------------------- 1 | # Fetch Cis Server hostname and credentials 2 | .\CisConfig.ps1 3 | 4 | Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd 5 | 6 | Get-rCisTagAssignment -Tag MyNewTag1 | Remove-rCisTagAssignment -Confirm:$false 7 | 8 | Get-rCisTag -Name MyNewTag1 | Remove-rCisTag -Confirm:$false 9 | 10 | Get-rCisTagCategory -Name MyNewCat1 | Remove-rCisTagCategory -Confirm:$false 11 | 12 | Disconnect-rCisServer -Server $cisServer -Confirm:$false 13 | -------------------------------------------------------------------------------- /Modules/rCisTag/Examples/05-Tag-Datastore.ps1: -------------------------------------------------------------------------------- 1 | # Fetch Cis Server hostname and credentials 2 | .\CisConfig.ps1 3 | 4 | Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd 5 | 6 | $catName = 'Homelab' 7 | 8 | # Clean up 9 | Get-rCisTagCategory -Name $catName | Remove-rCisTagCategory -Confirm:$false 10 | 11 | # Tag all datastores with their type 12 | New-rCisTagCategory -Name HomeLab -Description 'Homelab datastores' -Cardinality Single -EntityType 'Datastore' | 13 | New-rCisTag -Name 'VMFS','NFS' -Description 'Datastore type' 14 | 15 | Get-Cluster -Name Cluster1 | Get-Datastore | %{ 16 | New-rCisTagAssignment -Entity $_ -Tag "$($_.Type)" 17 | } 18 | 19 | Disconnect-rCisServer -Server $cisServer -Confirm:$false 20 | -------------------------------------------------------------------------------- /Modules/rCisTag/Examples/CisConfig.ps1: -------------------------------------------------------------------------------- 1 | $cisServer = 'vcsa.my.domain' 2 | $cisUser = 'administrator@vsphere.local' 3 | $cisPswd = 'VMware1!' 4 | -------------------------------------------------------------------------------- /Modules/rCisTag/MITLicense.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) since 2015 Luc Dekens, Matt Boren 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Modules/rCisTag/README.md: -------------------------------------------------------------------------------- 1 | # rCisTag 2 | 3 | A module with cmdlets to provide CRUD functions to 4 | * Tags 5 | * Tag Categories 6 | * Tag Assignments 7 | 8 | The cmdlets use the Cis REST API 9 | 10 | ## History 11 | 12 | * Author : **Luc Dekens** 13 | * Release : 14 | * **0.9.0** First draft 15 | -------------------------------------------------------------------------------- /Modules/rCisTag/en-US/about_rCISTag.Help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_rCISTag 3 | 4 | SHORT DESCRIPTION 5 | The rCisTag module provides CRUD functions to work with vSphere Tags 6 | 7 | LONG DESCRIPTION 8 | The CisTag module provides CRUD functions to work with vSphere Tags. 9 | The functions in the module are based on the REST API 10 | 11 | NOTE 12 | The module requires PowerShell 5.0 13 | 14 | TROUBLESHOOTING NOTE 15 | 16 | 17 | 18 | EXAMPLES 19 | Get-rCisTag 20 | 21 | KEYWORDS 22 | 23 | 24 | 25 | SEE ALSO 26 | Place related topics here. -------------------------------------------------------------------------------- /Modules/rCisTag/rCISTag.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Modules/rCisTag/rCISTag.psd1 -------------------------------------------------------------------------------- /Pester/00 Test Connect-CISServer Connection to VC.Tests.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: Test Connect-CISServer to VC.Tests.ps1 3 | Created on: 04/20/2017 4 | Author: Alan Renouf, @alanrenouf 5 | Description: The purpose of this pester test is to ensure the PowerCLI modules are imported and a connection can be made to a vCenter for the CIS Service 6 | Dependencies: Pester Module 7 | Example run: 8 | 9 | Invoke-Pester -Script @{ Path = '.\Test Connect-CISServer to VC.Tests.ps1'; Parameters = @{ VCNAME="VC01.local"; VCUSER="Administrator@vsphere.local"; VCPASS="Admin!23"} } 10 | 11 | #> 12 | 13 | $VCUSER = $Parameters.Get_Item("VCUSER") 14 | $VCPASS = $Parameters.Get_Item("VCPASS") 15 | $VCNAME = $Parameters.Get_Item("VCNAME") 16 | 17 | Describe "Checking PowerCLI Cmdlets available" { 18 | $cmdletname = "Connect-CISServer" 19 | It "Checking $cmdletname is available" { 20 | $command = Get-Command $cmdletname 21 | $command | Select Name, Version 22 | $command.Name| Should Be $cmdletname 23 | } 24 | } 25 | 26 | Describe "Connect-CISServer Tests" { 27 | 28 | $connection = Connect-CISServer $VCName -User $VCUser -password $VCPass 29 | It "Connection is active" { 30 | $Global:DefaultCISServers[0].isconnected | Should Be $true 31 | } 32 | 33 | It "Checking connected server name is $VCName" { 34 | $Global:DefaultCISServers[0] | Select * 35 | $Global:DefaultCISServers[0].name | Should Be $VCName 36 | } 37 | } -------------------------------------------------------------------------------- /Pester/00 Test Connect-VIServer Connection to VC.Tests.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: Test Connection to VC.ps1 3 | Created on: 07/15/2016 4 | Author: Alan Renouf, @alanrenouf 5 | Description: The purpose of this pester test is to ensure the PowerCLI modules are imported and a connection can be made to a vCenter 6 | Dependencies: Pester Module 7 | Example run: 8 | 9 | Invoke-Pester -Script @{ Path = '.\Test Connection to VC.Tests.ps1'; Parameters = @{ VCNAME="VC01.local"; VCUSER="Administrator@vsphere.local"; VCPASS="Admin!23"} } 10 | 11 | #> 12 | 13 | $VCUSER = $Parameters.Get_Item("VCUSER") 14 | $VCPASS = $Parameters.Get_Item("VCPASS") 15 | $VCNAME = $Parameters.Get_Item("VCNAME") 16 | 17 | Describe "Checking PowerCLI Cmdlets available" { 18 | $cmdletname = "Connect-VIServer" 19 | It "Checking $cmdletname is available" { 20 | $command = Get-Command $cmdletname 21 | $command | Select Name, Version 22 | $command.Name| Should Be $cmdletname 23 | } 24 | } 25 | 26 | Describe "Connect-VIServer Tests" { 27 | 28 | $connection = Connect-VIServer $VCName -User $VCUser -password $VCPass 29 | It "Connection is active" { 30 | $Global:DefaultVIServer[0].isconnected | Should Be $true 31 | } 32 | 33 | It "Checking connected server name is $VCName" { 34 | $Global:DefaultVIServer[0].name | Should Be $VCName 35 | } 36 | } -------------------------------------------------------------------------------- /Pester/Functions/Get-VMCCommand.tests.ps1: -------------------------------------------------------------------------------- 1 | #Requires -Modules Pester, VMware.VMC, VMware.VimAutomation.Vmc 2 | 3 | 4 | inModuleScope VMware.VMC { 5 | $functionName = "Get-VMCCommand" 6 | Describe "$functionName" -Tag 'Unit' { 7 | Mock Get-Command { 8 | "Mocked Command Response" 9 | } 10 | 11 | Context "Behavior testing" { 12 | It "should call get-command on VMware.VimAutomation.Vmc" { 13 | { Get-VMCCommand } | Should Not Throw 14 | Assert-MockCalled -CommandName Get-command -Times 1 -Scope It -ParameterFilter { $Module -eq 'VMware.VimAutomation.Vmc' } 15 | 16 | } 17 | It "should call get-command on VMware.Vmc" { 18 | { Get-VMCCommand } | Should Not Throw 19 | Assert-MockCalled -CommandName Get-command -Times 1 -Scope It -ParameterFilter { $Module -eq 'VMware.VMC' } 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Pester/Functions/Shared.ps1: -------------------------------------------------------------------------------- 1 | #Requires -Modules Pester 2 | function defParam($command, $name) { 3 | It "Has a -$name parameter" { 4 | $command.Parameters.Item($name) | Should Not BeNullOrEmpty 5 | } 6 | } -------------------------------------------------------------------------------- /Pester/Test Get-CISService.Tests.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: Test Connect-CISService.Tests.ps1 3 | Created on: 04/20/2017 4 | Author: Alan Renouf, @alanrenouf 5 | Description: The purpose of this pester test is to ensure the CIS Service cmdlet works correctly 6 | Dependencies: Pester Module 7 | Example run: 8 | 9 | Invoke-Pester -Script @{ Path = '.\Test Get-CISService.ps1' } 10 | 11 | #> 12 | 13 | Describe "Checking PowerCLI Cmdlets available" { 14 | $cmdletname = "Get-CISService" 15 | It "Checking $cmdletname is available" { 16 | $command = Get-Command $cmdletname 17 | $command | Select Name, Version 18 | $command.Name| Should Be $cmdletname 19 | } 20 | } 21 | 22 | Describe "Get-CISService Tests for services" { 23 | 24 | It "Checking CIS connection is active" { 25 | $Global:DefaultCISServers[0].isconnected | Should Be $true 26 | } 27 | 28 | It "Checking Get-CISService returns services" { 29 | Get-CISService | Should Be $true 30 | } 31 | 32 | # Checking some known services which have a Get Method 33 | $servicestocheck = "com.vmware.appliance.system.version", "com.vmware.appliance.health.system" 34 | Foreach ($service in $servicestocheck) { 35 | It "Checking $service get method returns data" { 36 | Get-CisService -Name $service | Should Be $true 37 | (Get-CisService -Name $service).get() | Should Be $true 38 | } 39 | } 40 | 41 | # Checking some known services which have a List Method 42 | $servicestocheck = "com.vmware.vcenter.folder", "com.vmware.vcenter.vm" 43 | Foreach ($service in $servicestocheck) { 44 | It "Checking $service list method returns data" { 45 | Get-CisService -Name $service | Should Be $true 46 | (Get-CisService -Name $service).list() | Should Be $true 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Pester/VMCCode-Coverage.ps1: -------------------------------------------------------------------------------- 1 | Remove-Module VMware.VMC 2 | import-module ../Modules/VMware.VMC/VMware.VMC.psm1 3 | 4 | invoke-pester ./Functions -CodeCoverage ..\Modules\VMware.VMC\VMware.VMC.psm1 -------------------------------------------------------------------------------- /Pester/ZZ Test Disconnect-CISServer to VC.Tests.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: Test Disconnect-CISServer to VC.Tests.ps1 3 | Created on: 04/20/2017 4 | Author: Alan Renouf, @alanrenouf 5 | Description: The purpose of this pester test is to ensure the Disconnect-CISServer cmdlet disconnects 6 | Dependencies: Pester Module 7 | Example run: 8 | 9 | Invoke-Pester -Script @{ Path = '.\Test Disconnect-CISServer to VC.Tests.ps1'; Parameters = @{ VCNAME="VC01.local" } } 10 | 11 | #> 12 | 13 | $VCNAME = $Parameters.Get_Item("VCNAME") 14 | 15 | Describe "Disconnect-CISServer Tests" { 16 | It "Disconnect from $VCName" { 17 | Disconnect-CISServer $VCName -confirm:$false 18 | $Global:DefaultCISServers | Should Be $null 19 | } 20 | } -------------------------------------------------------------------------------- /Pester/ZZ Test Disconnect-VIServer to VC.Tests.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: Test Disconnect-VIServer to VC.ps1 3 | Created on: 04/20/2017 4 | Author: Alan Renouf, @alanrenouf 5 | Description: The purpose of this pester test is to ensure the Disconnect-VIServer cmdlet disconnects 6 | Dependencies: Pester Module 7 | Example run: 8 | 9 | Invoke-Pester -Script @{ Path = '.\Test Disconnect-VISServer to VC.ps1'; Parameters = @{ VCNAME="VC01.local" } } 10 | 11 | #> 12 | 13 | $VCNAME = $Parameters.Get_Item("VCNAME") 14 | 15 | Describe "Disconnect-VIServer Tests" { 16 | It "Disconnect from $VCName" { 17 | Disconnect-VIServer $VCName -confirm:$false 18 | $Global:DefaultVIServer | Should Be $null 19 | } 20 | } -------------------------------------------------------------------------------- /PowerActions/README.md: -------------------------------------------------------------------------------- 1 | PowerAction Scripts 2 | -------------------------------------------------------------------------------- /PowerActions/VM-CdDrive-Report.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .MYNGC_REPORT 3 | KEY\(VM\) 4 | .LABEL 5 | VM CD-Drive Report 6 | .DESCRIPTION 7 | PowerActions Report Script that reports on VMs CD-Drive configuration, making it easy to find VMs holding onto ISOs that you 8 | need to update, or VMs that can't vMotion because they are tied into a physical resource from the ESXi host that is running it. 9 | VM object is key (as it's the first managed object in the output), enabling you the ability to right-click an entry in the 10 | report to edit the target VM. Script is able to report on VMs with multiple CD-Drives as well. Version 1.0, written by 11 | Aaron Smith (@awsmith99), published 07/29/2016. 12 | #> 13 | 14 | param 15 | ( 16 | [Parameter(Mandatory=$true)] 17 | [VMware.VimAutomation.ViCore.Types.V1.Inventory.Cluster] 18 | $vParam 19 | ); 20 | 21 | [Array] $vmList = @( Get-VM -Location $vParam | Sort Name ); 22 | 23 | foreach ( $vmItem in $vmList ) 24 | { 25 | [Array] $vmCdDriveList = @( Get-CDDrive -VM $vmItem ); 26 | 27 | foreach ( $vmCdDriveItem in $vmCdDriveList ) 28 | { 29 | [String] $insertedElement = ""; 30 | [String] $connectionType = ""; 31 | 32 | switch ( $vmCdDriveItem ) 33 | { 34 | { $_.IsoPath } { $insertedElement = $_.IsoPath; $connectionType = "ISO"; break; } 35 | { $_.HostDevice } { $insertedElement = $_.HostDevice; $connectionType = "Host Device"; break; } 36 | { $_.RemoteDevice } { $insertedElement = $_.RemoteDevice; $connectionType = "Remote Device"; break; } 37 | default { $insertedElement = "None"; $connectionType = "Client Device"; break; } 38 | } 39 | 40 | $output = New-Object -TypeName PSObject; 41 | 42 | $output | Add-Member -MemberType NoteProperty -Name "VM" -Value $vmItem 43 | $output | Add-Member -MemberType NoteProperty -Name "CD-Drive" -Value $vmCdDriveItem.Name; 44 | $output | Add-Member -MemberType NoteProperty -Name "Connection" -Value $connectionType; 45 | $output | Add-Member -MemberType NoteProperty -Name "Inserted" -Value $insertedElement; 46 | $output | Add-Member -MemberType NoteProperty -Name "Connected" -Value $vmCdDriveItem.ConnectionState.Connected; 47 | $output | Add-Member -MemberType NoteProperty -Name "StartConnected" -Value $vmCdDriveItem.ConnectionState.StartConnected; 48 | $output | Add-Member -MemberType NoteProperty -Name "AllowGuestControl" -Value $vmCdDriveItem.ConnectionState.AllowGuestControl; 49 | $output; 50 | } 51 | } -------------------------------------------------------------------------------- /PowerActions/VM-Snapshot-Report.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .MYNGC_REPORT 3 | KEY\(VM\) 4 | .LABEL 5 | VM Snapshot Report 6 | .DESCRIPTION 7 | PowerActions Report Script that reports on VMs with snapshots along with their description, date of the snapshot, age in days of the snapshot, size of the snapshot in GB, 8 | the VM's provisioned vs. used space in GB, if the snapshot is the current one being used, its parent snapshot (if there is one), and the Power state of the VM itself. VM 9 | object is key (as it's the first managed object in the output), enabling you the ability to right-click an entry in the report to edit the target VM. Version 1.0, written 10 | by Aaron Smith (@awsmith99), published 08/10/2016. 11 | #> 12 | 13 | param 14 | ( 15 | [Parameter(Mandatory=$true)] 16 | [VMware.VimAutomation.ViCore.Types.V1.Inventory.Cluster] 17 | $vParam 18 | ); 19 | 20 | [Array] $vmList = @( Get-VM -Location $vParam | Sort Name ); 21 | 22 | foreach ( $vmItem in $vmList ) 23 | { 24 | [Array] $vmSnapshotList = @( Get-Snapshot -VM $vmItem ); 25 | 26 | foreach ( $snapshotItem in $vmSnapshotList ) 27 | { 28 | $vmProvisionedSpaceGB = [Math]::Round( $vmItem.ProvisionedSpaceGB, 2 ); 29 | $vmUsedSpaceGB = [Math]::Round( $vmItem.UsedSpaceGB, 2 ); 30 | $snapshotSizeGB = [Math]::Round( $snapshotItem.SizeGB, 2 ); 31 | $snapshotAgeDays = ((Get-Date) - $snapshotItem.Created).Days; 32 | 33 | $output = New-Object -TypeName PSObject; 34 | 35 | $output | Add-Member -MemberType NoteProperty -Name "VM" -Value $vmItem; 36 | $output | Add-Member -MemberType NoteProperty -Name "Name" -Value $snapshotItem.Name; 37 | $output | Add-Member -MemberType NoteProperty -Name "Description" -Value $snapshotItem.Description; 38 | $output | Add-Member -MemberType NoteProperty -Name "Created" -Value $snapshotItem.Created; 39 | $output | Add-Member -MemberType NoteProperty -Name "AgeDays" -Value $snapshotAgeDays; 40 | $output | Add-Member -MemberType NoteProperty -Name "ParentSnapshot" -Value $snapshotItem.ParentSnapshot.Name; 41 | $output | Add-Member -MemberType NoteProperty -Name "IsCurrentSnapshot" -Value $snapshotItem.IsCurrent; 42 | $output | Add-Member -MemberType NoteProperty -Name "SnapshotSizeGB" -Value $snapshotSizeGB; 43 | $output | Add-Member -MemberType NoteProperty -Name "ProvisionedSpaceGB" -Value $vmProvisionedSpaceGB; 44 | $output | Add-Member -MemberType NoteProperty -Name "UsedSpaceGB" -Value $vmUsedSpaceGB; 45 | $output | Add-Member -MemberType NoteProperty -Name "PowerState" -Value $snapshotItem.PowerState; 46 | 47 | $output; 48 | } 49 | } -------------------------------------------------------------------------------- /Scripts/At_Your_Fingertips/install-profile.ps1: -------------------------------------------------------------------------------- 1 | [cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] 2 | param( 3 | # [Parameter(Mandatory = $true)] 4 | [ValidateSet('CurrentUserCurrentHost', 'CurrentUserAllHosts', 5 | 'AllUsersCurrentHost', 'AllUsersAllHosts')] 6 | [string]$Scope, 7 | [switch]$NoClobber, 8 | [switch]$Backup, 9 | [string]$NewProfile = '.\NewProfile.ps1' 10 | ) 11 | 12 | if ($PSCmdlet.ShouldProcess("$($Profile.$Scope)", "Create $Scope profile")) 13 | { 14 | $profilePath = $Profile."$Scope" 15 | Write-Verbose -Message "Target is $profilePath" 16 | $createProfile = $true 17 | if (Test-Path -Path $profilePath) 18 | { 19 | Write-Verbose -Message "Target exists" 20 | if ($NoClobber) 21 | { 22 | Write-Verbose -Message "Cannot overwrite target due to NoClobber" 23 | $createProfile = $false 24 | } 25 | elseif ($Backup) 26 | { 27 | Write-Verbose -Message "Create a backup as $profilePath.bak" 28 | Copy-Item -Path $profilePath -Destination "$profilePath.bak" -Confirm:$false -Force 29 | } 30 | elseif (-not $NoClobber) 31 | { 32 | Write-Verbose -Message "Target will be overwritten" 33 | } 34 | else 35 | { 36 | Write-Verbose -Message "Use -NoClobber:$false or -Backup" 37 | } 38 | } 39 | if ($createProfile) 40 | { 41 | if (-not $NewProfile) 42 | { 43 | $script:MyInvocation.MyCommand | select * 44 | $folder = Split-Path -Parent -Path $script:MyInvocation.MyCommand.Path 45 | $folder = Get-Location 46 | $NewProfile = "$folder\NewProfile.ps1" 47 | } 48 | Write-Verbose -Message "New profile expected at $NewProfile" 49 | if (Test-Path -Path $NewProfile) 50 | { 51 | Write-Verbose -Message "Copy $NewProfile to $profilePath" 52 | Copy-Item -Path $NewProfile -Destination $profilePath -Confirm:$false 53 | } 54 | else 55 | { 56 | Write-Warning -Message "Could not find the new profile file!" 57 | Write-Warning -Message "Use the NewProfile parameter or store a NewProfile.ps1 file in folder $folder." 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /Scripts/Check-VMwareTools.ps1: -------------------------------------------------------------------------------- 1 | function Check-Tools { 2 | <# 3 | .NOTES 4 | =========================================================================== 5 | Created by: Brian Graf 6 | Organization: VMware 7 | Official Blog: blogs.vmware.com/PowerCLI 8 | Personal Blog: www.vtagion.com 9 | Twitter: @vBrianGraf 10 | =========================================================================== 11 | .DESCRIPTION 12 | This will quickly return all VMs that have VMware Tools out of date 13 | Along with the version that it is running 14 | .Example 15 | Check-Tools -VMs (Get-VM) 16 | .Example 17 | $SampleVMs = Get-VM "Mgmt*" 18 | Check-Tools -VMs $SampleVMs 19 | #> 20 | [CmdletBinding()] 21 | param( 22 | [Parameter(Mandatory=$true, 23 | ValueFromPipeline=$True, 24 | Position=0)] 25 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]] 26 | $VMs 27 | ) 28 | Process { 29 | #foreach ($VM in $VMs) { 30 | $OutofDate = $VMs | where {$_.ExtensionData.Guest.ToolsStatus -ne "toolsOk"} 31 | $Result = @($OutofDate | select Name,@{Name="ToolsVersion";Expression={$_.ExtensionData.Guest.Toolsversion}}) 32 | 33 | $Result 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /Scripts/CreateVLANonStandardSwitch: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: CreateVLANonStandardSwitch.ps1 3 | Created on: 10/26/2017 4 | Author: Alan Comstock, @Mr_Uptime 5 | Description: Adds VLANs to an existing standard switch 6 | Dependencies: None known 7 | PowerCLI Version: VMware PowerCLI 6.5 Release 1 build 4624819 8 | PowerShell Version: 5.1.14393.1532 9 | OS Version: Windows 10 10 | #> 11 | 12 | $esxhost="HOSTNAME" 13 | $vswitch="vSwitch0" 14 | $vlanlist=10,20,30,40,50 15 | Foreach ($vlan in $vlanlist) { 16 | $portgroupname="VLAN " + $vlan 17 | Get-VMHost $esxhost | Get-VirtualSwitch -name $vswitch | New-VirtualPortGroup -Name $portgroupname -VLanId $vlan 18 | } 19 | #The End 20 | -------------------------------------------------------------------------------- /Scripts/ESXInstallDate.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS Retrieve the installation date of an ESXi host 3 | .NOTES Author: William Lam 4 | .NOTES Site: www.virtuallyghetto.com 5 | .NOTES Reference: http://www.virtuallyghetto.com/2016/10/super-easy-way-of-getting-esxi-installation-date-in-vsphere-6-5.html 6 | .PARAMETER Vmhost 7 | ESXi host to query installation date 8 | .EXAMPLE 9 | Get-Vmhost "mini" | Get-ESXInstallDate 10 | #> 11 | 12 | Function Get-ESXInstallDate { 13 | param( 14 | [Parameter( 15 | Mandatory=$true, 16 | ValueFromPipeline=$true, 17 | ValueFromPipelineByPropertyName=$true) 18 | ] 19 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$Vmhost 20 | ) 21 | 22 | if($Vmhost.Version -eq "6.5.0") { 23 | $imageManager = Get-View ($Vmhost.ExtensionData.ConfigManager.ImageConfigManager) 24 | $installDate = $imageManager.installDate() 25 | 26 | Write-Host "$Vmhost was installed on $installDate" 27 | } else { 28 | Write-Host "ESXi must be running 6.5" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Scripts/ESXInstalledVIBs.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS Retrieve the installation date of an ESXi host 3 | .NOTES Author: William Lam 4 | .NOTES Site: www.virtuallyghetto.com 5 | .PARAMETER Vmhost 6 | ESXi host to query installed ESXi VIBs 7 | .EXAMPLE 8 | Get-ESXInstalledVibs -Vmhost (Get-Vmhost "mini") 9 | .EXAMPLE 10 | Get-ESXInstalledVibs -Vmhost (Get-Vmhost "mini") -vibname vsan 11 | #> 12 | 13 | Function Get-ESXInstalledVibs { 14 | param( 15 | [Parameter( 16 | Mandatory=$true, 17 | ValueFromPipeline=$true, 18 | ValueFromPipelineByPropertyName=$true) 19 | ] 20 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$Vmhost, 21 | [Parameter( 22 | Mandatory=$false, 23 | ValueFromPipeline=$true, 24 | ValueFromPipelineByPropertyName=$true) 25 | ] 26 | [String]$vibname="" 27 | ) 28 | 29 | $imageManager = Get-View ($Vmhost.ExtensionData.ConfigManager.ImageConfigManager) 30 | $vibs = $imageManager.fetchSoftwarePackages() 31 | 32 | foreach ($vib in $vibs) { 33 | if($vibname -ne "") { 34 | if($vib.name -eq $vibname) { 35 | return $vib | select Name, Version, Vendor, CreationDate, Summary 36 | } 37 | } else { 38 | $vib | select Name, Version, Vendor, CreationDate, Summary 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Scripts/Get-BasicVMCapacityReport: -------------------------------------------------------------------------------- 1 | 2 | $myCol = @() 3 | $start = (Get-Date).AddDays(-30) 4 | $finish = Get-Date 5 | $cluster= "Demo" 6 | 7 | $objServers = Get-Cluster $cluster | Get-VM 8 | foreach ($server in $objServers) { 9 | if ($server.guest.osfullname -ne $NULL){ 10 | if ($server.guest.osfullname.contains("Windows")){ 11 | $stats = get-stat -Entity $server -Stat "cpu.usage.average","mem.usage.average" -Start $start -Finish $finish 12 | 13 | $ServerInfo = "" | Select-Object vName, OS, Mem, AvgMem, MaxMem, CPU, AvgCPU, MaxCPU, pDisk, Host 14 | $ServerInfo.vName = $server.name 15 | $ServerInfo.OS = $server.guest.osfullname 16 | $ServerInfo.Host = $server.vmhost.name 17 | $ServerInfo.Mem = $server.memoryGB 18 | $ServerInfo.AvgMem = $("{0:N2}" -f ($stats | Where-Object {$_.MetricId -eq "mem.usage.average"} | Measure-Object -Property Value -Average).Average) 19 | $ServerInfo.MaxMem = $("{0:N2}" -f ($stats | Where-Object {$_.MetricId -eq "mem.usage.average"} | Measure-Object -Property Value -Maximum).Maximum) 20 | $ServerInfo.CPU = $server.numcpu 21 | $ServerInfo.AvgCPU = $("{0:N2}" -f ($stats | Where-Object {$_.MetricId -eq "cpu.usage.average"} | Measure-Object -Property Value -Average).Average) 22 | $ServerInfo.MaxCPU = $("{0:N2}" -f ($stats | Where-Object {$_.MetricId -eq "cpu.usage.average"} | Measure-Object -Property Value -Maximum).Maximum) 23 | $ServerInfo.pDisk = [Math]::Round($server.ProvisionedSpaceGB,2) 24 | 25 | $mycol += $ServerInfo 26 | } 27 | } 28 | } 29 | 30 | $myCol | Sort-Object vName | Export-Csv "VM_report.csv" -NoTypeInformation 31 | -------------------------------------------------------------------------------- /Scripts/Get-BiosBootStatus.ps1: -------------------------------------------------------------------------------- 1 | function Get-BiosBootStatus { 2 | <# 3 | .NOTES 4 | =========================================================================== 5 | Created by: Brian Graf 6 | Organization: VMware 7 | Official Blog: blogs.vmware.com/PowerCLI 8 | Personal Blog: www.vtagion.com 9 | Twitter: @vBrianGraf 10 | =========================================================================== 11 | .DESCRIPTION 12 | This will return the boot status of Virtual Machines, whether they 13 | are booting to the Guest OS or being forced to boot into BIOS. 14 | .Example 15 | # Returns all VMs and where they are booting 16 | Get-BiosBootStatus -VMs (Get-VM) 17 | .Example 18 | # Only returns VMs that are booting to BIOS 19 | Get-BiosBootStatus (Get-VM) -IsSetup 20 | 21 | #> 22 | [CmdletBinding()] 23 | param( 24 | [Parameter(Mandatory=$true, 25 | ValueFromPipeline=$True, 26 | Position=0)] 27 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]] 28 | $VM, 29 | [switch]$IsSetup 30 | ) 31 | Process { 32 | if($IsSetup) 33 | { 34 | $Execute = $VM | where {$_.ExtensionData.Config.BootOptions.EnterBiosSetup -eq "true"} | Select Name,@{Name="EnterBiosSetup";Expression={$_.ExtensionData.config.BootOptions.EnterBiosSetup}} 35 | } 36 | else 37 | { 38 | $Execute = $VM | Select Name,@{Name="EnterBiosSetup";Expression={$_.ExtensionData.config.BootOptions.EnterBiosSetup}} 39 | } 40 | } 41 | End {$Execute} 42 | } -------------------------------------------------------------------------------- /Scripts/Get-DatastoreProvisioned.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: Get-DatastoreProvisioned.ps1 3 | Created on: 2016/07/27 4 | Author: Brian Bunke, @brianbunke 5 | Description: Augments Get-Datastore with thin provisioned info 6 | Note to future contributors: Test changes with Pester file Get-DatastoreProvisioned.Tests.ps1 7 | 8 | ===Tested Against Environment==== 9 | vSphere Version: 6.0 U1/U2 10 | PowerCLI Version: PowerCLI 6.3 R1 11 | PowerShell Version: 5.0 12 | OS Version: Windows 7/10 13 | #> 14 | 15 | function Get-DatastoreProvisioned { 16 | <# 17 | .SYNOPSIS 18 | Retrieve the total thin provisioned space on each datastore. 19 | 20 | .DESCRIPTION 21 | Intended to reveal provisioned space alongside total/free space, to assist with svMotion decisions. 22 | -Name should be supplied from the pipeline via Get-Datastore. 23 | 24 | .EXAMPLE 25 | Get-Datastore | Get-DatastoreProvisioned | Format-Table -AutoSize 26 | View all datastores and view their capacity statistics in the current console. 27 | 28 | .EXAMPLE 29 | Get-Datastore -Name '*ssd' | Get-DatastoreProvisioned | Where-Object -Property ProvisionedPct -ge 100 30 | For all datastores ending in 'ssd', return the capacity stats of those at least 100% provisioned. 31 | 32 | .INPUTS 33 | [VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl] 34 | Object type supplied by PowerCLI function Get-Datastore 35 | 36 | .LINK 37 | https://github.com/vmware/PowerCLI-Example-Scripts 38 | 39 | .LINK 40 | https://twitter.com/brianbunke 41 | #> 42 | [CmdletBinding()] 43 | param ( 44 | # Specifies the datastore names to check. Tested only with pipeline input (see examples). 45 | [Parameter(ValueFromPipeline = $true)] 46 | $Name 47 | ) 48 | 49 | PROCESS { 50 | ForEach ($DS in $Name) { 51 | # Calculate total provisioned space from the exposed properties 52 | $Provisioned = ($DS.ExtensionData.Summary.Capacity - 53 | $DS.ExtensionData.Summary.FreeSpace + 54 | $DS.ExtensionData.Summary.Uncommitted) / 1GB 55 | 56 | # Return info, wrapping it in the Math.Round method to trim to two decimal places 57 | [PSCustomObject]@{ 58 | Name = $DS.Name 59 | FreeSpaceGB = [math]::Round($DS.FreeSpaceGB, 2) 60 | CapacityGB = [math]::Round($DS.CapacityGB, 2) 61 | ProvisionedGB = [math]::Round($Provisioned, 2) 62 | UsedPct = [math]::Round((($DS.CapacityGB - $DS.FreeSpaceGB) / $DS.CapacityGB) * 100, 2) 63 | ProvisionedPct = [math]::Round(($Provisioned / $DS.CapacityGB) * 100, 2) 64 | } #pscustomobject 65 | } #foreach 66 | } #process 67 | } #function 68 | -------------------------------------------------------------------------------- /Scripts/Get-Migrations.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: get-migrations.ps1 3 | Created on: 20/12/2018 4 | Author: Chris Bradshaw @aldershotchris 5 | Description: The purpose of the script is to list the currently running + recently finished VM migrations. 6 | Dependencies: None known 7 | #> 8 | Function Get-Migrations{ 9 | Get-Task | 10 | Where-Object{$_.Name -eq "RelocateVM_Task"} | 11 | Select-Object @{Name="VM";Expression={Get-VM -Id $_.ObjectID}}, State, @{Name="% Complete";Expression={$_.PercentComplete}},StartTime 12 | } 13 | -------------------------------------------------------------------------------- /Scripts/Get-TotalDiskUsage.ps1: -------------------------------------------------------------------------------- 1 | #Script returns total disk usage by all Powered On VMs in the environment in Gigabytes 2 | #Author: Chris Bradshaw via https://isjw.uk/using-powercli-to-measure-vm-disk-space-usage/ 3 | 4 | [math]::Round(((get-vm | Where-object{$_.PowerState -eq "PoweredOn" }).UsedSpaceGB | measure-Object -Sum).Sum) 5 | -------------------------------------------------------------------------------- /Scripts/Get-TotalMemoryAllocation.ps1: -------------------------------------------------------------------------------- 1 | #Script gets total memory allocation in GB of all powered on VMs in the environment 2 | #Author: Chris Bradshaw via https://isjw.uk/powercli-snippet-total-memory-allocation/ 3 | 4 | [System.Math]::Round(((get-vm | 5 | where-object{$_.PowerState -eq "PoweredOn" }).MemoryGB | 6 | Measure-Object -Sum).Sum ,0) 7 | -------------------------------------------------------------------------------- /Scripts/Get-TriggeredAlarm.ps1: -------------------------------------------------------------------------------- 1 | function Get-TriggeredAlarm { 2 | <# 3 | .SYNOPSIS 4 | This function lists the triggered alarms for the specified entity in vCenter 5 | .DESCRIPTION 6 | List the triggered alarms for the given object 7 | .NOTES 8 | Author: Kyle Ruddy, @kmruddy, kmruddy.com 9 | .PARAMETER VM 10 | Specifies the name of the VM 11 | .PARAMETER VMHost 12 | Specifies the name of the VMHost 13 | .PARAMETER Datacenter 14 | Specifies the name of the Datacenter 15 | .PARAMETER Datastore 16 | Specifies the name of the Datastore 17 | .EXAMPLE 18 | Get-TriggeredAlarm -VM VMname 19 | 20 | Entity Alarm AlarmStatus AlarmMoRef EntityMoRef 21 | ---- ---- ---- ---- ---- 22 | VMname Name Yellow Alarm-MoRef Entity-MoRef 23 | #> 24 | 25 | [CmdletBinding()] 26 | param( 27 | [string]$VM, 28 | [string]$VMHost, 29 | [string]$Datacenter, 30 | [string]$Datastore 31 | ) 32 | BEGIN { 33 | switch ($PSBoundParameters.Keys) { 34 | 'VM' {$entity = Get-VM -Name $vm -ErrorAction SilentlyContinue} 35 | 'VMHost' {$entity = Get-VMHost -Name $VMHost -ErrorAction SilentlyContinue} 36 | 'Datacenter' {$entity = Get-Datacenter -Name $Datacenter -ErrorAction SilentlyContinue} 37 | 'Datastore' {$entity = Get-Datastore -Name $Datastore -ErrorAction SilentlyContinue} 38 | default {$entity = $null} 39 | } 40 | 41 | if ($null -eq $entity) { 42 | Write-Warning "No vSphere object found." 43 | break 44 | } 45 | } 46 | PROCESS { 47 | if ($entity.ExtensionData.TriggeredAlarmState -ne "") { 48 | $alarmOutput = @() 49 | foreach ($alarm in $entity.ExtensionData.TriggeredAlarmState) { 50 | $tempObj = "" | Select-Object -Property Entity, Alarm, AlarmStatus, AlarmMoRef, EntityMoRef 51 | $tempObj.Entity = Get-View $alarm.Entity | Select-Object -ExpandProperty Name 52 | $tempObj.Alarm = Get-View $alarm.Alarm | Select-Object -ExpandProperty Info | Select-Object -ExpandProperty Name 53 | $tempObj.AlarmStatus = $alarm.OverallStatus 54 | $tempObj.AlarmMoRef = $alarm.Alarm 55 | $tempObj.EntityMoRef = $alarm.Entity 56 | $alarmOutput += $tempObj 57 | } 58 | $alarmOutput | Format-Table -AutoSize 59 | } 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /Scripts/Get-VMHostWWPN.ps1: -------------------------------------------------------------------------------- 1 | function Get-VMHostWWPN { 2 | <# 3 | Script name: Get-VMHostWWPN.ps1 4 | Created on: 08/31/2017 5 | Author: Robin Haberstroh, @strohland 6 | Description: This script returns the WWPN of the hosts FiberChannel HBA in a readable format that corresponds to what storage team expects 7 | Dependencies: None known 8 | #> 9 | param( 10 | [string]$cluster 11 | ) 12 | 13 | Get-Cluster $cluster | get-vmhost | get-vmhosthba -type FibreChannel | 14 | format-table VMHost, Device, @{ 15 | n='WorldWidePortName';e={[convert]::ToString($_.PortWorldWideName, 16)} 16 | } 17 | } -------------------------------------------------------------------------------- /Scripts/Get-VMID.ps1: -------------------------------------------------------------------------------- 1 | function Get-VMID { 2 | <# 3 | .NOTES 4 | =========================================================================== 5 | Created by: Markus Kraus 6 | Organization: Private 7 | Personal Blog: mycloudrevolution.com 8 | Twitter: @vMarkus_K 9 | =========================================================================== 10 | .DESCRIPTION 11 | This will quickly return all IDs of VMs 12 | .Example 13 | Get-VMID -myVMs (Get-VM) | ft 14 | .Example 15 | $SampleVMs = Get-VM "tst*" 16 | Get-VMID -myVMs $SampleVMs 17 | #> 18 | [CmdletBinding()] 19 | param( 20 | [Parameter(Mandatory=$true, 21 | ValueFromPipeline=$True, 22 | Position=0)] 23 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]] 24 | $myVMs 25 | ) 26 | Process { 27 | 28 | $MyView = @() 29 | ForEach ($myVM in $myVMs){ 30 | $UUIDReport = [PSCustomObject] @{ 31 | Name = $myVM.name 32 | UUID = $myVM.extensiondata.Config.UUID 33 | InstanceUUID = $myVM.extensiondata.config.InstanceUUID 34 | LocationID = $myVM.extensiondata.config.LocationId 35 | MoRef = $myVM.extensiondata.Moref.Value 36 | } 37 | $MyView += $UUIDReport 38 | } 39 | $MyView 40 | } 41 | } -------------------------------------------------------------------------------- /Scripts/Get-VMNetworkPortId.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Finds the local ESXi network Port-ID where a VM is assigned 4 | .DESCRIPTION 5 | Reports back a VM's Port-ID according to the local ESXi host. This correlates to the Port-ID which is displayed via ESXTop 6 | .NOTES 7 | Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com 8 | .PARAMETER vm 9 | The name of the desired VM 10 | .EXAMPLE 11 | PS> .\Get-VMNetworkPortId.ps1 -vm vmname 12 | .EXAMPLE 13 | PS> Get-VM -Name vmname | .\Get-VMNetworkPortId.ps1 14 | #> 15 | [CmdletBinding(SupportsShouldProcess=$True)] 16 | param( 17 | [Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)] 18 | [Alias('Name')] 19 | [String[]]$vm 20 | ) 21 | 22 | Begin { 23 | #Create an array to store output prior to return 24 | $output = @() 25 | 26 | } 27 | 28 | Process { 29 | #Loop through each of the input values 30 | foreach ($v in $vm) { 31 | #Validate the input is a valid VM 32 | $vmobj = Get-VM -Name $v -erroraction silentlycontinue 33 | if (!$vmobj) {Write-Verbose "No VM found by the name $v."} 34 | else { 35 | #Create a temporary object to store individual ouput 36 | $tempout = "" | select VM,PortId 37 | #Start an ESXCLI session with the host where the VM resides 38 | $esxcli = Get-EsxCli -VMHost $vmobj.VMHost -v2 39 | #ESXCLI call to obtain information about the VM, specifically its WorldID 40 | $vmNetInfo = $esxcli.network.vm.list.Invoke() | ?{$_.Name -eq $vmobj.Name} 41 | #Create spec to poll the host for the network information of the VM 42 | $portArgs = $esxcli.network.vm.port.list.CreateArgs() 43 | $portArgs.worldid = $vmNetInfo.WorldID 44 | #Output the values to the temporary object 45 | $tempout.VM = $vmobj.Name 46 | $tempout.PortId = $esxcli.network.vm.port.list.Invoke($portArgs).PortId 47 | $output += $tempout 48 | } 49 | } 50 | } 51 | 52 | End { 53 | 54 | return $output 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Scripts/Get-VMToolsParts.ps1: -------------------------------------------------------------------------------- 1 | $vms = Get-VM | where {$_.PowerState -eq "PoweredOn" -and $_.GuestId -match "Windows"} 2 | 3 | ForEach ($vm in $vms){ 4 | Write-Host $vm 5 | $namespace = "root\CIMV2" 6 | $componentPattern = "hcmon|vmci|vmdebug|vmhgfs|VMMEMCTL|vmmouse|vmrawdsk|vmxnet|vmx_svga" 7 | (Get-WmiObject -class Win32_SystemDriver -computername $vm -namespace $namespace | 8 | where-object { $_.Name -match $componentPattern } | 9 | Format-Table -Auto Name,State,StartMode,DisplayName 10 | ) 11 | } 12 | -------------------------------------------------------------------------------- /Scripts/Get-VsanHclDatabase.ps1: -------------------------------------------------------------------------------- 1 | Function Get-VsanHclDatabase { 2 | <# 3 | .NOTES 4 | =========================================================================== 5 | Created by: Alan Renouf 6 | Organization: VMware 7 | Blog: http://virtu-al.net 8 | Twitter: @alanrenouf 9 | =========================================================================== 10 | .SYNOPSIS 11 | This function will allow you to view and download the VSAN Hardware Compatability List (HCL) Database 12 | 13 | .DESCRIPTION 14 | Use this function to view or download the VSAN HCL 15 | .EXAMPLE 16 | View the latest online HCL Database from online source 17 | PS C:\> Get-VsanHclDatabase | Format-Table 18 | .EXAMPLE 19 | Download the latest HCL Database from online source and store locally 20 | PS C:\> Get-VsanHclDatabase -filepath ~/hcl.json 21 | #> 22 | param ($filepath) 23 | $uri = "https://partnerweb.vmware.com/service/vsan/all.json" 24 | If ($filepath) { 25 | Invoke-WebRequest -Uri $uri -OutFile $filepath 26 | } Else { 27 | Invoke-WebRequest -Uri $uri | ConvertFrom-Json | Select-Object -ExpandProperty Data | Select-object -ExpandProperty Controller 28 | } 29 | } -------------------------------------------------------------------------------- /Scripts/Home Lab/Home Lab Delete settings.ps1: -------------------------------------------------------------------------------- 1 | $ESXIP = "192.168.1.201" 2 | $ESXUser = "root" 3 | $ESXPWD = "VMware1!" 4 | 5 | Connect-viserver $esxip -user $ESXUser -pass $ESXPWD 6 | 7 | #Leaving confirm off just in case someone happens to be connected to more than one vCenter/Host! 8 | Get-VM | Stop-VM 9 | Get-VM | Remove-VM 10 | 11 | $ESXCLI = Get-EsxCli -v2 -VMHost (get-VMHost) 12 | $esxcli.vsan.cluster.leave.invoke() 13 | 14 | $VSANDisks = $esxcli.storage.core.device.list.invoke() | Where {$_.isremovable -eq "false"} | Sort size 15 | $Performance = $VSANDisks[0] 16 | $Capacity = $VSANDisks[1] 17 | 18 | $removal = $esxcli.vsan.storage.remove.CreateArgs() 19 | $removal.ssd = $performance.Device 20 | $esxcli.vsan.storage.remove.Invoke($removal) 21 | 22 | $capacitytag = $esxcli.vsan.storage.tag.remove.CreateArgs() 23 | $capacitytag.disk = $Capacity.Device 24 | $capacitytag.tag = "capacityFlash" 25 | $esxcli.vsan.storage.tag.remove.Invoke($capacitytag) 26 | 27 | Set-VMHostSysLogServer $null 28 | Remove-VMHostNtpServer (Get-VMHostNtpServer) -Confirm:$false -------------------------------------------------------------------------------- /Scripts/Horizon View Example Desktop Script.ps1: -------------------------------------------------------------------------------- 1 | Function Get-HVDesktop { 2 | <# 3 | .SYNOPSIS 4 | This cmdlet retrieves the virtual desktops on a horizon view Server. 5 | .DESCRIPTION 6 | This cmdlet retrieves the virtual desktops on a horizon view Server. 7 | .NOTES 8 | Author: Alan Renouf, @alanrenouf,virtu-al.net 9 | .PARAMETER State 10 | Hash table containing states to filter on 11 | .EXAMPLE 12 | List All Desktops 13 | Get-HVDesktop 14 | 15 | .EXAMPLE 16 | List All Problem Desktops 17 | Get-HVDesktop -state @('PROVISIONING_ERROR', 18 | 'ERROR', 19 | 'AGENT_UNREACHABLE', 20 | 'AGENT_ERR_STARTUP_IN_PROGRESS', 21 | 'AGENT_ERR_DISABLED', 22 | 'AGENT_ERR_INVALID_IP', 23 | 'AGENT_ERR_NEED_REBOOT', 24 | 'AGENT_ERR_PROTOCOL_FAILURE', 25 | 'AGENT_ERR_DOMAIN_FAILURE', 26 | 'AGENT_CONFIG_ERROR', 27 | 'UNKNOWN') 28 | #> 29 | Param ( 30 | $State 31 | ) 32 | 33 | $ViewAPI = $global:DefaultHVServers[0].ExtensionData 34 | $query_service = New-Object "Vmware.Hv.QueryServiceService" 35 | $query = New-Object "Vmware.Hv.QueryDefinition" 36 | $query.queryEntityType = 'MachineSummaryView' 37 | if ($State) { 38 | [VMware.Hv.QueryFilter []] $filters = @() 39 | foreach ($filterstate in $State) { 40 | $filters += new-object VMware.Hv.QueryFilterEquals -property @{'memberName' = 'base.basicState'; 'value' = $filterstate} 41 | } 42 | $orFilter = new-object VMware.Hv.QueryFilterOr -property @{'filters' = $filters} 43 | $query.Filter = $orFilter 44 | } 45 | $Desktops = $query_service.QueryService_Query($ViewAPI,$query) 46 | $Desktops.Results.Base 47 | } 48 | 49 | 50 | -------------------------------------------------------------------------------- /Scripts/Horizon-GetUsageStats.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | Script name: Horizon-UsageStats.ps1 4 | Author: Ray Heffer, @rayheffer 5 | Last Edited on: 04/18/2017 6 | Dependencies: PowerCLI 6.5 R1 or later, Horizon 7.0.2 or later 7 | .DESCRIPTION 8 | This is a sample script that retrieves the Horizon usage statistics. This produces the same metrics as listed under View Configuration > Product Licensing and Usage. Service providers can use this script or incorporate it with their existing scripts to automate the reporting of Horizon usage. 9 | 10 | Example Output: 11 | NumConnections : 180 12 | NumConnectionsHigh : 250 13 | NumViewComposerConnections : 0 14 | NumViewComposerConnectionsHigh : 0 15 | NumTunneledSessions : 0 16 | NumPSGSessions : 180 17 | #> 18 | 19 | # User Configuration 20 | $hzUser = "Administrator" 21 | $hzPass = "VMware1!" 22 | $hzDomain = "vmw.lab" 23 | $hzConn = "connect01.vmw.lab" 24 | 25 | # Import the Horizon module 26 | Import-Module VMware.VimAutomation.HorizonView 27 | 28 | # Establish connection to Connection Server 29 | $hvServer = Connect-HVServer -server $hzConn -User $hzUser -Password $hzPass -Domain $hzDomain 30 | 31 | # Assign a variable to obtain the API Extension Data 32 | $hvServices = $Global:DefaultHVServers.ExtensionData 33 | 34 | # Retrieve Connection Server Health metrics 35 | $hvHealth =$hvServices.ConnectionServerHealth.ConnectionServerHealth_List() 36 | 37 | # Display ConnectionData (Usage stats) 38 | $hvHealth.ConnectionData 39 | -------------------------------------------------------------------------------- /Scripts/Invoke-BiosBoot.ps1: -------------------------------------------------------------------------------- 1 | function Invoke-BiosBoot { 2 | <# 3 | .NOTES 4 | =========================================================================== 5 | Created by: Brian Graf 6 | Organization: VMware 7 | Official Blog: blogs.vmware.com/PowerCLI 8 | Personal Blog: www.vtagion.com 9 | Twitter: @vBrianGraf 10 | =========================================================================== 11 | .DESCRIPTION 12 | This function allows you to set a VM to boot into BIOS or Guest OS 13 | .Example 14 | # Set a VM to boot to BIOS 15 | Invoke-BiosBoot -VMs (Get-VM) -Bios 16 | .Example 17 | Invoke-BiosBoot -VMs (Get-VM) -OS 18 | #> 19 | [CmdletBinding()] 20 | param( 21 | [Parameter(Mandatory=$true, 22 | ValueFromPipeline=$True, 23 | Position=0)] 24 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]] 25 | $VM, 26 | [switch]$Bios, 27 | [switch]$OS 28 | ) 29 | Process { 30 | if($Bios) 31 | { 32 | Foreach ($VirtualMachine in $VM) { 33 | $object = New-Object VMware.Vim.VirtualMachineConfigSpec 34 | $object.bootOptions = New-Object VMware.Vim.VirtualMachineBootOptions 35 | $object.bootOptions.enterBIOSSetup = $true 36 | 37 | $Reconfigure = $VirtualMachine | Get-View 38 | $Reconfigure.ReconfigVM_Task($object) 39 | $Return 40 | } 41 | } 42 | if($OS) 43 | { 44 | Foreach ($VirtualMachine in $VM) { 45 | $object = New-Object VMware.Vim.VirtualMachineConfigSpec 46 | $object.bootOptions = New-Object VMware.Vim.VirtualMachineBootOptions 47 | $object.bootOptions.enterBIOSSetup = $false 48 | 49 | $Reconfigure = $VirtualMachine | Get-View 50 | $Reconfigure.ReconfigVM_Task($object) 51 | $Return 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Scripts/Move-DatastoreCluster.ps1: -------------------------------------------------------------------------------- 1 | function Move-DatastoreCluster { 2 | <# 3 | .SYNOPSIS 4 | Moves a datastore cluster to a new location 5 | .DESCRIPTION 6 | Will move a datastore cluster to a new location 7 | .NOTES 8 | Author: Kyle Ruddy, @kmruddy 9 | .PARAMETER DatastoreCluster 10 | Specifies the datastore cluster you want to move. 11 | .PARAMETER Destination 12 | Specifies a destination where you want to place the datastore cluster 13 | .EXAMPLE 14 | Move-DatastoreCluster -DatastoreCluster $DSCluster -Destination $DSClusterFolder 15 | Moves the $DSCluster datastore cluster to the specified $DSClusterFolder folder. 16 | #> 17 | [CmdletBinding(SupportsShouldProcess = $True)] 18 | param( 19 | [Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)] 20 | [VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.DatastoreCluster]$DatastoreCluster, 21 | [Parameter(Mandatory=$false,Position=1,ValueFromPipelineByPropertyName=$true)] 22 | [VMware.VimAutomation.ViCore.Types.V1.Inventory.Folder]$Destination 23 | ) 24 | 25 | if ($Global:DefaultVIServer.IsConnected -eq $false) { 26 | Write-Warning -Message "No vCenter Server connection found." 27 | break 28 | } 29 | 30 | If ($Pscmdlet.ShouldProcess($DatastoreCluster,"Move Datastore Cluster")) { 31 | $Destination.ExtensionData.MoveIntoFolder($DatastoreCluster.ExtensionData.MoRef) 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /Scripts/NVME Info.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created by: Alan Renouf 5 | Organization: VMware 6 | Blog: http://virtu-al.net 7 | Twitter: @alanrenouf 8 | =========================================================================== 9 | #> 10 | 11 | Foreach ($vmhost in Get-VMHost) { 12 | $esxcli = get-esxcli -V2 -vmhost $vmhost 13 | Write-Host "Host: $($vmhost.name)" -ForegroundColor Green 14 | $devices = $esxcli.nvme.device.list.Invoke() 15 | Foreach ($device in $devices) { 16 | $nvmedevice = $esxcli.nvme.device.get.CreateArgs() 17 | $nvmedevice.adapter = $device.HBAName 18 | $esxcli.nvme.device.get.invoke($nvmedevice) | Select-Object ModelNumber, FirmwareRevision 19 | $features = $esxcli.nvme.device.feature.ChildElements | Select-object -ExpandProperty name 20 | ForEach ($feature in $features){ 21 | Write-Host "Feature: $feature" -ForegroundColor Yellow 22 | $currentfeature = $esxcli.nvme.device.feature.$feature.get.CreateArgs() 23 | $currentfeature.adapter = $device.HBAName 24 | $esxcli.nvme.device.feature.$feature.get.Invoke($currentfeature) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Scripts/New-ClusterHostGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Script name: New-ClusterHostGroup.ps1 5 | Created on: 2016-10-25 6 | Author: Peter D. Jorgensen (@pjorg, pjorg.com) 7 | Dependencies: None known 8 | ===Tested Against Environment==== 9 | vSphere Version: 5.5, 6.0 10 | PowerCLI Version: PowerCLI 6.5R1 11 | PowerShell Version: 5.0 12 | OS Version: Windows 10, Windows 7 13 | =========================================================================== 14 | .DESCRIPTION 15 | Creates a DRS Host Group in a vSphere cluster. 16 | .Example 17 | $ProdCluster = Get-Cluster *prod* 18 | $OddHosts = $ProdCluster | Get-VMHost | ?{ $_.Name -match 'esxi-\d*[13579]+.\lab\.local' } 19 | .\New-ClusterHostGroup.ps1 -Name 'OddProdHosts' -Cluster $ProdCluster -VMHost $OddHosts 20 | #> 21 | [CmdletBinding()] 22 | Param( 23 | [Parameter(Mandatory=$True,Position=1)] 24 | [String]$Name, 25 | [Parameter(Mandatory=$True,ValueFromPipeline=$True,Position=2)] 26 | [VMware.VimAutomation.ViCore.Types.V1.Inventory.Cluster]$Cluster, 27 | [Parameter(Mandatory=$False,Position=3)] 28 | [VMware.VimAutomation.ViCore.Types.V1.Inventory.VMHost[]]$VMHost 29 | ) 30 | 31 | $NewGroup = New-Object VMware.Vim.ClusterHostGroup -Property @{ 32 | 'Name'=$Name 33 | 'Host'=$VMHost.Id 34 | } 35 | 36 | $spec = New-Object VMware.Vim.ClusterConfigSpecEx -Property @{ 37 | 'GroupSpec'=(New-Object VMware.Vim.ClusterGroupSpec -Property @{ 38 | 'Info'=$NewGroup 39 | }) 40 | } 41 | 42 | $ClusterToReconfig = Get-View -VIObject $Cluster -Property Name 43 | $ClusterToReconfig.ReconfigureComputeResource($spec, $true) -------------------------------------------------------------------------------- /Scripts/New-ClusterVmGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Script name: New-ClusterVmGroup.ps1 5 | Created on: 2016-10-25 6 | Author: Peter D. Jorgensen (@pjorg, pjorg.com) 7 | Dependencies: None known 8 | ===Tested Against Environment==== 9 | vSphere Version: 5.5, 6.0 10 | PowerCLI Version: PowerCLI 6.5R1 11 | PowerShell Version: 5.0 12 | OS Version: Windows 10, Windows 7 13 | =========================================================================== 14 | .DESCRIPTION 15 | Creates a DRS VM Group in a vSphere cluster. 16 | .Example 17 | $ProdCluster = Get-Cluster *prod* 18 | $EvenVMs = $ProdCluster | Get-VM | ?{ $_.Name -match 'MyVM-\d*[02468]+' } 19 | .\New-ClusterVmGroup.ps1 -Name 'EvenVMs' -Cluster $ProdCluster -VM $EvenVMs 20 | #> 21 | [CmdletBinding()] 22 | Param( 23 | [Parameter(Mandatory=$True,Position=1)] 24 | [String]$Name, 25 | [Parameter(Mandatory=$True,ValueFromPipeline=$True,Position=2)] 26 | [VMware.VimAutomation.ViCore.Types.V1.Inventory.Cluster]$Cluster, 27 | [Parameter(Mandatory=$False,Position=3)] 28 | [VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine[]]$VM 29 | ) 30 | 31 | $NewGroup = New-Object VMware.Vim.ClusterVmGroup -Property @{ 32 | 'Name'=$Name 33 | 'VM'=$VM.Id 34 | } 35 | 36 | $spec = New-Object VMware.Vim.ClusterConfigSpecEx -Property @{ 37 | 'GroupSpec'=(New-Object VMware.Vim.ClusterGroupSpec -Property @{ 38 | 'Info'=$NewGroup 39 | }) 40 | } 41 | 42 | $ClusterToReconfig = Get-View -VIObject $Cluster -Property Name 43 | $ClusterToReconfig.ReconfigureComputeResource($spec, $true) -------------------------------------------------------------------------------- /Scripts/New-ClusterVmHostRule.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Script name: New-ClusterVmHostRule.ps1 5 | Created on: 2016-10-25 6 | Author: Peter D. Jorgensen (@pjorg, pjorg.com) 7 | Dependencies: None known 8 | ===Tested Against Environment==== 9 | vSphere Version: 5.5, 6.0 10 | PowerCLI Version: PowerCLI 6.5R1 11 | PowerShell Version: 5.0 12 | OS Version: Windows 10, Windows 7 13 | =========================================================================== 14 | .DESCRIPTION 15 | Creates a VM to Host affinity rule in a vSphere cluster. 16 | .Example 17 | $ProdCluster = Get-Cluster *prod* 18 | .\New-ClusterVmHostRule.ps1 -Name 'Even VMs to Odd Hosts' -AffineHostGroupName 'OddHosts' -VMGroupName 'EvenVMs' -Enabled:$true -Cluster $ProdCluster 19 | #> 20 | [CmdletBinding()] 21 | Param( 22 | [Parameter(Mandatory=$True,Position=1)] 23 | [String]$Name, 24 | [Parameter(Mandatory=$True,Position=2)] 25 | [String]$AffineHostGroupName, 26 | [Parameter(Mandatory=$True,Position=3)] 27 | [String]$VMGroupName, 28 | [Parameter(Mandatory=$False,Position=4)] 29 | [Switch]$Enabled=$True, 30 | [Parameter(Mandatory=$True,ValueFromPipeline=$True,Position=5)] 31 | [VMware.VimAutomation.ViCore.Types.V1.Inventory.Cluster]$Cluster 32 | ) 33 | 34 | $NewRule = New-Object VMware.Vim.ClusterVmHostRuleInfo -Property @{ 35 | 'AffineHostGroupName'=$AffineHostGroupName 36 | 'VmGroupName'=$VMGroupName 37 | 'Enabled'=$Enabled 38 | 'Name'=$Name 39 | } 40 | 41 | $spec = New-Object VMware.Vim.ClusterConfigSpecEx -Property @{ 42 | 'RulesSpec'=(New-Object VMware.Vim.ClusterRuleSpec -Property @{ 43 | 'Info'=$NewRule 44 | }) 45 | } 46 | 47 | $ClusterToReconfig = Get-View -VIObject $Cluster -Property Name 48 | $ClusterToReconfig.ReconfigureComputeResource($spec, $true) -------------------------------------------------------------------------------- /Scripts/README.md: -------------------------------------------------------------------------------- 1 | Sample Scripts 2 | -------------------------------------------------------------------------------- /Scripts/Remove-HostClient.ps1: -------------------------------------------------------------------------------- 1 | function Remove-HostClient { 2 | <# 3 | .NOTES 4 | =========================================================================== 5 | Created on: 8/13/2015 9:12 AM 6 | Created by: Brian Graf 7 | Github: http://www.github.com/vtagion 8 | Twitter: @vBrianGraf 9 | Website: http://www.vtagion.com 10 | =========================================================================== 11 | .DESCRIPTION 12 | This advanced function will allow you to remove the ESXi Host Client 13 | on all the hosts in a specified cluster. 14 | .Example 15 | Remove-HostClient -Cluster (Get-Cluster Management-CL) 16 | 17 | .Example 18 | $Cluster = Main-CL 19 | Remove-HostClient -Cluster $cluster 20 | #> 21 | [CmdletBinding()] 22 | param( 23 | [ValidateScript({Get-Cluster $_})] 24 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.ComputeResourceImpl]$Cluster 25 | ) 26 | Process { 27 | 28 | # Get all ESX hosts in cluster that meet criteria 29 | Get-VMhost -Location $Cluster | where { $_.PowerState -eq "PoweredOn" -and $_.ConnectionState -eq "Connected" } | foreach { 30 | 31 | Write-host "Preparing to remove Host Client from $($_.Name)" -ForegroundColor Yellow 32 | 33 | # Prepare ESXCLI variable 34 | $ESXCLI = Get-EsxCli -VMHost $_ 35 | 36 | # Check to see if VIB is installed on the host 37 | if (($ESXCLI.software.vib.list() | Where {$_.Name -match "esx-ui"})) { 38 | 39 | Write-host "Removing ESXi Embedded Host Client on $($_.Name)" -ForegroundColor Yellow 40 | 41 | # Command saved to variable for future verification 42 | $action = $esxcli.software.vib.remove($null,$null,$null,$null,"esx-ui") 43 | 44 | # Verify VIB removed successfully 45 | if ($action.Message -eq "Operation finished successfully."){Write-host "Action Completed successfully on $($_.Name)" -ForegroundColor Green} else {Write-host $action.Message -ForegroundColor Red} 46 | 47 | } else { Write-host "It appears Host Client is not installed on this host. Skipping..." -ForegroundColor Yellow } 48 | } 49 | } 50 | End {Write-host "Function complete" -ForegroundColor Green} 51 | } 52 | -------------------------------------------------------------------------------- /Scripts/Remove-IPPool.ps1: -------------------------------------------------------------------------------- 1 | Function Remove-IPPool { 2 | <# 3 | .Synopsis 4 | This function will remove IP-Pools from vCenter 5 | .Description 6 | This function will remove IP-Pools from vCenter based on the inputs provided 7 | .Example 8 | Assuming my datacenter was 'westwing' and my IPPool was 'IPPool1' 9 | remove-ippool westwing IPPool1 10 | .Notes 11 | Author: Brian Graf 12 | Role: Technical Marketing Engineer, VMware 13 | Last Edited: 05/01/2014 14 | 15 | #> 16 | [cmdletbinding()] 17 | Param ( 18 | [Parameter(ValueFromPipeline = $true, valuefrompipelinebypropertyname = $true)] 19 | [String]$Datacenter, 20 | [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] 21 | [String]$PoolName 22 | ) 23 | 24 | Process { 25 | $dc = (Get-datacenter $Datacenter) 26 | $dcenter = New-Object VMware.Vim.ManagedObjectReference 27 | $dcenter.type = $dc.ExtensionData.moref.type 28 | $dcenter.Value = $dc.ExtensionData.moref.value 29 | 30 | $IPPoolManager = Get-View -Id 'IpPoolManager' 31 | $SelectedPool = ($IPPoolManager.QueryIpPools($dc.ID) | Where-Object { $_.Name -like $PoolName }) 32 | 33 | $IPPool = Get-View -Id 'IpPoolManager-IpPoolManager' 34 | $IPPool.DestroyIpPool($dcenter, $SelectedPool.id, $true) 35 | 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /Scripts/Report-LUNPath-ESXCLI.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created by: Markus Kraus 5 | Organization: Private 6 | Personal Blog: mycloudrevolution.com 7 | Twitter: @vMarkus_K 8 | =========================================================================== 9 | Tested Against Environment: 10 | vSphere Version: 6.0 U1, 5.5 U2 11 | PowerCLI Version: PowerCLI 6.3 R1 12 | PowerShell Version: 5.0 13 | OS Version: Windows 8.1, Server 2012 R2 14 | Keyword: ESXi, LUN, Path, Storage 15 | 16 | Dependencies: 17 | PowerCLI Version: PowerCLI 6.3 R1 18 | 19 | .DESCRIPTION 20 | This script will create a Report of LUNs with Paths that have more than one unique LUN ID or have more than the defined Paths. 21 | Information’s will be gathered via ESXCLI. This is necessary to report also hidden Paths! 22 | 23 | .Example 24 | ./Report-LUNPath-ESXCLI.ps1 25 | 26 | #> 27 | 28 | #Requires -Modules VMware.VimAutomation.Core, @{ModuleName="VMware.VimAutomation.Core";ModuleVersion="6.3.0.0"} 29 | 30 | #region 1: Global Definitions 31 | $MaxLUNPaths = 2 32 | #endregion 33 | 34 | #region 2: Get all Connected Hosts 35 | $myHosts = Get-VMHost | where {$_.ConnectionState -eq "Connected" -and $_.PowerState -eq "PoweredOn"} 36 | #endregion 37 | 38 | #region 3: Create Report 39 | $Report = @() 40 | foreach ($myHost in $myHosts) { 41 | $esxcli2 = Get-ESXCLI -VMHost $myHost -V2 42 | $devices = $esxcli2.storage.core.path.list.invoke() | select Device -Unique 43 | 44 | foreach ($device in $devices) { 45 | $arguments = $esxcli2.storage.core.path.list.CreateArgs() 46 | $arguments.device = $device.Device 47 | $LUNs = $esxcli2.storage.core.path.list.Invoke($arguments) 48 | 49 | $LUNReport = [PSCustomObject] @{ 50 | HostName = $myHost.Name 51 | Device = $device.Device 52 | LUNPaths = $LUNs.Length 53 | LUNIDs = $LUNs.LUN | Select-Object -Unique 54 | } 55 | $Report += $LUNReport 56 | } 57 | } 58 | #endregion 59 | 60 | #region 4: Output Report 61 | $Report | where {$_.LUNPaths -gt $MaxLUNPaths -or ($_.LUNIDs | measure).count -gt 1 } | ft -AutoSize 62 | #endregion -------------------------------------------------------------------------------- /Scripts/Sample VMC firewall rules management.ps1: -------------------------------------------------------------------------------- 1 | $MyRefreshToken = "XXXX-XXXX-XXXX-XXXX" 2 | Connect-VMC -RefreshToken $MyRefreshToken 3 | 4 | #List the user firewall Rules for MGW 5 | Get-VMCFirewallRule -SDDCName "vGhetto" -OrgName "BashFest - Red Team" -GatewayType MGW 6 | 7 | #List the firewall rules including system firewall rules for MGW 8 | Get-VMCFirewallRule -SDDCName "vGhetto" -OrgName "BashFest - Red Team" -GatewayType MGW -ShowAll 9 | 10 | #Export Firewall Rules from original SDDC 11 | Export-VMCFirewallRule -SDDCName "vGhetto" -OrgName "BashFest - Red Team" -GatewayType MGW -Path ~/Desktop/VMCFirewallRules.json 12 | 13 | #Import Firewall Rules to new SDDC 14 | Import-VMCFirewallRule -SDDCName “Single-Host-SDDC” -OrgName "BashFest - Red Team" -GatewayType MGW -Path ~/Desktop/VMCFirewallRules.json 15 | 16 | #Remove the firewall Rules we just created for the SDDC 17 | $Rules = Get-VMCFirewallRule -SDDCName "Single-Host-SDDC" -OrgName "BashFest - Red Team" -GatewayType MGW 18 | Foreach ($rule in $rules){ 19 | Remove-VMCFirewallRule -SDDCName “Single-Host-SDDC” -OrgName "BashFest - Red Team" -GatewayType MGW -RuleId $rule.id 20 | } -------------------------------------------------------------------------------- /Scripts/SecureBoot.ps1: -------------------------------------------------------------------------------- 1 | Function Get-SecureBoot { 2 | <# 3 | .SYNOPSIS Query Seure Boot setting for a VM in vSphere 6.5 4 | .NOTES Author: William Lam 5 | .NOTES Site: www.virtuallyghetto.com 6 | .PARAMETER Vm 7 | VM to query Secure Boot setting 8 | .EXAMPLE 9 | Get-VM -Name Windows10 | Get-SecureBoot 10 | #> 11 | param( 12 | [Parameter( 13 | Mandatory=$true, 14 | ValueFromPipeline=$true, 15 | ValueFromPipelineByPropertyName=$true) 16 | ] 17 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$Vm 18 | ) 19 | 20 | $secureBootSetting = if ($vm.ExtensionData.Config.BootOptions.EfiSecureBootEnabled) { "enabled" } else { "disabled" } 21 | Write-Host "Secure Boot is" $secureBootSetting 22 | } 23 | 24 | Function Set-SecureBoot { 25 | <# 26 | .SYNOPSIS Enable/Disable Seure Boot setting for a VM in vSphere 6.5 27 | .NOTES Author: William Lam 28 | .NOTES Site: www.virtuallyghetto.com 29 | .PARAMETER Vm 30 | VM to enable/disable Secure Boot 31 | .EXAMPLE 32 | Get-VM -Name Windows10 | Set-SecureBoot -Enabled 33 | .EXAMPLE 34 | Get-VM -Name Windows10 | Set-SecureBoot -Disabled 35 | #> 36 | param( 37 | [Parameter( 38 | Mandatory=$true, 39 | ValueFromPipeline=$true, 40 | ValueFromPipelineByPropertyName=$true) 41 | ] 42 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$Vm, 43 | [Switch]$Enabled, 44 | [Switch]$Disabled 45 | ) 46 | 47 | if($Enabled) { 48 | $secureBootSetting = $true 49 | $reconfigMessage = "Enabling Secure Boot for $Vm" 50 | } 51 | if($Disabled) { 52 | $secureBootSetting = $false 53 | $reconfigMessage = "Disabling Secure Boot for $Vm" 54 | } 55 | 56 | $spec = New-Object VMware.Vim.VirtualMachineConfigSpec 57 | $bootOptions = New-Object VMware.Vim.VirtualMachineBootOptions 58 | $bootOptions.EfiSecureBootEnabled = $secureBootSetting 59 | $spec.BootOptions = $bootOptions 60 | 61 | Write-Host "`n$reconfigMessage ..." 62 | $task = $vm.ExtensionData.ReconfigVM_Task($spec) 63 | $task1 = Get-Task -Id ("Task-$($task.value)") 64 | $task1 | Wait-Task | Out-Null 65 | } 66 | -------------------------------------------------------------------------------- /Scripts/Set-ClusterDpm.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | Script name: Set-ClusterDpm.ps1 4 | Created on: 10/10/2019 5 | Author: Doug Taliaferro, @virtually_doug 6 | Description: Configures Distributed Power Management (DPM) on a cluster. 7 | Dependencies: None known 8 | 9 | ===Tested Against Environment==== 10 | vSphere Version: 6.7 11 | PowerCLI Version: 11.3.0 12 | PowerShell Version: 5.1 13 | OS Version: Windows 7, 10 14 | Keyword: Cluster, DPM 15 | .SYNOPSIS 16 | Configures Distributed Power Management (DPM). 17 | 18 | .DESCRIPTION 19 | Enables/disables Distributed Power Management (DPM) for one or more clusters and optionally sets the automation level. 20 | 21 | .PARAMETER Clusters 22 | Specifies the name of the cluster(s) you want to configure. 23 | 24 | .PARAMETER DpmEnabled 25 | Indicates whether Distributed Power Management (DPM) should be enabled/disabled. 26 | 27 | .PARAMETER DpmAutomationLevel 28 | Specifies the Distributed Power Management (DPM) automation level. The valid values are 'automated' and 'manual'. 29 | 30 | .EXAMPLE 31 | Set-ClusterDpm -Cluster 'Cluster01' -DpmEnabled:$true 32 | 33 | .EXAMPLE 34 | Get-Cluster | Set-ClusterDpm -DpmEnabled:$true -DpmAutomationLevel 'automated' 35 | #> 36 | [CmdletBinding()] 37 | param ( 38 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] 39 | [Alias('Name')] 40 | [string[]]$Clusters, 41 | 42 | [Parameter(Mandatory=$true)] 43 | [bool]$DpmEnabled, 44 | 45 | [Parameter(Mandatory = $false)] 46 | [ValidateSet('automated','manual')] 47 | [string]$DpmAutomationLevel 48 | ) 49 | Begin { 50 | # Create a configuration spec 51 | $spec = New-Object VMware.Vim.ClusterConfigSpecEx 52 | $spec.dpmConfig = New-Object VMware.Vim.ClusterDpmConfigInfo 53 | $spec.dpmConfig.enabled = $DpmEnabled 54 | if ($DpmAutomationLevel) { 55 | $spec.dpmConfig.defaultDpmBehavior = $DpmAutomationLevel 56 | } 57 | } 58 | Process { 59 | ForEach ($cluster in $Clusters) { 60 | # Configure the cluster 61 | (Get-Cluster $cluster).ExtensionData.ReconfigureComputeResource_Task($spec, $true) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Scripts/Set-NetworkAdapterOpaqueNetwork.ps1: -------------------------------------------------------------------------------- 1 | function Set-NetworkAdapterOpaqueNetwork { 2 | param( 3 | [Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 1)] 4 | [VMware.VimAutomation.Types.NetworkAdapter] 5 | $NetworkAdapter, 6 | 7 | [Parameter(Mandatory = $true, Position = 2)] 8 | [string] 9 | $OpaqueNetworkName, 10 | 11 | [Parameter()] 12 | [switch] 13 | $Connected, 14 | 15 | [Parameter()] 16 | [switch] 17 | $StartConnected 18 | ) 19 | process { 20 | $opaqueNetwork = Get-View -ViewType OpaqueNetwork | ? {$_.Name -eq $OpaqueNetworkName} 21 | if (-not $opaqueNetwork) { 22 | throw "'$OpaqueNetworkName' network not found." 23 | } 24 | 25 | $opaqueNetworkBacking = New-Object VMware.Vim.VirtualEthernetCardOpaqueNetworkBackingInfo 26 | $opaqueNetworkBacking.OpaqueNetworkId = $opaqueNetwork.Summary.OpaqueNetworkId 27 | $opaqueNetworkBacking.OpaqueNetworkType = $opaqueNetwork.Summary.OpaqueNetworkType 28 | 29 | $device = $NetworkAdapter.ExtensionData 30 | $device.Backing = $opaqueNetworkBacking 31 | 32 | if ($StartConnected) { 33 | $device.Connectable.StartConnected = $true 34 | } 35 | 36 | if ($Connected) { 37 | $device.Connectable.Connected = $true 38 | } 39 | 40 | $spec = New-Object VMware.Vim.VirtualDeviceConfigSpec 41 | $spec.Operation = [VMware.Vim.VirtualDeviceConfigSpecOperation]::edit 42 | $spec.Device = $device 43 | $configSpec = New-Object VMware.Vim.VirtualMachineConfigSpec 44 | $configSpec.DeviceChange = @($spec) 45 | $NetworkAdapter.Parent.ExtensionData.ReconfigVM($configSpec) 46 | 47 | # Output 48 | Get-NetworkAdapter -Id $NetworkAdapter.Id 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Scripts/SetClusterMultiPathToRoundRobin.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: SetClusterMultiPathToRoundRobin.ps1 3 | Created on: 09/14/2017 4 | Author: Alan Comstock, @Mr_Uptime 5 | Description: Set the MultiPath policy for FC devices to RoundRobin and IOPS to 1 for all hosts in a cluster based upon the vendor tag. 6 | Dependencies: None known 7 | PowerCLI Version: VMware PowerCLI 6.5 Release 1 build 4624819 8 | PowerShell Version: 5.1.14393.1532 9 | OS Version: Windows 10 10 | #> 11 | 12 | $pathpolicy="RoundRobin" 13 | $iops="1" 14 | $vendor="3PARdata" 15 | $AllESXHosts = Get-VMHost -Location CLUSTERNAME | Sort Name 16 | Foreach ($esxhost in $AllESXHosts) { 17 | Write-Host "Working on" $esxhost 18 | $scsilun = Get-VMhost $esxhost | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun -LunType disk | Where-Object {$_.Vendor -like $vendor -and ($_.MultipathPolicy -notlike $pathpolicy -or $_.CommandsToSwitchPath -ne $iops)} 19 | if ($scsilun -ne $null){ 20 | Set-ScsiLun -ScsiLun $scsilun -MultipathPolicy $pathpolicy -CommandsToSwitchPath $iops 21 | } 22 | } 23 | #The End 24 | -------------------------------------------------------------------------------- /Scripts/SetMultiPathToRoundRobin: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: SetMultiPathToRoundRobin.ps1 3 | Created on: 09/13/2017 4 | Author: Alan Comstock, @Mr_Uptime 5 | Description: Set the MultiPath policy for FC devices to RoundRobin 6 | Dependencies: None known 7 | PowerCLI Version: VMware PowerCLI 6.5 Release 1 build 4624819 8 | PowerShell Version: 5.1.14393.1532 9 | OS Version: Windows 10 10 | #> 11 | 12 | #Check a host for any Fibre Channel devices that are not set to Round Robin. Modify to check clusters if needed. 13 | Get-VMhost HOSTNAME | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun -LunType disk | Where { $_.MultipathPolicy -notlike "RoundRobin" } | Select CanonicalName,MultipathPolicy 14 | 15 | #Set the Multipathing Policy on a host to Round Robin for any Fibre Channel devices that are not Round Robin 16 | $scsilun = Get-VMhost HOSTNAME | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun -LunType disk | Where { $_.MultipathPolicy -notlike "RoundRobin" } 17 | Set-ScsiLun -ScsiLun $scsilun -MultipathPolicy RoundRobin 18 | -------------------------------------------------------------------------------- /Scripts/Start-VMHostSsh.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Script name: Start-VMHostSsh.ps1 5 | Created on: 2016-07-01 6 | Author: Peter D. Jorgensen (@pjorg, pjorg.com) 7 | Dependencies: None known 8 | ===Tested Against Environment==== 9 | vSphere Version: 5.5, 6.0 10 | PowerCLI Version: PowerCLI 6.5R1 11 | PowerShell Version: 5.0 12 | OS Version: Windows 10, Windows 7 13 | =========================================================================== 14 | .DESCRIPTION 15 | Starts the TSM-SSH service on VMHosts. 16 | .Example 17 | .\Start-VMHostSsh -VMHost (Get-VMHost -Name 'esxi-001.lab.local') 18 | .Example 19 | $OddHosts = Get-VMHost | ?{ $_.Name -match 'esxi-\d*[13579]+.\lab\.local' } 20 | .\Start-VMHost -VMHost $OddHosts 21 | #> 22 | [CmdletBinding()] 23 | Param( 24 | [Parameter(ValueFromPipeline=$True,Mandatory=$True,Position=0)] 25 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl[]]$VMHost 26 | ) 27 | 28 | Process { 29 | $svcSys = Get-View $VMHost.ExtensionData.ConfigManager.ServiceSystem 30 | $svcSys.StartService('TSM-SSH') 31 | } 32 | -------------------------------------------------------------------------------- /Scripts/Stop-VMHostSsh.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Script name: Stop-VMHostSsh.ps1 5 | Created on: 2016-07-01 6 | Author: Peter D. Jorgensen (@pjorg, pjorg.com) 7 | Dependencies: None known 8 | ===Tested Against Environment==== 9 | vSphere Version: 5.5, 6.0 10 | PowerCLI Version: PowerCLI 6.5R1 11 | PowerShell Version: 5.0 12 | OS Version: Windows 10, Windows 7 13 | =========================================================================== 14 | .DESCRIPTION 15 | Stops the TSM-SSH service on VMHosts. 16 | .Example 17 | .\Stop-VMHostSsh -VMHost (Get-VMHost -Name 'esxi-001.lab.local') 18 | .Example 19 | $EvenHosts = Get-VMHost | ?{ $_.Name -match 'esxi-\d*[02468]+.\lab\.local' } 20 | .\Stop-VMHost -VMHost $EvenHosts 21 | #> 22 | [CmdletBinding()] 23 | Param( 24 | [Parameter(ValueFromPipeline=$True,Mandatory=$True,Position=0)] 25 | [VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl[]]$VMHost 26 | ) 27 | 28 | Process { 29 | $svcSys = Get-View $VMHost.ExtensionData.ConfigManager.ServiceSystem 30 | $svcSys.StopService('TSM-SSH') 31 | } 32 | -------------------------------------------------------------------------------- /Scripts/VMware_Cloud_on_AWS/AWS_Integrations_Examples/Serverless_VM_Deployment/readme.txt: -------------------------------------------------------------------------------- 1 | This is a simple 'serverless application' that allows you to create a VM in 2 | an SDDC on VMware Cloud on AWS using a few cool tools including: Lambda, 3 | Cognito, S3, and VMware Cloud on AWS. 4 | 5 | Matt Dreyer 6 | August 16, 2017 7 | 8 | 9 | To make this work you need to do the following: 10 | 11 | 1. Make sure that the vCenter in your SDDC is publicly accessible, or painfully configure Lambda 12 | to run in an VPC and NAT to a specific IP address (which requires even more IAM roles for VPC access). 13 | 2. Create a working VM, and then Clone it to an OVF template in Content Library 14 | 3. Use the vCenter API browser to discover the UUID of the your OVF template 15 | 4. Update the HTML in index.html to match the UUID(s) of the VMs you wish to deploy 16 | 5. Create a new Lambda function and upload vm-request-form.zip as your code 17 | 6. Create a new Cognito "Federated Identity" for "anonymous access" 18 | 7. Update the javascript in index.html to match your new Cognito role 19 | 8. Create an S3 bucket and configure it for Webhosting 20 | 9. Upload index.html and vmc-sticker.png into your bucket 21 | 10. Muck with IAM until Lambda and Cognito get along together 22 | (required Cognito role permissions are AWSLambdaExecute and AWSLambdaRole) -------------------------------------------------------------------------------- /Scripts/VMware_Cloud_on_AWS/AWS_Integrations_Examples/Serverless_VM_Deployment/vm-request-form.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Scripts/VMware_Cloud_on_AWS/AWS_Integrations_Examples/Serverless_VM_Deployment/vm-request-form.zip -------------------------------------------------------------------------------- /Scripts/VMware_Cloud_on_AWS/AWS_Integrations_Examples/Slack_Inventory/vmc-inventory-to-slack.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamw/PowerCLI-Example-Scripts/2ed266e87789d72be2c291f10c713652af202e17/Scripts/VMware_Cloud_on_AWS/AWS_Integrations_Examples/Slack_Inventory/vmc-inventory-to-slack.mp4 -------------------------------------------------------------------------------- /Scripts/VMware_Cloud_on_AWS/Create100VMs.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created by: Alan Renouf 5 | Date: March 27, 2018 6 | Organization: VMware 7 | Blog: virtu-al.net 8 | Twitter: @alanrenouf 9 | =========================================================================== 10 | 11 | .DESCRIPTION 12 | This will allow you to create multiple workloads in the correct locations on VMware Cloud on AWS. 13 | 14 | .Example 15 | $vCenter = "vcenter.sddc-52-53-75-20.vmc.vmware.com" 16 | $vCenterUser = "cloudadmin@vmc.local" 17 | $vCenterPassword = 'VMware1!' 18 | $ResourcePool = "Compute-ResourcePool" 19 | $Datastore = "WorkloadDatastore" 20 | $DestinationFolder = "Workloads" 21 | $Template = "Gold_Linux_Template" 22 | $VMNamePrefix = "NEWVM" 23 | $NumofVMs = 100 24 | $RunASync = $true #Set this to $True to create the VMs and not wait for the result before starting the next one 25 | #> 26 | 27 | # ------------- VARIABLES SECTION - EDIT THE VARIABLES BELOW ------------- 28 | $vCenter = "vcenter.sddc-123456789.vmc.vmware.com" 29 | $vCenterUser = "cloudadmin@vmc.local" 30 | $vCenterPassword = '123456789' 31 | $ResourcePool = "Compute-ResourcePool" 32 | $Datastore = "WorkloadDatastore" 33 | $DestinationFolder = "Workloads" 34 | $Template = "Gold_Linux_Template" 35 | $VMNamePrefix = "NEWVM" 36 | $NumofVMs = 100 37 | $RunASync = $true 38 | # ------------- END VARIABLES - DO NOT EDIT BELOW THIS LINE ------------- 39 | 40 | # Connect to VMC vCenter Server 41 | $VCConn = Connect-VIServer -Server $vCenter -User $vCenterUser -Password $vCenterPassword 42 | 43 | 1..$NumofVMs | Foreach-Object { 44 | Write-Host "Creating $VMNamePrefix$($_)" 45 | if ($RunASync){ 46 | New-VM -Name "$VMNamePrefix$($_)" -Template $Template -ResourcePool $ResourcePool -Datastore $datastore -Location $DestinationFolder -RunAsync 47 | } Else { 48 | New-VM -Name "$VMNamePrefix$($_)" -Template $Template -ResourcePool $ResourcePool -Datastore $datastore -Location $DestinationFolder 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Scripts/VMware_Cloud_on_AWS/VMC Example Script.ps1: -------------------------------------------------------------------------------- 1 | #List the commands available for the VMC module 2 | Get-VMCCommand 3 | 4 | #Connect to VMC 5 | $MyRefreshToken = "XXXX-XXXX-XXXX-XXXX" 6 | Connect-VMC -RefreshToken $MyRefreshToken 7 | 8 | #List the Orgs available to us 9 | Get-VMCOrg 10 | 11 | #List the SDDCs 12 | Get-VMCSDDC -Org BashFest* 13 | 14 | #List the Tasks for a particular Org 15 | Get-VMCTask -Org BashFest* | Select-Object task_type, Sub_Status, start_time, End_time, user_name | Sort-Object Start_Time | Format-Table 16 | 17 | #Get the Public IPs for a SDDC 18 | Get-VMCSDDCPublicIPPool -org bashfest* 19 | 20 | #Get all ESXi hosts for given SDDC 21 | Get-VMCVMHost -org bashfest* -Sddc virtu-al 22 | 23 | #Get the credentials of a SDDC so we can login via vSphere cmdlets 24 | Get-VMCSDDCDefaultCredential -org bashfest* -Sddc virtu-al 25 | 26 | #Connect to your VMC vCenter with default creds 27 | Connect-VmcVIServer -org bashfest* -Sddc virtu-al 28 | 29 | #Run some vSphere cmdlets 30 | 31 | #List all VMs from On-Premises and VMC SDDC 32 | Get-VM | Select vCenterServer, Name, PowerState, VMHost 33 | 34 | 35 | -------------------------------------------------------------------------------- /Scripts/VMware_Cloud_on_AWS/XRef-VMC-Services.ps1: -------------------------------------------------------------------------------- 1 | $refreshToken = 'your-refresh-token' 2 | 3 | $reportPath = '.\VMC-services.xlsx' 4 | 5 | Connect-Vmc -RefreshToken $refreshToken > $null 6 | 7 | $columns = @{} 8 | $services = Get-VmcService | Sort-Object -Property Name 9 | $services | ForEach-Object -Process { 10 | $_.Help | Get-Member -MemberType NoteProperty | where{'Constants','Documentation' -notcontains $_.Name} | 11 | ForEach-Object -Process { 12 | if(-not $columns.ContainsKey($_.Name)){ 13 | $columns.Add($_.Name,'') 14 | } 15 | } 16 | } 17 | $columns = $columns.Keys | Sort-Object 18 | $report = @() 19 | foreach($service in $services){ 20 | $obj = [ordered]@{ 21 | Name = $service.Name 22 | } 23 | $columns | ForEach-Object -Process { 24 | $obj.Add($_,'') 25 | } 26 | 27 | $service.Help | Get-Member -MemberType NoteProperty | where{'Constants','Documentation' -notcontains $_.Name} | 28 | ForEach-Object -Process { 29 | # $obj.Item($_.Name) = "$($service.Help.$($_.Name).Documentation)" 30 | $obj.Item($_.Name) = "X" 31 | } 32 | $report += New-Object PSObject -Property $obj 33 | } 34 | $report | Export-Excel -Path $reportPath -WorksheetName 'Services' -FreezeTopRow -BoldTopRow -AutoSize -Show 35 | 36 | Disconnect-Vmc -Confirm:$false 37 | 38 | -------------------------------------------------------------------------------- /Scripts/VSANSmartsData.ps1: -------------------------------------------------------------------------------- 1 | Function Get-VSANSmartsData { 2 | <# 3 | .NOTES 4 | =========================================================================== 5 | Created by: William Lam 6 | Organization: VMware 7 | Blog: www.virtuallyghetto.com 8 | Twitter: @lamw 9 | =========================================================================== 10 | .DESCRIPTION 11 | This function retreives SMART drive data using new vSAN 12 | Management 6.6 API. This can also be used outside of vSAN 13 | to query existing SSD devices not being used for vSAN. 14 | .PARAMETER Cluster 15 | The name of a vSAN Cluster 16 | .EXAMPLE 17 | Get-VSANSmartsData -Cluster VSAN-Cluster 18 | #> 19 | param( 20 | [Parameter(Mandatory=$false)][String]$Cluster 21 | ) 22 | 23 | if($global:DefaultVIServer.ExtensionData.Content.About.ApiType -eq "VirtualCenter") { 24 | if(!$cluster) { 25 | Write-Host "Cluster property is required when connecting to vCenter Server" 26 | break 27 | } 28 | 29 | $vchs = Get-VSANView -Id "VsanVcClusterHealthSystem-vsan-cluster-health-system" 30 | $cluster_view = (Get-Cluster -Name $Cluster).ExtensionData.MoRef 31 | $result = $vchs.VsanQueryVcClusterSmartStatsSummary($cluster_view) 32 | } else { 33 | $vhs = Get-VSANView -Id "HostVsanHealthSystem-ha-vsan-health-system" 34 | $result = $vhs.VsanHostQuerySmartStats($null,$true) 35 | } 36 | 37 | $vmhost = $result.Hostname 38 | $smartsData = $result.SmartStats 39 | 40 | Write-Host "`nESXi Host: $vmhost`n" 41 | foreach ($data in $smartsData) { 42 | if($data.stats) { 43 | $stats = $data.stats 44 | Write-Host $data.disk 45 | 46 | $smartsResults = @() 47 | foreach ($stat in $stats) { 48 | $statResult = [pscustomobject] @{ 49 | Parameter = $stat.Parameter; 50 | Value =$stat.Value; 51 | Threshold = $stat.Threshold; 52 | Worst = $stat.Worst 53 | } 54 | $smartsResults+=$statResult 55 | } 56 | $smartsResults | Format-Table 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Scripts/VSANVersion.ps1: -------------------------------------------------------------------------------- 1 | Function Get-VSANVersion { 2 | <# 3 | .NOTES 4 | =========================================================================== 5 | Created by: William Lam 6 | Organization: VMware 7 | Blog: www.virtuallyghetto.com 8 | Twitter: @lamw 9 | =========================================================================== 10 | .DESCRIPTION 11 | This function retreives the vSAN software version for both VC/ESXi 12 | .PARAMETER Cluster 13 | The name of a vSAN Cluster 14 | .EXAMPLE 15 | Get-VSANVersion -Cluster VSAN-Cluster 16 | #> 17 | param( 18 | [Parameter(Mandatory=$true)][String]$Cluster 19 | ) 20 | $vchs = Get-VSANView -Id "VsanVcClusterHealthSystem-vsan-cluster-health-system" 21 | $cluster_view = (Get-Cluster -Name $Cluster).ExtensionData.MoRef 22 | $results = $vchs.VsanVcClusterQueryVerifyHealthSystemVersions($cluster_view) 23 | 24 | Write-Host "`nVC Version:"$results.VcVersion 25 | $results.HostResults | Select Hostname, Version 26 | } 27 | -------------------------------------------------------------------------------- /Scripts/backup-esxi-host-configuration.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Script name: backup-esxi-host-configuration.ps1 3 | Created on: 09/10/2018 4 | Author: Gerasimos Alexiou, @jerrak0s 5 | Description: The purpose of the script is to backup esxi host configuration for restore purposes. 6 | Dependencies: None known 7 | 8 | ===Tested Against Environment==== 9 | vSphere Version: 6.5 U2 10 | PowerCLI Version: PowerCLI 10.1.1 11 | PowerShell Version: 5.1 12 | OS Version: Windows 10 13 | Keyword: Backup Configuration ESXi Host 14 | #> 15 | 16 | 17 | $serverIp = Read-Host 'What is the server ip address:' 18 | $path = Read-Host 'Give path where backup configuration will be stored:' 19 | $serverPass = Read-Host 'What is the server root password:' -AsSecureString 20 | Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false 21 | Connect-VIServer serverip -user "root" -password $serverPass 22 | Get-VMHostFirmware -vmhost serverip -BackupConfiguration -DestinationPath $path -------------------------------------------------------------------------------- /Scripts/get-ping.ps1: -------------------------------------------------------------------------------- 1 | Function Get-PingStatus 2 | { 3 | param( 4 | [Parameter(ValueFromPipeline=$true)] 5 | [string]$device, 6 | 7 | [validateSet("Online","Offline","ObjectTable")] 8 | [String]$getObject 9 | ) 10 | 11 | begin{ 12 | $hash = @() 13 | 14 | } 15 | process{ 16 | 17 | $device| foreach { 18 | if (Test-Connection $_ -Count 1 -Quiet) { 19 | 20 | if(-not($GetObject)){write-host -ForegroundColor green "Online: $_ "} 21 | 22 | $Hash = $Hash += @{Online="$_"} 23 | }else{ 24 | 25 | if(-not($GetObject)){write-host -ForegroundColor Red "Offline: $_ "} 26 | 27 | $Hash = $Hash += @{Offline="$_"} 28 | } 29 | } 30 | } 31 | 32 | end { 33 | if($GetObject) { 34 | 35 | $Global:Objects = $Hash | foreach { [PSCustomObject]@{ 36 | 37 | DeviceName = $_.Values| foreach { "$_" } 38 | Online = $_.Keys| where {$_ -eq "Online"} 39 | offline = $_.Keys| where {$_ -eq "Offline"} 40 | } 41 | } 42 | 43 | Switch -Exact ($GetObject) 44 | { 45 | 46 | 'Online' { $Global:Objects| where 'online'| select -ExpandProperty DeviceName } 47 | 'Offline' { $Global:Objects| where 'offline'| select -ExpandProperty DeviceName } 48 | 'ObjectTable' { return $Global:Objects } 49 | } 50 | 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Scripts/ha-vcenter-deploy-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "__version": "0.1", 3 | "__comments": "Configuration for ha-vcenter-deploy.ps1 - www.definit.co.uk", 4 | "target": { 5 | "server": "vcsa.definit.local", 6 | "user": "administrator@vsphere.local", 7 | "password": "VMware1!", 8 | "datacenter": "Lab", 9 | "cluster": "Workload", 10 | "datastore": "vsanDatastore", 11 | "folder": "Nested Labs/HA-vCenter", 12 | "portgroup": "HA-vCenter-Management", 13 | "ha-portgroup": "HA-vCenter-Heartbeat", 14 | "network": { 15 | "netmask": "255.255.255.0", 16 | "gateway": "10.0.11.1", 17 | "prefix": "24", 18 | "dns": "192.168.1.20", 19 | "domain": "definit.local", 20 | "ntp": "192.168.1.1" 21 | } 22 | }, 23 | "sources": { 24 | "VCSAInstaller": "e:\\Pod-Deploy\\vSphere\\VMware-VCSA-all-6.5.0-4944578" 25 | }, 26 | "active": { 27 | "deploymentSize": "small", 28 | "name": "ha-vc-active", 29 | "ip": "10.0.11.10", 30 | "ha-ip": "172.16.1.1", 31 | "hostname": "ha-vc.definit.local", 32 | "rootPassword": "VMware1!", 33 | "sso": { 34 | "domain": "vsphere.local", 35 | "site": "Default-First-Site", 36 | "password": "VMware1!" 37 | }, 38 | "datacenter": "HA-vCenter-Datacenter", 39 | "cluster": "HA-vCenter-Cluster-1", 40 | "distributedSwitch": "HA-vCenter-VDS", 41 | "portgroup": "HA-vCenter-PortGroup" 42 | }, 43 | "cluster": { 44 | "passive-ip": "172.16.1.2", 45 | "passive-name": "ha-vc-passive", 46 | "witness-ip": "172.16.1.3", 47 | "witness-name": "ha-vc-witness", 48 | "ha-mask": "255.255.255.248" 49 | }, 50 | "general": { 51 | "syslog": "192.168.1.26", 52 | "ssh": true, 53 | "log": "ha-vcenter-deploy.log" 54 | }, 55 | "license": { 56 | "vcenter": "7H23H-11111-22222-33333-90ZQN" 57 | } 58 | } -------------------------------------------------------------------------------- /Scripts/modules.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for file in $( ls /powershell/PowerCLI-Example-Scripts/Modules/ ) 3 | do 4 | mkdir "/root/.local/share/powershell/Modules/${file%.*}/" 5 | mv "/powershell/PowerCLI-Example-Scripts/Modules/$file" "/root/.local/share/powershell/Modules/${file%.*}/$file" 6 | done 7 | -------------------------------------------------------------------------------- /Scripts/vCenterSnapshot.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | Script name: vCenterSnapshot.ps1 4 | Created on: 20/09/2017 5 | Author: Lukas Winn, @lukaswinn 6 | Dependencies: Password is set to VMware123 in my test environment but this can be changed. 7 | 8 | .DESCRIPTION 9 | Script to retrieve snapshot information for all VM's in a given vCenter 10 | 11 | #> 12 | Write-Host "`nGet VM Snapshot Information!" 13 | Write-Host "Copyright 2017 Lukas Winn / @lukaswinn" 14 | Write-Host "Version 1.0" "`n" 15 | 16 | $vCenter = Read-Host -prompt 'Enter FQDN / IP address of vCenter' 17 | 18 | if ($vCenter) { 19 | $vcUser = Read-Host -prompt 'Username' 20 | 21 | Write-Host 'vCenter:' $vCenter '' 22 | 23 | # Connect to vCenter with $vCenter variable value 24 | Connect-VIServer -Server $vCenter -User $vcUser -Password VMware123 25 | 26 | Write-Host "`nConnected to vCenter: " $vCenter 27 | Write-Host 'Retrieving snapshot information...' 28 | Write-Progress -Activity 'Working...' 29 | 30 | # Get VM snapshot information and output in table format 31 | $getSnap = Get-VM | Get-Snapshot | sort SizeGB -descending | Select VM, Name, Created, @{Label="Size";Expression={"{0:N2} GB" -f ($_.SizeGB)}}, Id 32 | $getSnap | Format-Table | Out-Default 33 | 34 | # Close connection to active vCenter 35 | Disconnect-VIServer $vCenter -Confirm:$false 36 | Write-Host 'Connection closed to' $vCenter 37 | } 38 | else { 39 | Write-Warning "Error: No data entered for vCenter!" 40 | } 41 | -------------------------------------------------------------------------------- /Scripts/vSphereLogins.ps1: -------------------------------------------------------------------------------- 1 | Function Get-vSphereLogins { 2 | <# 3 | .SYNOPSIS Retrieve information for all currently logged in vSphere Sessions (excluding current session) 4 | .NOTES Author: William Lam 5 | .NOTES Site: www.virtuallyghetto.com 6 | .REFERENCE Blog: http://www.virtuallyghetto.com/2016/11/an-update-on-how-to-retrieve-useful-information-from-a-vsphere-login.html 7 | .EXAMPLE 8 | Get-vSphereLogins 9 | #> 10 | if($DefaultVIServers -eq $null) { 11 | Write-Host "Error: Please connect to your vSphere environment" 12 | exit 13 | } 14 | 15 | # Using the first connection 16 | $VCConnection = $DefaultVIServers[0] 17 | 18 | $sessionManager = Get-View ($VCConnection.ExtensionData.Content.SessionManager) 19 | 20 | # Store current session key 21 | $currentSessionKey = $sessionManager.CurrentSession.Key 22 | 23 | foreach ($session in $sessionManager.SessionList) { 24 | # Ignore vpxd-extension logins as well as the current session 25 | if($session.UserName -notmatch "vpxd-extension" -and $session.key -ne $currentSessionKey) { 26 | $session | Select Username, IpAddress, UserAgent, @{"Name"="APICount";Expression={$Session.CallCount}}, LoginTime 27 | } 28 | } 29 | } 30 | --------------------------------------------------------------------------------