<?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 Powershell SDK Connect-NcControler returns $NULL when run as SCOM monitor script in Simulator Discussions</title>
    <link>https://community.netapp.com/t5/Simulator-Discussions/Powershell-SDK-Connect-NcControler-returns-NULL-when-run-as-SCOM-monitor-script/m-p/145606#M2413</link>
    <description>&lt;P&gt;I wrote a script that works perfectly in a powershell runspace but when run in SCOM as a monitor, the Connect-NcController returns a $null value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can run under the local system context or under my user credentials context so it is not a search path or anything like that.&amp;nbsp; The only thing I can find is that when SCOM creates the powershell runspace, it has a $host.Version of "7.0.5000.0" instead of "4.0".&lt;/P&gt;
&lt;P&gt;the code that works in the 4.0 space but not in the 7.0.5000.0 space is as follows:&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;$Password=ConvertTo-SecureString -AsPlainText -Force $UserPassword&lt;BR /&gt;$Creds=New-Object System.Management.Automation.PSCredential( $UserName,$Password)&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;$Controller=Connect-NcController -name $ControllerName -credential $Creds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know what is different in the SCOM implementation of powershell versus the standard powershell runspace that causes a $null value to be returned.&amp;nbsp; &amp;nbsp;I have the cmdLet in a try/catch but there is no error so the catch portion of the code never executes.&amp;nbsp; I could at least work with an error but I just get back a $null value which I cannot work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Our storage team does not have any vested interest in using plug-in for scom since it woudl monitor the whole solution but we have an interest in monitoring the CIFS shares and the volumes for alerting and reporting and thus why I went this route.&amp;nbsp; I can come up with a work-around but was hoping to find a more forthright solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Craig&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jun 2025 12:59:27 GMT</pubDate>
    <dc:creator>LowMemory</dc:creator>
    <dc:date>2025-06-04T12:59:27Z</dc:date>
    <item>
      <title>Powershell SDK Connect-NcControler returns $NULL when run as SCOM monitor script</title>
      <link>https://community.netapp.com/t5/Simulator-Discussions/Powershell-SDK-Connect-NcControler-returns-NULL-when-run-as-SCOM-monitor-script/m-p/145606#M2413</link>
      <description>&lt;P&gt;I wrote a script that works perfectly in a powershell runspace but when run in SCOM as a monitor, the Connect-NcController returns a $null value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can run under the local system context or under my user credentials context so it is not a search path or anything like that.&amp;nbsp; The only thing I can find is that when SCOM creates the powershell runspace, it has a $host.Version of "7.0.5000.0" instead of "4.0".&lt;/P&gt;
&lt;P&gt;the code that works in the 4.0 space but not in the 7.0.5000.0 space is as follows:&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;$Password=ConvertTo-SecureString -AsPlainText -Force $UserPassword&lt;BR /&gt;$Creds=New-Object System.Management.Automation.PSCredential( $UserName,$Password)&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;$Controller=Connect-NcController -name $ControllerName -credential $Creds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know what is different in the SCOM implementation of powershell versus the standard powershell runspace that causes a $null value to be returned.&amp;nbsp; &amp;nbsp;I have the cmdLet in a try/catch but there is no error so the catch portion of the code never executes.&amp;nbsp; I could at least work with an error but I just get back a $null value which I cannot work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Our storage team does not have any vested interest in using plug-in for scom since it woudl monitor the whole solution but we have an interest in monitoring the CIFS shares and the volumes for alerting and reporting and thus why I went this route.&amp;nbsp; I can come up with a work-around but was hoping to find a more forthright solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Craig&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 12:59:27 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Simulator-Discussions/Powershell-SDK-Connect-NcControler-returns-NULL-when-run-as-SCOM-monitor-script/m-p/145606#M2413</guid>
      <dc:creator>LowMemory</dc:creator>
      <dc:date>2025-06-04T12:59:27Z</dc:date>
    </item>
  </channel>
</rss>

