Saturday, 10 April 2021

Credentials objects in PowerShell

 

$UserName = 'Sumant'

    $Password = 'Password@123' | ConvertTo-SecureString -AsPlainText -Force

    

    # method 1

    [pscredential]::new($Username,$Password)

    

    # method 2

    New-Object System.Management.Automation.PSCredential($UserName,$Password)

No comments:

Post a Comment