question

AngelaClaudio-6862 avatar image
0 Votes"
AngelaClaudio-6862 asked RichMatheisen-8856 commented

- name and - noun

What is the difference between the -Name and -noun parameters in PowerShell? Who can give me some examples? Thanks for everything

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered RichMatheisen-8856 commented

PowerShell cmdlets (and functions) have a name. For example: Get-Service

Cmdlet (and function) names are a combination of an action (i.e. a 'verb') and an object (i.e. a 'noun') which are separated by a hyphen ("-").

Verbs might be "Set", "Get", "Import", "Export", etc.
Nouns might be "Service", "ADUser", "ADGroup", "ADComputer", "NetAdapter", "CSV", etc.

Combining a Verb and a Noun would produce names (choosing just from the limited choices above) like "Import-CSV", "Get-ADUser", "Set-ADComputer", etc.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

So when I find Get-Command -Noun EvertLog, -Nounun is only referring to the fact of telling the Command to find the verb for the Eventlog Object right?

0 Votes 0 ·

No, it's asking for all the cmdlets and functions that use the noun "eventlog" regardless of the verb.

 Get-Command -Noun EventLog
    
    
 CommandType     Name                                               Version    Source
 -----------     ----                                               -------    ------
 Cmdlet          Clear-EventLog                                     3.1.0.0    Microsoft.PowerShell.Management
 Cmdlet          Get-EventLog                                       3.1.0.0    Microsoft.PowerShell.Management
 Cmdlet          Limit-EventLog                                     3.1.0.0    Microsoft.PowerShell.Management
 Cmdlet          New-EventLog                                       3.1.0.0    Microsoft.PowerShell.Management
 Cmdlet          Remove-EventLog                                    3.1.0.0    Microsoft.PowerShell.Management
 Cmdlet          Show-EventLog                                      3.1.0.0    Microsoft.PowerShell.Management
 Cmdlet          Write-EventLog                                     3.1.0.0    Microsoft.PowerShell.Management
0 Votes 0 ·