File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ function New-VBRConnection {
9
9
. OUTPUTS
10
10
Returns the Veeam Server connection.
11
11
. EXAMPLE
12
- New-VBRConnection -Endpoint <FQDN or IP> -Port <default 9419> -User <Administrator> -Pass <Password>
12
+ New-VBRConnection -Endpoint <FQDN or IP> -Port <default 9419> -Credential $(Get-Credential)
13
13
14
14
#>
15
15
@@ -22,17 +22,16 @@ function New-VBRConnection {
22
22
[Parameter (Position = 1 , mandatory = $true )]
23
23
[string ]$Port ,
24
24
25
- [Parameter (Position = 2 , mandatory = $true )]
26
- [string ]$User ,
27
-
28
- [Parameter (Position = 3 , mandatory = $true )]
29
- [string ]$Pass
25
+ [Parameter (Mandatory = $true , ParameterSetName = " Credential" )]
26
+ [ValidateNotNullOrEmpty ()]
27
+ [Management.Automation.PSCredential ]$Credential
30
28
31
29
)
32
30
33
31
$apiUrl = " https://$ ( $Endpoint ) :$ ( $Port ) /api/oauth2/token"
34
32
35
-
33
+ $User = $Credential.UserName
34
+ $Pass = $Credential.GetNetworkCredential ().Password
36
35
37
36
# Define the headers for the API request
38
37
$headers = @ {
You can’t perform that action at this time.
0 commit comments