Within the PowerShell community there has been a lingering debate over modules and providers. Initially everyone seemed compelled to do both. Personally, I’ve never been very impressed by third party providers. Mainly because they always felt like a gimmick. They forced the file system analog, and the results where not very good. They were buggy, slow, and didn’ t support the standard provider hooks. This lead to many vendors never bothering, and focused instead on cmdlets. I myself had come to the conclusion that providers where something for the PowerShell team, and third party ISV should just leave them alone. Fortunately the provider in version 1.3 of the DataONTAP PowerShell toolkit has broken the mold and renewed my faith in providers!
First of all PSDrives have always been a little jenky. Not the fault of the PowerShell team, but I’ve never found the New-PSDrive cmdlet particularly intuitive. NetApp worked around this hurdle by simply providing a cmdlet to do all the heavy lifting for you. For example to create a PSDrive to NTAP01 you could run.
|
<span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong>[0:4]></strong></span> Mount-NaController -Name NTAP01 Name Used (GB) Free (GB) Provider Root CurrentLocation ---- --------- --------- -------- ---- --------------- NTAP01 DataONTAP / </span></span></span> |
|
Of course, if you prefer a challenge you could still use the built in cmdlet. The only downside here would be you can only connect to the filer in your global scope. Meaning you cannot connect to multiple filers at once.
|
<span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong>[0:43]></strong></span> Connect-NaController -Name NTAP01 Name Address Ontapi Version ---- ------- ------ ------- NTAP01 10.10.10.7 1.12 NetApp Release 7.3.4P2: Sat Sep 4 03:55:53 PDT 2010 <span style="color: #ffff00;"><strong> [0:44]></strong></span></span></span></span><span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;">New-PSDrive -Name NTAP02 -PSProvider DataONTAP -Root Name Used (GB) Free (GB) Provider Root CurrentLocation ---- --------- --------- -------- ---- --------------- NTAP02 DataONTAP </span></span></span><span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong> </strong></span></span></span></span> |
|
Either way once you’ve connected you will have two top level “folders”. The etc folder and the vol folder, they are exactly what you think they are. Now here is where it gets really cool! Using the toolkit you programatically interact with the internal file system regardless of the protocol or format! For instance a LUN is represented as a file, Qtrees are folders, etc, etc… The only part of the system not represented is the aggregate itself.
This enables some really powerful stuff as you can effectively access any part of the file system regardless of the ACL on that file system. Now you can’t copy or move anything, but that’s about the only thing you can’t do!
For instance you can Create files/folders.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
<span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong>[0:73]></strong></span> mkdir where_did_this_come_from </span></span></span><span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong>[0:74]></strong></span> ls Name Type Size Created Modified Owner Group Perm Empty ---- ---- ---- ------- -------- ----- ----- ---- ----- . directory 4 KB 2/14/2011 2/14/2011 0 0 777 False .. directory 4 KB 12/22/2010 2/14/2011 0 0 1077 False where_did_this_come_from directory 4 KB 2/14/2011 2/14/2011 0 0 777 True </span></span></span><span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong>[0:75]></strong></span> "wouldn`'t you like to know`r`nlove`r`nI`'m not telling" | >> Set-Content -Path .where_did_this_come_fromanswer.txt</span></span></span> <span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong>[0:76]></strong></span> ls .</span></span></span><span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;">where_did_this_come_from</span></span></span><span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"> Name Type Size Created Modified Owner Group Perm Empty ---- ---- ---- ------- -------- ----- ----- ---- ----- . directory 4 KB 2/14/2011 2/14/2011 0 0 777 False .. directory 4 KB 2/14/2011 2/14/2011 0 0 777 False answer.txt file 37 B 2/14/2011 2/14/2011 0 0 107</span></span></span> |
|
mkdir where_did_this_come_from
As well as read the contents of any plain text files.
|
<span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong>[0:77]></strong></span> Get-Content .answer.txt wouldn't you like to know love I'm not telling </span></span></span> |
|
Finally we can remove any Files or Folders as well.
|
<span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong>[0:78]></strong></span> del .where_did_this_come_fromanswer.txt </span></span></span><span style="color: #ffffff;"><span style="font-size: x-small;"><span style="font-family: Lucida Console; font-size: x-small;"><span style="color: #ffff00;"><strong>[0:79]></strong></span> del .where_did_this_come_from</span></span></span> |
|
Now this brings incredible power to the storage administrator… Of course this really isn’t anything new. It’s all been available from the console for years, but to get these capabilities within the native tools shows NetApp’s continued resolve to deliver a first class PowerShell experience! All that said, it’s not perfect. There are some I/O hooks that are still missing. For instance there is no filtering support for Get-Content, and the exclusion of a FullName property breaks some pipeline stuff, but this is all fixable, and knowing these guys, those limitations will be removed by the next release!
Again Congratulations to the DataONTAP Development team as 1.3 is not only another solid build, but they quietly slipped in one of the most capable 3rd party providers I’ve seen to date!
~Glenn
Related