Add new functions for credential handling, node lookup, and context-aware parameter overrides; update module version to 1.2.0
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
function ConvertTo-ConfigurationDataDomainCredential {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[System.Management.Automation.PSCredential]
|
||||
$Credential,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]
|
||||
$Domain
|
||||
)
|
||||
|
||||
if([string]::IsNullOrWhiteSpace($Domain)){
|
||||
throw "Credential domain must not be empty."
|
||||
}
|
||||
|
||||
$UserName = [string]$Credential.UserName
|
||||
if($UserName.Contains("\") -or $UserName.Contains("@")){
|
||||
return $Credential
|
||||
}
|
||||
|
||||
return [System.Management.Automation.PSCredential]::new(
|
||||
"$Domain\$UserName",
|
||||
$Credential.Password
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user