How to know about noun and verb in a cmdlet. If noun means where the actions and verb is action so can I know some examples
Hi Jumpav,
all function and cmdlets should adhere to the PowerShell naming convention which states a it should be named thus:
<Verb>-<Noun>
For Example:
Get-Help
Get-ADUser
Remove-Item
The Verb should strictly define the action taken. For example, a "Get-" function should not change anything (as the verb implies reading only).
You can get a list of "official" verbs by using the Get-Verb cmdlet.
Cheers,
Fred
Also you can use Get-Help cmdlet for find that you need
Using
Get-Help Get*
(gel all cmdlets with verb "Get")
or
Get-Help *AD*
(get cmdlets where name contains "AD")
or
Get-Help *(get all cmdlets)
Hi Jumpav,
all function and cmdlets should adhere to the PowerShell naming convention which states a it should be named thus:
<Verb>-<Noun>
For Example:
Get-Help
Get-ADUser
Remove-Item
Sorry, but this is not strictly true.
The format <Verb>-<Noun> is too important to be wasted in all functions.
For instance:
function Find-FilesVBS{ param([parameter(mandatory)][string]$Folder) dir $Folder *vbs -Recurse -File }
The advanced function above, should never follow the format <Verb>-<Noun>.
It's not possible to use it like this: 'c:\someFolder' | Find-FilesVBS -Folder {$_}
Another example:
function Find-AllVBS{ param([string]$Folder) dir $Folder *vbs -Recurse -File }
The standard function above, should never follow the format <Verb>-<Noun>.
It's not possible to use it like this: 'c:\someFolder' | Find-AllVBS -Folder {$_}
From the pipeline perspective, those 2 functions are defective: they can't be used directly in a pipeline (they need the "help" of a cmdlet or advanced function).
Thus, they should be named, more appropriately findFilesVBS and findAllVBS, respectively, which are names perfectly structured according to and accepted by PowerShell (without any warning).
Ey Jumpav
An otherway to get a idea of what These convetions with noun and verbs are. simply open up a powershell on your machine and fire this one
Get-Command | select noun, verb | Out-GridView
Now you can sort all the nouns and verbs. This will give you a Basic understanding of how CmdLets and FunctionNames are working. Also Powershell was designed to guessing. So ones you understand the Basic caracteristics of how those cmdlet names are constructed so could simply guess.
So for instance, last week I ran accross a System and wanted to know how many NICs are available. So I tought, maybe there are a cmdlet witch does this for me.
So I did
Get-Command Get*Net*
Voila there was an cmdlet called., Get-NetAdapeter so I went straight ahead with this.
At last you could do the following
Get-Verb | Out-GridView
So now you have all the verbs and their Group. This will give you further understanding of what this verbs are used for.
cheers