Skip to content

Commit 747190c

Browse files
authored
Merge pull request #1 from vmware/master
Sync from original
2 parents 5e66c56 + c5c836d commit 747190c

File tree

82 files changed

+15294
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+15294
-62
lines changed

Modules/ContentLibrary/ContentLibrary.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Function Get-ContentLibraryItemFiles {
199199

200200
foreach($file in $files) {
201201
if($contentLibraryItemStorageService.get($itemId, $($file.name)).storage_backing.type -eq "DATASTORE"){
202-
$filepath = $contentLibraryItemStorageService.get($itemId, $($file.name)).storage_uris.AbsolutePath.split("/")[5..7] -join "/"
202+
$filepath = $contentLibraryItemStorageService.get($itemId, $($file.name)).storage_uris.segments -notmatch '(^/$|^vmfs$*|^volumes$*|vsan:.*)' -join ''
203203
$fullfilepath = "[$($datastore.name)] $filepath"
204204
}
205205
else{

Modules/VCSA/VCSA.psm1

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Function Get-VCSAPasswordPolicy {
2+
<#
3+
.DESCRIPTION Retrieves vCenter Server Appliance SSO and Local OS Password Policy Configuration
4+
.NOTES Author: William Lam
5+
.PARAMETER VCSAName
6+
Inventory name of the VCSA VM
7+
.PARAMETER VCSARootPassword
8+
Root password for VCSA VM
9+
.PARAMETER SSODomain
10+
SSO Domain of the VCSA VM
11+
.PARAMETER SSOPassword
12+
Administrator password for the SSO Domain of the VCSA VM
13+
.EXAMPLE
14+
Get-VCSAPasswordPolicy -VCSAName "MGMT-VCSA-01" -VCSARootPassword "VMware1!" -SSODomain "vsphere.local" -SSOPassword "VMware1!"
15+
#>
16+
Param (
17+
[Parameter(Mandatory=$true)][String]$VCSAName,
18+
[Parameter(Mandatory=$true)][String]$VCSARootPassword,
19+
[Parameter(Mandatory=$true)][String]$SSODomain,
20+
[Parameter(Mandatory=$true)][String]$SSOPassword
21+
)
22+
23+
$vm = Get-Vm -Name $VCSAName
24+
25+
if($vm) {
26+
$a,$b = $SSODomain.split(".")
27+
28+
$ssoPasswordPolicy = Invoke-VMScript -ScriptText "/opt/likewise/bin/ldapsearch -h localhost -w $SSOPassword -x -D `"cn=Administrator,cn=Users,dc=$a,dc=$b`" -b `"cn=password and lockout policy,dc=$a,dc=$b`" | grep vmwPassword" -vm $vm -GuestUser "root" -GuestPassword $VCSARootPassword
29+
$localOSPasswordPolicy = Invoke-VMScript -ScriptText "cat /etc/login.defs | grep -v '#' | grep PASS" -vm $vm -GuestUser "root" -GuestPassword $VCSARootPassword
30+
31+
Write-Host -ForegroundColor green "`nSSO Password Policy: "
32+
$ssoPasswordPolicy
33+
34+
Write-Host -ForegroundColor green "`nLocalOS Password Policy: "
35+
$localOSPasswordPolicy
36+
} else {
37+
Write-Host "`nUnable to find VCSA named $VCSAName"
38+
}
39+
}
40+
41+
Function Get-VCSAIdentitySource {
42+
<#
43+
.DESCRIPTION Retrieves vCenter Server Appliance Identity Source Configuration
44+
.NOTES Author: William Lam
45+
.PARAMETER VCSAName
46+
Inventory name of the VCSA VM
47+
.PARAMETER VCSARootPassword
48+
Root password for VCSA VM
49+
.EXAMPLE
50+
Get-VCSAIdentitySource -VCSAName "MGMT-VCSA-01" -VCSARootPassword "VMware1!"
51+
#>
52+
Param (
53+
[Parameter(Mandatory=$true)][String]$VCSAName,
54+
[Parameter(Mandatory=$true)][String]$VCSARootPassword
55+
)
56+
57+
$vm = Get-Vm -Name $VCSAName
58+
59+
if($vm) {
60+
$identitySources = Invoke-VMScript -ScriptText "/opt/vmware/bin/sso-config.sh -get_identity_sources 2> /dev/null | sed -ne '/^*/,$ p'" -vm $vm -GuestUser "root" -GuestPassword $VCSARootPassword
61+
62+
Write-Host -ForegroundColor green "`nIdentity Sources: "
63+
$identitySources
64+
65+
} else {
66+
Write-Host "`nUnable to find VCSA named $VCSAName"
67+
}
68+
}

Modules/VMware.CSP/VMware.CSP.psm1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
[Parameter(Mandatory=$true)][String]$RefreshToken
2222
)
2323

24-
$body = "refresh_token=$RefreshToken"
25-
$results = Invoke-WebRequest -Uri "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize" -Method POST -ContentType "application/x-www-form-urlencoded" -UseBasicParsing -Body $body
24+
$results = Invoke-WebRequest -Uri "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize" -Method POST -Headers @{accept='application/json'} -Body "refresh_token=$RefreshToken"
2625
if($results.StatusCode -ne 200) {
2726
Write-Host -ForegroundColor Red "Failed to retrieve Access Token, please ensure your VMC Refresh Token is valid and try again"
2827
break

Modules/VMware.DRaaS/VMware.DRaaS.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Function Connect-DRaas {
3232

3333
}
3434

35-
$results = Invoke-WebRequest -Uri "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize?refresh_token=$RefreshToken" -Method POST -ContentType "application/json" -UseBasicParsing -Headers @{"csp-auth-token"="$RefreshToken"}
35+
$results = Invoke-WebRequest -Uri "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize" -Method POST -Headers @{accept='application/json'} -Body "refresh_token=$RefreshToken"
3636
if($results.StatusCode -ne 200) {
3737
Write-Host -ForegroundColor Red "Failed to retrieve Access Token, please ensure your VMC Refresh Token is valid and try again"
3838
break

Modules/VMware.HCX/VMware.HCX.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ Function Connect-HcxCloudServer {
13821382
[Switch]$Troubleshoot
13831383
)
13841384

1385-
$results = Invoke-WebRequest -Uri "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize?refresh_token=$RefreshToken" -Method POST -ContentType "application/json" -UseBasicParsing -Headers @{"csp-auth-token"="$RefreshToken"}
1385+
$results = Invoke-WebRequest -Uri "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize" -Method POST -Headers @{accept='application/json'} -Body "refresh_token=$RefreshToken"
13861386
if($results.StatusCode -ne 200) {
13871387
Write-Host -ForegroundColor Red "Failed to retrieve Access Token, please ensure your VMC Refresh Token is valid and try again"
13881388
break

Modules/VMware.Hv.Helper/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
Prerequisites/Steps to use this module:
1+
# Prerequisites/Steps to use this module
22

33
1. This module only works for Horizon product E.g. Horizon 7.0.2 and later.
44
2. Install the latest version of Powershell, PowerCLI(6.5) or (later version via psgallery).
55
3. Import HorizonView module by running: Import-Module VMware.VimAutomation.HorizonView.
66
4. Import "VMware.Hv.Helper" module by running: Import-Module -Name "location of this module" or Get-Module -ListAvailable 'VMware.Hv.Helper' | Import-Module.
77
5. Get-Command -Module "This module Name" to list all available functions or Get-Command -Module 'VMware.Hv.Helper'.
88

9-
# Example script to connect view API service of Connection Server:
9+
# Example script to connect ViewAPI service
1010

11+
```
1112
Import-Module VMware.VimAutomation.HorizonView
13+
1214
# Connection to view API service
1315
$hvServer = Connect-HVServer -server <connection server IP/FQDN>
1416
$hvServices = $hvserver.ExtensionData
17+
18+
# List Connection Servers
1519
$csList = $hvServices.ConnectionServer.ConnectionServer_List()
20+
```
1621
# Load this module
22+
```
1723
Get-Module -ListAvailable 'VMware.Hv.Helper' | Import-Module
1824
Get-Command -Module 'VMware.Hv.Helper'
25+
```
1926
# Use advanced functions of this module
27+
```
2028
New-HVPool -spec 'path to InstantClone.json file'
29+
```

Modules/VMware.Hv.Helper/VMware.HV.Helper.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.3'
15+
ModuleVersion = '1.3.1'
1616

1717
# ID used to uniquely identify this module
1818
GUID = '6d3f7fb5-4e52-43d8-91e1-f65f72532a1d'

0 commit comments

Comments
 (0)