20 lines
513 B
PowerShell
20 lines
513 B
PowerShell
function ConvertTo-ConfigurationDataCredential {
|
|
[CmdletBinding()]
|
|
Param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]
|
|
$UserName,
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
$Password
|
|
)
|
|
|
|
if($Password -is [System.Security.SecureString]){
|
|
$SecurePassword = $Password
|
|
}else{
|
|
$SecurePassword = ConvertTo-SecureString -String ([string]$Password) -AsPlainText -Force
|
|
}
|
|
|
|
return [System.Management.Automation.PSCredential]::new($UserName, $SecurePassword)
|
|
}
|