<?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: Using Powershell to set Multiple timed.servers with variables in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107670#M4430</link>
    <description>&lt;P&gt;What is the error you see?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect if you initialize the string as $timeServers = &lt;STRONG&gt;'&lt;/STRONG&gt;"IP1,IP2,IP3"&lt;STRONG&gt;'&amp;nbsp; &lt;/STRONG&gt;(note the value of the string becomes &lt;STRONG&gt;"&lt;/STRONG&gt;IP1,IP2,IP3&lt;STRONG&gt;"&lt;/STRONG&gt; and that value is enclosed in single '), it will work.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jul 2015 10:08:43 GMT</pubDate>
    <dc:creator>Aparajita</dc:creator>
    <dc:date>2015-07-24T10:08:43Z</dc:date>
    <item>
      <title>Using Powershell to set Multiple timed.servers with variables</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107666#M4429</link>
      <description>&lt;P&gt;Having an issue using &lt;SPAN&gt;PowerShell&lt;/SPAN&gt;&amp;nbsp;to set 3 timed.servers which are defined in a variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Running the commands:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;$TimeServers = "IPaddress1,IPaddress2,IPaddress3"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Set-NaOption -OptionName timed.servers -OptionValue $TimeServers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 23:41:33 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107666#M4429</guid>
      <dc:creator>kramanella</dc:creator>
      <dc:date>2025-06-04T23:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using Powershell to set Multiple timed.servers with variables</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107670#M4430</link>
      <description>&lt;P&gt;What is the error you see?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect if you initialize the string as $timeServers = &lt;STRONG&gt;'&lt;/STRONG&gt;"IP1,IP2,IP3"&lt;STRONG&gt;'&amp;nbsp; &lt;/STRONG&gt;(note the value of the string becomes &lt;STRONG&gt;"&lt;/STRONG&gt;IP1,IP2,IP3&lt;STRONG&gt;"&lt;/STRONG&gt; and that value is enclosed in single '), it will work.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2015 10:08:43 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107670#M4430</guid>
      <dc:creator>Aparajita</dc:creator>
      <dc:date>2015-07-24T10:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using Powershell to set Multiple timed.servers with variables</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107694#M4432</link>
      <description>&lt;P&gt;So my goal is to only change one variable in one location in the script, as a result&amp;nbsp;&lt;SPAN&gt;I have nested variables&lt;/SPAN&gt;. Here's a more complete view into what I'm trying to accomplish:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# this is the only variable to change&lt;/P&gt;&lt;P&gt;$subnet = "xx"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$TimeServers = "xxx.xx.$subnet.50,xxx.xx.$subnet.51,xxx.xx.$subnet.2"&lt;/P&gt;&lt;P&gt;Set-NaOption -OptionName timed.servers -OptionValue $TimeServers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output of&amp;nbsp;Write-Host $TimeServers looks good, 3 comma seperated ip addresses with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the error message when the script runs:&lt;/P&gt;&lt;P&gt;Set-NaOption : Unable to set option: timed.servers&lt;BR /&gt;At P:\My Documents\WindowsPowerShell\timed_servers.ps1:57 char:1&lt;BR /&gt;+ Set-NaOption -OptionName timed.servers -OptionValue $TimeServers&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;+ CategoryInfo : InvalidOperation: (xxx.xx.xx.xx:NaController) [Set-NaOption], EAPIERROR&lt;BR /&gt;+ FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Options.SetNaOption&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2015 17:08:15 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107694#M4432</guid>
      <dc:creator>kramanella</dc:creator>
      <dc:date>2015-07-24T17:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using Powershell to set Multiple timed.servers with variables</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107700#M4433</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Set-NaOption CmdLet -optionvalue parameter expects a string and it shouldn't matter if that's a comma delimited string containing multiple IP Addresses. I noticed that whilst the cmdlet thows an error it does actually set the option value for all servers so this seems like it could be a bug (IMO). It might be possible to invoke the API using "Invoke-NaSystemApi" but I checked the ZAPI and noticed this also fails using ZExplore from the SDK:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ZAPI Request:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;BR /&gt;&amp;lt;netapp&amp;nbsp; xmlns="&lt;A href="http://www.netapp.com/filer/admin&amp;quot;" target="_blank"&gt;http://www.netapp.com/filer/admin"&lt;/A&gt; version="1.21"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;options-set&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;timed.servers&amp;lt;/name&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;value&amp;gt;192.168.100.10,192.168.100.11,192.168.100.12&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/options-set&amp;gt;&lt;BR /&gt;&amp;lt;/netapp&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ZAPI Results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;?xml version='1.0' encoding='UTF-8' ?&amp;gt;&lt;BR /&gt;&amp;lt;netapp version='1.1' xmlns='&lt;A href="https://community.netapp.com/" target="_blank"&gt;http://www.netapp.com/filer/admin'&amp;gt;&lt;/A&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!-- Output of options-set [Execution Time: 8610 ms] --&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;results reason='Unable to set option: timed.servers' errno='13001' status='failed'&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;cluster-constraint&amp;gt;same_preferred&amp;lt;/cluster-constraint&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;cluster_constraint&amp;gt;same_preferred&amp;lt;/cluster_constraint&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;message&amp;gt;1 entry was deleted.&lt;BR /&gt;&amp;lt;/message&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;/results&amp;gt;&lt;BR /&gt;&amp;lt;/netapp&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i think the options are either using the "Set-NaOption" cmdlet with the -SilentlyContinue parameter or the "Invoke-NaSsh" cmdlet with -ErrorAction stop.&lt;/P&gt;&lt;P&gt;As a work around i'd recommend something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[String]$servers = "192.168.100.10,192.168.100.11,192.168.100.12"&lt;BR /&gt;[String]$command = "options timed.servers $servers"&lt;BR /&gt;Try{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Invoke-NaSsh -Command $command -ErrorAction Stop&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Write-Host "Executed Command: $command"&amp;nbsp; &amp;nbsp;&lt;BR /&gt;}Catch{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Write-Warning -Message $("Failed Executing Command: $command. Error " + $_.Exception.Message)&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/matt&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jul 2015 07:13:43 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107700#M4433</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2015-07-25T07:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using Powershell to set Multiple timed.servers with variables</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107706#M4434</link>
      <description>&lt;P&gt;Ahh, from Matt's observations and my own experiments, this looks like a bug in the zapi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first time I try setting multiple time servers, the zapi reports an error but sets it correctly none-the-less. If I repeat the same zapi call one more time, the call returns success. Same behavior is repeated when using the PSTK cmdlets as well - since they internally call the zapi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another alternate (to Matt's) workaround is to run the Set-NaOption with ErrorAction set as 'SilentlyContinue' and then use the Get-NaOption to check if timeserver was set correctly. If not set correctly, the script should throw an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 04:29:21 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Using-Powershell-to-set-Multiple-timed-servers-with-variables/m-p/107706#M4434</guid>
      <dc:creator>Aparajita</dc:creator>
      <dc:date>2015-07-27T04:29:21Z</dc:date>
    </item>
  </channel>
</rss>

