Subscribe

Import-Module DataONTAP very slow

[ Edited ]

Import-Module DataONTAP is very slow. How can I speed this up?

 

PS C:\Windows\system32> Measure-Command {Import-Module DataONTAP}


Days : 0
Hours : 0
Minutes : 1
Seconds : 29
Milliseconds : 484
Ticks : 894848737
TotalDays : 0,00103570455671296
TotalHours : 0,0248569093611111
TotalMinutes : 1,49141456166667
TotalSeconds : 89,4848737
TotalMilliseconds : 89484,8737

 

PS C:\Windows\system32>

 

Also, I installed PowerShell Toolkit 4.4, and it is showing 4.2:

 

PS C:\Windows\system32> Get-Module DataONTAP

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 4.2.0 DataONTAP {Add-NaAggr, Add-NaCifsShare, Add-NaCredential, Add-NaFpol...

 

any ideas ?

 

Re: Import-Module DataONTAP very slow

Here was my result

 

Seconds : 1
Milliseconds : 573

 

Also, with the later versions of dataontap it should be in your psmodulepath so you don't have to import the module.   

 

I commented this out in my profile a while ago - #import-module dataontap

 

Type this

$env:PSModulePath

 

The output should have this line in there.

C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\

 

The common misnumber has been consistent  from the last version as well.  I just ignore it for now.

 

 

Re: Import-Module DataONTAP very slow

>> Improving module load time

 

One option to reduce the module load time is to load only the cmdlets that you'll actually use.

      For example, if you're not using 7-mode, you could load only the cmdlets matching *Nc* - running `Import-Module DataONTAP` took about 120ms more on my system than `Import-Module DataONTAP -Cmdlet *Nc*`. If you are using the Import statement as part of a script, or you use only a few cmdlets, you may want to mention them by name - that'll decrease the load time even further.

 

Another option to look at, would be your PSModulePath - if there are many entries there and the path to DataONTAP is near the end, that might explain some of the delay. Moving the path towards the beginning might speed up search and reduce the overall load time.

 

>> The version mis-match

 

There is a Data ONTAP PSTK version and a NetApp PSTK version. NetApp PSTK is the parent package of SANtricity and Data ONTAP PSTKs (not sure if any more have been added over the years). I suspect you downloaded NetApp PSTK 4.4, which packages Data ONTAP PSTK 4.2.

 

Hope this helps,

Aparajita

Re: Import-Module DataONTAP very slow

Even took a little longer when importing only Nc Modules:

 

PS C:\Users\waring> Measure-Command {Import-Module DataONTAP -Cmdlet *Nc*}


Days : 0
Hours : 0
Minutes : 1
Seconds : 31
Milliseconds : 948
Ticks : 919482281
TotalDays : 0,00106421560300926
TotalHours : 0,0255411744722222
TotalMinutes : 1,53247046833333
TotalSeconds : 91,9482281
TotalMilliseconds : 91948,2281

 

PS C:\Users\waring>

 

Looking into the path-suggestion....

 

Re: Import-Module DataONTAP very slow

My Module-Path looks like this:

 

PS D:\PowerShell> $env:PSModulePath
C:\Users\waring\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell
\v1.0\Modules\;;C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\.

 

How do I change this persistently and to what paths should I set it?

Re: Import-Module DataONTAP very slow

When I do not explicitly import the module, then the first Nc-command I enter in the PowerShell takes very long (about 90 sec), obviously it then implicitly imports the module.

Re: Import-Module DataONTAP very slow

You don't need to,  It's pre-loaded 

 

Open up a PS window and without loading data ontap you should be able to type

 

get-natoolkitversion and see if that comes up

Re: Import-Module DataONTAP very slow

OK, started a clean PowerShell Window and entered get-natoolkitversion, same result, takes 92 sec

 

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.

PS C:\Users\waring> Measure-Command {get-natoolkitversion}


Days : 0
Hours : 0
Minutes : 1
Seconds : 32
Milliseconds : 822
Ticks : 928221834
TotalDays : 0,00107433082638889
TotalHours : 0,0257839398333333
TotalMinutes : 1,54703639
TotalSeconds : 92,8221834
TotalMilliseconds : 92822,1834

 

PS C:\Users\waring>

Re: Import-Module DataONTAP very slow

Ok, when you downloaded and installed data ontap, when you downloaded it, did you right click properties, and select "unblock".  At least at my company I find that i need to do that.

 

If the module is loaded locally, i'm not sure why it is taking this long

Re: Import-Module DataONTAP very slow

not sure what you mean with "unblock" I just downloaded NetApp_PowerShell_Toolkit_4.4.0.msi and ran it. I see no "unblock" when I right click and select "Properties"