<?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 Netapp powershell toolkit in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127601#M5232</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a netapp powershell toolkit script to get the uptime of the filer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mark Gemina&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jun 2025 15:30:14 GMT</pubDate>
    <dc:creator>Gemina</dc:creator>
    <dc:date>2025-06-04T15:30:14Z</dc:date>
    <item>
      <title>Netapp powershell toolkit</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127601#M5232</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a netapp powershell toolkit script to get the uptime of the filer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mark Gemina&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 15:30:14 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127601#M5232</guid>
      <dc:creator>Gemina</dc:creator>
      <dc:date>2025-06-04T15:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Netapp powershell toolkit</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127610#M5234</link>
      <description>&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The uptime is based on the cluster node (assuming you are referring to cDOT). I don't think there is any CmdLet for this but you can run the SSH command and parse the output.&lt;/P&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Param(
   [Parameter(Mandatory=$True, HelpMessage="The hostname or IP Address of the cluster")]
   [String]$Cluster
)
#'------------------------------------------------------------------------------
#'Connect to the cluster
#'------------------------------------------------------------------------------
Import-Module DataONTAP -ErrorAction SilentlyContinue
$credentials = Get-Credential -Credential "admin"
Try{
   Connect-NcController -Name $Cluster -HTTPS -Credential $credentials -ErrorAction Stop | Out-Null
   Write-Host "Connected to cluster ""$Cluster"""
}Catch{
   Write-Warning -Message $("Failed connecting to cluster ""$Cluster"". Error " + $_.Exception.Message)
   Break;
}
#'------------------------------------------------------------------------------
#'Enumerate the uptime.
#'------------------------------------------------------------------------------
[String]$command = "system node show -fields uptime -node *"
Try{
   $output = Invoke-NcSsh -Command $command -ErrorAction Stop
   Write-Host "Executed Command`: $command"
}Catch{
   Write-Warning -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
   Break;
}
#'------------------------------------------------------------------------------
#'Display the SSH output.
#'------------------------------------------------------------------------------
Write-Host $output.Value
#'------------------------------------------------------------------------------
#'Add the SSH output into a hashtable.
#'------------------------------------------------------------------------------
[HashTable]$nodeUptime = @{};
[Array]$results        = $output.Value.Split("`r`n")
For($i = 3; $i -le $results.Count; $i++){
   If($results[$i] -ne "" -And $results[$i] -ne $Null){
      [Array]$elements = $results[$i].Split(" ")
      [String]$node    = $elements[0].ToString().Trim();
      [String]$uptime  = $($results[$i] -Replace($node, "")).ToString().Trim();
      If(-Not($nodeUptime.ContainsKey($node))){
         If(-Not($uptime -Match "entries were displayed")){
            $nodeUptime.Add($node, $uptime)
         }
      }
   }
}
$nodeUptime
#'------------------------------------------------------------------------------&lt;/PRE&gt;&lt;P&gt;Example output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PS C:\Scripts\PowerShell\Projects\GetClusterUptime&amp;gt; .\GetClusterUptime.ps1 -Cluster hecklers
Connected to cluster "hecklers"
Executed Command: system node show -fields uptime -node *
node        uptime
----------- ------------
hecklers-01 9 days 08:09
hecklers-02 9 days 08:09
waldorf-01  9 days 08:09
waldorf-02  9 days 08:08
4 entries were displayed.

Name                           Value
----                           -----
hecklers-02                    9 days 08:09
waldorf-01                     9 days 08:09
hecklers-01                    9 days 08:09
waldorf-02                     9 days 08:08&lt;/PRE&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>Wed, 01 Feb 2017 06:57:27 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127610#M5234</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2017-02-01T06:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Netapp powershell toolkit</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127641#M5240</link>
      <description>&lt;P&gt;The uptime is returned as a property using the Get-NcNode cmdlet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Get-NcNode | Select Node,NodeUptimeTS&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the NodeUptimeTS object is a TimeSpan type, this means it has a fair amount of detail. &amp;nbsp;Here's what one of my nodes looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PS C:\Users\asull&amp;gt; Get-NcNode | Select Node,NodeUptimeTS

Node    NodeUptimeTS
----    ------------
VICE-07 31.06:30:06 
VICE-08 31.06:50:33 

PS C:\Users\asull&amp;gt; (Get-NcNode VICE-07).NodeUptimeTS | Out-String


Days              : 31
Hours             : 6
Minutes           : 31
Seconds           : 31
Milliseconds      : 0
Ticks             : 27018910000000
TotalDays         : 31.2718865740741
TotalHours        : 750.525277777778
TotalMinutes      : 45031.5166666667
TotalSeconds      : 2701891
TotalMilliseconds : 2701891000&lt;/PRE&gt;&lt;P&gt;Notice that the short format is "days.hours:minutes:seconds", or you can get each of those properties from the object individually. &amp;nbsp;For examle, you could do a much more friendly output for a report doing something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;“Node Uptime: {0:dd} days, {0:hh} hours, {0:mm} minutes” -f (Get-NcNode VICE-07).NodeUptimeTS&lt;/PRE&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 14:13:57 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127641#M5240</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2017-02-01T14:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Netapp powershell toolkit</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127688#M5244</link>
      <description>&lt;P&gt;I believe that Nc commands are for cmode. We are using 7-mode. Is there a command for 7-mode?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 07:00:47 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127688#M5244</guid>
      <dc:creator>Gemina</dc:creator>
      <dc:date>2017-02-02T07:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Netapp powershell toolkit</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127689#M5245</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry i just assumed you'd want the uptime for a cDOT system. Yes you are right, the &lt;STRONG&gt;*-Nc*&lt;/STRONG&gt; CmdLets are for cDOT and the &lt;STRONG&gt;*-Na*&lt;/STRONG&gt; CmdLets are for 7-Mode.&lt;/P&gt;&lt;P&gt;There is no PowerShell CmdLet for the uptime in 7-Mode but you can invoke the "uptime" command via SSH which is displayed as a string. EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Param(
   [Parameter(Mandatory=$True, HelpMessage="The hostname or IP Address of the controller")]
   [String]$Controller
)
#'------------------------------------------------------------------------------
#'Connect to the controller
#'------------------------------------------------------------------------------
Import-Module DataONTAP -ErrorAction SilentlyContinue
$credentials = Get-Credential -Credential "root"
Try{
   Connect-NaController -Name $Controller -HTTPS -Credential $credentials -ErrorAction Stop | Out-Null
   Write-Host "Connected to controller ""$Controller"""
}Catch{
   Write-Warning -Message $("Failed connecting to controller ""$Controller"". Error " + $_.Exception.Message)
   Break;
}
#'------------------------------------------------------------------------------
#'Enumerate the controller uptime.
#'------------------------------------------------------------------------------
[String]$command = "uptime"
Try{
   $output = Invoke-NaSsh -Command $command -ErrorAction Stop
   Write-Host "Executed Command`: $command"
}Catch{
   Write-Warning -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
   Break;
}
$output.Split(",")[0].Trim();
#'------------------------------------------------------------------------------&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested it using a simulator, Example output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PS C:\Scripts\PowerShell\Projects\GetControllerUptime&amp;gt; .\GetControllerUptime.ps1 -Controller testns01
Connected to controller "testns01"
Executed Command: uptime
6:21pm up 11 mins&lt;/PRE&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 07:29:49 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Netapp-powershell-toolkit/m-p/127689#M5245</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2017-02-02T07:29:49Z</dc:date>
    </item>
  </channel>
</rss>

