简体   繁体   中英

Get full name of a method in PowerShell?

When reading up on how to do specific tasks, I come across things like this:

$acl = get-acl somedirectory
$acl.access

How do you find the full name of the "access" method?

不确定这是否是您想要的。

$acl | get-member

Below should do your work

F:\Temp> get-acl | gm
TypeName: System.Security.AccessControl.DirectorySecurity

Name                       MemberType     Definition
----                       ----------     ----------
Access                     CodeProperty   System.Security.AccessControl.AuthorizationRuleCollection Access{get=GetAccess;}
CentralAccessPolicyId      CodeProperty   System.Security.Principal.SecurityIdentifier CentralAccessPolicyId{get=GetCentralAccessPolicyId;}

To get just the type, I prefer:

$acl.GetType().FullName

Because objects that have a ton of methods tend to scroll the screen if you just pipe it to Get-Member . Then a web search for the full type name will get you the .Net reference for the class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM