I’ve done similar things (to the titular task) in the
past, but not as a one-liner before. I like one liners!
This one liner can be used to convert the ONTAPI for a
Clustershell Command into the PowerShell cmdlet:
Function
Get-NcPS{Param([String]$I);Foreach($N in
Get-NcHelp){[System.Array]$N.Api|Foreach{If($_.count -gt 0){If($_.contains($I)){$N}}}}}
Here’s an example of it in use. I wanted to find out if
there is a Cmdlet in the DataONTAP PowerShell Toolkit that does the same as the
Clustershell “security audit log show”. Alas there is not.
cluster1::> set d
cluster1::*> show-ontapi -command
"storage aggregate show"
(security login role show-ontapi)
ONTAPI Command
---------------------------
----------------------
aggr-get-filer-info storage aggregate show
aggr-get-iter storage aggregate show
aggr-options-list-info storage aggregate show
aggr-verify-list-info storage aggregate show
cluster1::*> show-ontapi -command
"security audit log show"
(security login role show-ontapi)
ONTAPI Command
---------------------------
-----------------------
audit-log-get security audit log show
audit-log-get-iter security audit log show
PS> Import-Module DataONTAP
PS> Function
Get-NcPS{Param([String]$I);Foreach($N in
Get-NcHelp){[System.Array]$N.Api|Foreach{If($_.count -gt
0){If($_.contains($I)){$N}}}}}
PS>
PS> Get-NcPS "aggr-get-iter"
Name Category Api
---- -------- ---
Get-NcAggr aggr {aggr-get-iter}
Get-NcVolMoveTargetAggr volume {volume-move-target-aggr-get-iter}
PS> Get-NcPS "audit-log-get"
PS>
Image: Function Get-NcPS in action
Comments
Post a Comment