Mount windows share in command line via net use with password encrypted.

Hi all,

my question is in the subject.

 

thank you and have a good day.

 

Rafter

Parents
No Data
Reply
  • here's the lines of the script (in bold caracters) :

     

    Get-Credential | Export-Clixml .\mycredfile.xml     : it give me a pop up to write the username and password and put it in mycredfile.xml ... there's no pb in this line.

    $Credential = Import-Clixml .\mycredfile.xml : no pb in this line also.

     net use X: \\r7-abelcash-03\AE /user:$($Credential.UserName) $($Credential.GetNetworkCredential().P
    assword)

    [Deserialized.System.Management.Automation.PSCredential] not contain the method called « GetNetworkCredential ».
    Au niveau de ligne : 1 Caractère : 96
    + net use X: \\servername\share /user:$($Credential.UserName) $($Credential.GetNetworkCredential <<<< ().Password)
        + CategoryInfo          : InvalidOperation: (GetNetworkCredential:String) [], RuntimeException
        + FullyQualifiedErrorId : MethodNotFound

    enter password 'domaine\user' to connect to servername. :

     

    thank you

     

Children