<?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 Re: Help with NetApp PowerShell Toolkit in external script called by VMware SRM in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Help-with-NetApp-PowerShell-Toolkit-in-external-script-called-by-VMware-SRM/m-p/137111#M5599</link>
    <description>&lt;P&gt;Oh, for crying out loud... (that's the G rated version of what I actually said).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for Start-Transcript/Stop-Transcript, I did not know about it.&amp;nbsp; It has pointed out exactly the problem.&amp;nbsp; The PsModulePath for the user running this script through SRM apparently does not get populated with "C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\".&amp;nbsp; I appended it that env. var and it works now.&amp;nbsp; Boy do I feel dumb.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for the clue-bat to the back of the head.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jan 2018 17:23:00 GMT</pubDate>
    <dc:creator>iehrenwaldHBG</dc:creator>
    <dc:date>2018-01-05T17:23:00Z</dc:date>
    <item>
      <title>Help with NetApp PowerShell Toolkit in external script called by VMware SRM</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Help-with-NetApp-PowerShell-Toolkit-in-external-script-called-by-VMware-SRM/m-p/137105#M5596</link>
      <description>&lt;P&gt;I'm having a very weird problem with VMware SRM running a script written in PowerShell during a custom step in a test/recovery plan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code in question is very simple (edited here for brevity):&lt;/P&gt;&lt;PRE&gt;$pwx = Get-Content C:\SRM_Scripts\credentials\$($Vserver).txt | ConvertTo-SecureString

$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ClusterUser,$pwx
if($Credential.UserName -ne $ClusterUser){
    mylogger -LogFile $Log -Message "    Unable to retrieve credentials for $Cluster.  Cannot continue." -Color Red
    exit 1
} else {
    mylogger -LogFile $Log -Message "    Retrieved credentials for $($Credential.UserName)" -Color Green
}

$ClusterConn = Connect-NcController -Name $Cluster -Vserver $Vserver -Credential $Credential
mylogger -LogFile $Log -Message "Returned properties: Name:$($ClusterConn.Name) Address:$($ClusterConn.Address) Vserver:$($ClusterConn.Vserver) Version:$($ClusterConn.Version)" -Color Yellow

if($ClusterConn.Name -ne $Cluster){
    mylogger -LogFile $Log -Message "Unable to connect to $Cluster, check credentials or other connection attributes.  Cannot continue." -Color Red
    exit 1
} else {
    mylogger -LogFile $Log -Message "Connection to $($ClusterConn.Name) established" -Color Green
}&lt;/PRE&gt;&lt;P&gt;When I run this script (the above code is just a snippit from the larger script) from a PowerShell command prompt launched as the local account that SRM runs as, srmadmin, my script works correctly.&amp;nbsp; When I call this script from within SRM as a custom step in a test/recovery plan, the script dies because Connect-NcController fails to return anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've peppered debugging write-host/logging statements everywhere can I can't for the life of me figure out why this works perfectly when NOT run from within SRM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Surely someone else has done something with SRM and the PSTK here?&amp;nbsp; Any pointers?&amp;nbsp; I've been beating my head against the wall for quite some time on this.&amp;nbsp; Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 14:10:40 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Help-with-NetApp-PowerShell-Toolkit-in-external-script-called-by-VMware-SRM/m-p/137105#M5596</guid>
      <dc:creator>iehrenwaldHBG</dc:creator>
      <dc:date>2025-06-04T14:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with NetApp PowerShell Toolkit in external script called by VMware SRM</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Help-with-NetApp-PowerShell-Toolkit-in-external-script-called-by-VMware-SRM/m-p/137107#M5597</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/65187"&gt;@iehrenwaldHBG&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you say the Connect-NcController cmdlet fails to return anything...you mean, literally, nothing?&amp;nbsp; Any error messages?&amp;nbsp; What is the contents of the varuable $global:CurrentNcController after the connection attempt?&amp;nbsp; Does your logging return anything?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In doing a bit of testing, when I assign the Connect-NcController output to a variable, the value is empty/null when the connection fails (e.g. because of incorrect credentials).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I listed some ways to store credentials for scripts at the bottom of &lt;A href="https://practical-admin.com/blog/netapp-powershell-toolkit-authentication/" target="_self"&gt;this blog post&lt;/A&gt;, perhaps one of those ways will work for you?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 16:35:23 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Help-with-NetApp-PowerShell-Toolkit-in-external-script-called-by-VMware-SRM/m-p/137107#M5597</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2018-01-05T16:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help with NetApp PowerShell Toolkit in external script called by VMware SRM</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Help-with-NetApp-PowerShell-Toolkit-in-external-script-called-by-VMware-SRM/m-p/137109#M5598</link>
      <description>&lt;P&gt;Also, you can capture all output of the script using the Start-Transcript cmdlet...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Start-Transcript -Path C:\logs\testme.log

$ClusterConn = Connect-NcController -Name $Cluster -Vserver $Vserver -Credential $Credential

Stop-Transcript&lt;/PRE&gt;&lt;P&gt;This will help capture errors output to the "console" (like below) that wouldn't normally be captured...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.netapp.com/t5/image/serverpage/image-id/8014i4B645B0F3B9134CF/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="2018-01-05 11_38_33-Windows PowerShell ISE.png" title="2018-01-05 11_38_33-Windows PowerShell ISE.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 16:39:44 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Help-with-NetApp-PowerShell-Toolkit-in-external-script-called-by-VMware-SRM/m-p/137109#M5598</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2018-01-05T16:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help with NetApp PowerShell Toolkit in external script called by VMware SRM</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Help-with-NetApp-PowerShell-Toolkit-in-external-script-called-by-VMware-SRM/m-p/137111#M5599</link>
      <description>&lt;P&gt;Oh, for crying out loud... (that's the G rated version of what I actually said).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for Start-Transcript/Stop-Transcript, I did not know about it.&amp;nbsp; It has pointed out exactly the problem.&amp;nbsp; The PsModulePath for the user running this script through SRM apparently does not get populated with "C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\".&amp;nbsp; I appended it that env. var and it works now.&amp;nbsp; Boy do I feel dumb.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for the clue-bat to the back of the head.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 17:23:00 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Help-with-NetApp-PowerShell-Toolkit-in-external-script-called-by-VMware-SRM/m-p/137111#M5599</guid>
      <dc:creator>iehrenwaldHBG</dc:creator>
      <dc:date>2018-01-05T17:23:00Z</dc:date>
    </item>
  </channel>
</rss>

