I am trying to create a simple powershell script that will walk the steps of create a volume and a share otuside of the UI and force to go through each step along the way.
At first I was trying to make it so you would just fill in the $variables at the top of the script for what you want and then have it run the various new-ncvol commands- but this kept erroring.
Then when i just input New-NcVol it behaved exactly as i wanted to too by then prompting me for voume name, aggragate, juntion path, and size <-- this is exactly what i want- somthing that a co worker could run and just type in the information / details of the share they want to create - But i always get the same error right after inputting the size?
PS C:\WINDOWS\system32> New-NcVol cmdlet New-NcVol at command pipeline position 1 Supply values for the following parameters: (Type !? for Help.) Name: test99 Aggregate: aggr4 JunctionPath: /test99 Size: 10 New-NcVol : Value in $global:CurrentNcController is not of type NetApp.Ontapi.Filer.C.NcController At line:1 char:1 + New-NcVol + ~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [New-NcVol], ArgumentException + FullyQualifiedErrorId : ControllerNotSpecified,DataONTAP.C.PowerShell.SDK.Cmdlets.Volume.NewNcVol
I am not looking to do bulk deployments or mass automation - just a way for a simple CLI script to walk through the vol / share creattion process so that anyone with some details could enter them in and it would get made - e.g. I send a mail to Joe saying hey man, can you run ( import ontap module etc ) new-ncvol with the following details ( name, size , aggr, svm ) and he would be able to do so for me?
I think the error you are getting might be because you haven't connected to a cluster before attempting to use the New-NcVol cmdlet. You could try something like this basic example, if the user doesn't enter the input parameters when invoking the script they will be prompted for the input.
Note: if you don't specifiy the volume security style the new volume will automatically inherit the security style of the vservers root volume.
There are many more options you might want to consider when creating volumes, EG dedupe, export policies etc. This is just an example to get you started, modify to meet your requirements. Hope this helps
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
The playbook is just a configuration file in .yml format (no coding required), you then invoke the playbook and Ansible will deploy the configuration for you. EG i saved the above playbook as "create_volume_cifs_share.yml" and then execute it
The advantage to this method is that you don't need to develop scripts or write any code. Just define the configuration. Perhaps this is an option for you to consider and explore? A good place to start to learn more if you have never used ansible before is this blog: