잊지 않겠습니다.

'script programming'에 해당되는 글 1건

  1. 2009.06.20 Using PSCredential without User-Prompt
Using Powershell, You cannot use get-credential without some type of user-prompt. 

But! 
I found the method without user-prompt window!!

Here is my code
function Get-PSCredential
{
    param($userName, $password)    
    $secured_password = ConvertTo-SecureString $password -AsPlainText -Force
    New-object Management.Automation.PSCredential($userName, $secured_password)    
}

$cred = Get-PSCredential -userName "Administrator" -password "abcdefghijk"


Posted by Y2K
,