잊지 않겠습니다.

'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 xyzlast Y2K


티스토리 툴바