<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Incorrect Credentials in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Incorrect-Credentials/m-p/456702#M7005</link>
    <description>&lt;P&gt;I am trying to run a PowerShell script to connect to multiple filers and do a 'get-ncvol'.&amp;nbsp; I have a scheduled task running from the Windows Task Scheduler that is running with a Group Managed Service Account. My script contains the username that I'm logging into the filer(s) with along with the password which is encrypted in a file (the encryption was done while running with the Group Managed Service Account).&amp;nbsp; I used the following to encrypt the password:&lt;/P&gt;&lt;P&gt;"password" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Set-Content "C:\myfiles\stuff\encryptedpassword.txt"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in my script, once again running as my Group Managed Service Account, I do the following:&lt;/P&gt;&lt;P&gt;$username = 'domain\id'&lt;/P&gt;&lt;P&gt;$password =&amp;nbsp; Get-Content&amp;nbsp;"C:\myfiles\stuff\encryptedpassword.txt" | ConvertTo-SecureString&lt;/P&gt;&lt;P&gt;$hosts = Get-Content "C:\myfiles\stuff\filers.txt"&lt;/P&gt;&lt;P&gt;$cred =&amp;nbsp;&amp;nbsp;$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password&lt;/P&gt;&lt;P&gt;$hosts | % { $filer = $_ Add-NcCredential -controller $filer -credential $cred }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;foreach($cluster in $hosts)&lt;/P&gt;&lt;P&gt;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Connect-NcController -name $cluster | Out-Null&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Get-NcVol | Export-CSV $filename -Append -NoTypeInformation&lt;/P&gt;&lt;P&gt;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When it tries to connect to the filer I get a "&lt;/P&gt;&lt;P&gt;Connect-NcController : Incorrect credentials for myfiler1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't figure out why the credential is incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Nov 2024 16:30:24 GMT</pubDate>
    <dc:creator>ToddBarton</dc:creator>
    <dc:date>2024-11-18T16:30:24Z</dc:date>
    <item>
      <title>Incorrect Credentials</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Incorrect-Credentials/m-p/456702#M7005</link>
      <description>&lt;P&gt;I am trying to run a PowerShell script to connect to multiple filers and do a 'get-ncvol'.&amp;nbsp; I have a scheduled task running from the Windows Task Scheduler that is running with a Group Managed Service Account. My script contains the username that I'm logging into the filer(s) with along with the password which is encrypted in a file (the encryption was done while running with the Group Managed Service Account).&amp;nbsp; I used the following to encrypt the password:&lt;/P&gt;&lt;P&gt;"password" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Set-Content "C:\myfiles\stuff\encryptedpassword.txt"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in my script, once again running as my Group Managed Service Account, I do the following:&lt;/P&gt;&lt;P&gt;$username = 'domain\id'&lt;/P&gt;&lt;P&gt;$password =&amp;nbsp; Get-Content&amp;nbsp;"C:\myfiles\stuff\encryptedpassword.txt" | ConvertTo-SecureString&lt;/P&gt;&lt;P&gt;$hosts = Get-Content "C:\myfiles\stuff\filers.txt"&lt;/P&gt;&lt;P&gt;$cred =&amp;nbsp;&amp;nbsp;$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password&lt;/P&gt;&lt;P&gt;$hosts | % { $filer = $_ Add-NcCredential -controller $filer -credential $cred }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;foreach($cluster in $hosts)&lt;/P&gt;&lt;P&gt;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Connect-NcController -name $cluster | Out-Null&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Get-NcVol | Export-CSV $filename -Append -NoTypeInformation&lt;/P&gt;&lt;P&gt;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When it tries to connect to the filer I get a "&lt;/P&gt;&lt;P&gt;Connect-NcController : Incorrect credentials for myfiler1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't figure out why the credential is incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 16:30:24 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Incorrect-Credentials/m-p/456702#M7005</guid>
      <dc:creator>ToddBarton</dc:creator>
      <dc:date>2024-11-18T16:30:24Z</dc:date>
    </item>
  </channel>
</rss>

