Knowing about Powershell cmdlets

How to check a given PS cmdlet belongs to what and where it’s located?

…here are few simple PS commands that helps you with this.

[7]: get-command invoke-item, get-date | format-table -property commandtype, name, pssnapin, module -auto

CommandType Name        PSSnapIn                        Module
———– —-        ——–                        ——
     Cmdlet Invoke-Item Microsoft.PowerShell.Management      
     Cmdlet Get-Date    Microsoft.PowerShell.Utility         

[8]:

 

List all the supported/available functions/methods and properties/attributes of a PS cmdlet:

[40]: get-command | get-member | ft Name, MemberType -auto | wc -l

64
[41]:

List all the supported/available functions/methods of a PS cmdlet:

[1]: get-command | get-member -Type method

   TypeName: System.Management.Automation.AliasInfo

Name        MemberType Definition                   
—-        ———- ———-                   
Equals      Method     bool Equals(System.Object obj)
GetHashCode Method     int GetHashCode()            
GetType     Method     type GetType()               
ToString    Method     string ToString()            

   TypeName: System.Management.Automation.FunctionInfo

Name        MemberType Definition                   
—-        ———- ———-                   
Equals      Method     bool Equals(System.Object obj)
GetHashCode Method     int GetHashCode()            
GetType     Method     type GetType()               
ToString    Method     string ToString()            

   TypeName: System.Management.Automation.CmdletInfo

Name        MemberType Definition                   
—-        ———- ———-                   
Equals      Method     bool Equals(System.Object obj)
GetHashCode Method     int GetHashCode()            
GetType     Method     type GetType()               
ToString    Method     string ToString()            

[2]:

 

List all the supported/available properties/attributes of a PS cmdlet:

[4]: get-command | get-member -Type properties | ft -auto

   TypeName: System.Management.Automation.AliasInfo

Name                MemberType     Definition                                                                                     
—-                ———-     ———-                                                                                     
CommandType         Property       System.Management.Automation.CommandTypes CommandType {get;}                                   
Definition          Property       System.String Definition {get;}                                                                
Description         Property       System.String Description {get;set;}                                  &#1
60;                        
Module              Property       System.Management.Automation.PSModuleInfo Module {get;}                                        
ModuleName          Property       System.String ModuleName {get;}                                                                
Name                Property       System.String Name {get;}                                                                      
Options             Property       System.Management.Automation.ScopedItemOptions Options {get;set;}                              
OutputType          Property       System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.PSTypeName,…
Parameters          Property       System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=ne…
ParameterSets       Property       System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.CommandPara…
ReferencedCommand   Property       System.Management.Automation.CommandInfo ReferencedCommand {get;}                              
ResolvedCommand     Property       System.Management.Automation.CommandInfo ResolvedCommand {get;}                                
Visibility          Property       System.Management.Automation.SessionStateEntryVisibility Visibility {get;set;}                 
HelpUri             ScriptProperty System.Object HelpUri {get=try…                                                              
ResolvedCommandName ScriptProperty System.Object ResolvedCommandName {get=$this.ResolvedCommand.Name;}                            

   TypeName: System.Management.Automation.FunctionInfo

Name                MemberType     Definition                                                                                     
—-                ———-     ———-                                                                                     
CmdletBinding       Property       System.Boolean CmdletBinding {get;}                                                            
CommandType         Property       System.Management.Automation.CommandTypes CommandType {get;}                                   
DefaultParameterSet Property       System.String DefaultParameterSet {get;}                                                       
Definition          Property       System.String Definition {get;}                                                                
Description         Property       System.String Description {get;set;}                                       &#16
0;                   
Module              Property       System.Management.Automation.PSModuleInfo Module {get;}                                        
ModuleName          Property       System.String ModuleName {get;}                                                                
Name                Property       System.String Name {get;}                                                                      
Options             Property       System.Management.Automation.ScopedItemOptions Options {get;set;}                              
OutputType          Property       System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.PSTypeName,…
Parameters          Property       System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=ne…
ParameterSets       Property       System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.CommandPara…
ScriptBlock         Property       System.Management.Automation.ScriptBlock ScriptBlock {get;}                                    
Visibility          Property       System.Management.Automation.SessionStateEntryVisibility Visibility {get;set;}                 
HelpUri             ScriptProperty System.Object HelpUri {get=try…                                                              

   TypeName: System.Management.Automation.CmdletInfo

Name                MemberType     Definition                                                                                     
—-                ———-     ———-                                                                                     
CommandType         Property       System.Management.Automation.CommandTypes CommandType {get;}                                   
DefaultParameterSet Property       System.String DefaultParameterSet {get;}                                                       
Definition          Property       System.String Definition {get;}                                                                
HelpFile            Property       System.String HelpFile {get;}                                                                  
ImplementingType    Property       System.Type ImplementingType {get;}                                                            
Module              Property       System.Management.Automation.PSModuleInfo Module {get;}                                        
ModuleN
ame          Property       System.String ModuleName {get;}                                                                
Name                Property       System.String Name {get;}                                                                      
Noun                Property       System.String Noun {get;}                                                                      
OutputType          Property       System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.PSTypeName,…
Parameters          Property       System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=ne…
ParameterSets       Property       System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.CommandPara…
PSSnapIn            Property       System.Management.Automation.PSSnapInInfo PSSnapIn {get;}                                      
Verb                Property       System.String Verb {get;}                                                                      
Visibility          Property       System.Management.Automation.SessionStateEntryVisibility Visibility {get;set;}                 
DLL                 ScriptProperty System.Object DLL {get=$this.ImplementingType.Assembly.Location;}                              
HelpUri             ScriptProperty System.Object HelpUri {get=try…                                                              

[5]:

 

More to come…

.

Leave a Reply

Your email address will not be published. Required fields are marked *