title: plink in PowerShell to run commands on Linux machine (SuSE)
body: <p>I am trying to automate the process of adding extra storage in a linux machine. I'm using <code>plink</code> in PowerShell installed on my Windows machine.</p>
  
  <p>Below is the code:</p>
  
  <pre><code>$plinkpath = "C:\Users\mydrive\Modules\plink.exe"
  if (Test-Path $plinkpath) {
      Set-Alias plink $plinkpath
  } else {
      throw "Plink.exe is reqruied"
  }
  $passw = "linuxadmin$123"
  $commands = @(
      "sudo su;",
      "pvcreate /dev/sde;",
      "vgcreate test_vog /dev/sde",
      "lvcreate -l 100%FREE -n test_lev test_vog;",
      "mkfs.ext3 /dev/test_vog/test_lev;",
      "mkdir /azurenew;",
      "echo ""/dev/test_vog/test_lev /azurenew/ ext3 defaults 1 1"" &gt;&gt; /etc/fstab;",
      "mount /azurenew/;" 
  )
  </code></pre>
  
  <p><strong>Approach 1: Using .ppk file</strong></p>
  
  <pre><code>plink -ssh -i "C:\Users\amurthy\Documents\WindowsPowerShell\Modules\sshprivate.ppk" linuxadmin@xx.xx.xx.xxx $commands
  </code></pre>
  
  <p>In the above situation PowerShell hangs and no response on the console. Not sure what's happening.</p>
  
  <p><strong>Approach 2: using direct log in</strong></p>
  
  <pre><code>plink -P "22" -v "linuxadmin@xx.xx.xx.xxx" -pw "linuxadmin$123" $commands
  </code></pre>
  
  <p>Here, I get below response on console</p>
  
  <p>Using username "linuxadmin".
  Sent password
  <strong>Password authentication failed</strong></p>
  
  <p>I do not understand why the passoword authentication failed though I am able to login using putty.exe with that password.</p>
  
  <p>Can anyone please help me here to solve my above automation problem? If you have any better solution altogether really welcome.</p>