Finding all Get-Nc* with a -Node Switch

A little bit of code here which might be of interest. I was hoping I could search through all the Get-Nc* for certain switches to categorize them as being Cluster, Node, Vserver, ... Alas, it's not going to work because a lot of the commands use -name. Still, the below finds every Get-Nc* with a -Node switch.

# Finding Every Get-Nc* Command that has a -Node switch

#########################
## Function FindSwitch ##
#########################

Function FindSwitch {
foreach ($switch in $switches){
$nameOfSwitch = $switch.name
If($nameOfSwitch.Contains("Node")){
$getNcName
return
}
}
}

####################
### MAIN PROGRAM ###
####################

$getNcs = get-nchelp get-nc*
foreach ($getNc in $getNcs){
$getNcName = $getNc.Name
$helpContents = get-help $getNcName
$switches = $helpContents.parameters.parameter
FindSwitch
}

Comments