forked from timmcmic/DLConversionV2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-credentials.ps1
More file actions
46 lines (35 loc) · 1.7 KB
/
test-credentials.ps1
File metadata and controls
46 lines (35 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
42
43
44
45
46
<#
.SYNOPSIS
This function validates the parameters within the script. Paramter validation is shared across functions.
.DESCRIPTION
This function validates the parameters within the script. Paramter validation is shared across functions.
#>
Function test-credentials
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $true)]
$credentialsToTest
)
#Output all parameters bound or unbound and their associated values.
write-functionParameters -keyArray $MyInvocation.MyCommand.Parameters.Keys -parameterArray $PSBoundParameters -variableArray (Get-Variable -Scope Local -ErrorAction Ignore)
#Start function processing.
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN start-testCredentials"
Out-LogFile -string "********************************************************************************"
foreach ($credential in $credentialsToTest)
{
if ($credential.gettype().name -eq "PSCredential")
{
out-logfile -string ("Tested credential: "+$credential.userName)
}
else
{
out-logfile -string "Credential is not a valid PSCredential. All credentials must be PSCredential types." -isError:$TRUE
}
}
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "END test-Credentials"
Out-LogFile -string "********************************************************************************"
}