zoukankan      html  css  js  c++  java
  • 怎样才能比较方便地查看PowerShell里返回回来的对象的每个成员及它们的值呢?

    一个SharePoint 2010的People Picker无法查询到用户的问题, 抓NetMon包看, 里面根本连LDAP的query都没有发出去.

    该问题我的同事和我做了三天, 都没有解决. 最后Nick登场, 潇洒一挥, 问题解决. 技巧就是这里将要分享给大家的把某个对象的所有的field写到一个XML中, 再仔细查看, 就能看到引发问题的数据field了.

    命令举例

    image

    在结果XML中, 仔细查看ActiveDirectoryCustomFilter这个属性, 如果有什么乱七八糟的东西, 记得要通过PowerShell将之清空(即默认状态).

    image

    记得修改完web application对象之后, 要Update一下哦.

    全部命令列在这里, 供以后参考.

    PS C:\Users\administrator.VSAT> $webapp = Get-SPWebApplication http://sps2010
    PS C:\Users\administrator.VSAT> $ppickersetting = $webapp.PeoplePickerSettings
    PS C:\Users\administrator.VSAT> $ppickersetting | Export-Clixml c:\temp\ppicker.
    xml
    PS C:\Users\administrator.VSAT> $ppickersetting.ActiveDirectoryCustomFilter=""
    PS C:\Users\administrator.VSAT> $webapp.Update()
    PS C:\Users\administrator.VSAT>

    如果仅仅是想查看某对象有哪些属性和方法, 可以使用get-member命令. 举例如下:

    PS C:\Users\administrator.VSAT> $site=get-spsite http://sps2010
    PS C:\Users\administrator.VSAT> $site|get-member


       TypeName: Microsoft.SharePoint.SPSite

    Name                                  MemberType Definition
    ----                                  ---------- ----------
    AddWorkItem                           Method     System.Guid AddWorkItem(Sys...
    BypassUseRemoteApis                   Method     System.Void BypassUseRemote...
    CheckForPermissions                   Method     System.Void CheckForPermiss...
    Close                                 Method     System.Void Close()
    ConfirmUsage                          Method     bool ConfirmUsage()
    Delete                                Method     System.Void Delete(), Syste...
    Dispose                               Method     System.Void Dispose()
    DoesUserHavePermissions               Method     bool DoesUserHavePermission...
    Equals                                Method     bool Equals(System.Object obj)
    GetAllReusableAcls                    Method     System.Collections.Generic....
    ......

    GetSelfServiceSiteCreationSettings    Method     System.Void GetSelfServiceS...
    GetType                               Method     type GetType()
    GetVisualReport                       Method     System.Collections.Generic....
    GetWebTemplates                       Method     Microsoft.SharePoint.SPWebT...
    GetWorkItems                          Method     System.Void GetWorkItems(Mi...
    MakeFullUrl                           Method     string MakeFullUrl(string s...
    OpenWeb                               Method     Microsoft.SharePoint.SPWeb ...
    QueryFeatures                         Method     Microsoft.SharePoint.SPFeat...
    .........

    DeadWebNotificationCount              Property   System.Int16 DeadWebNotific...
    EventReceivers                        Property   Microsoft.SharePoint.SPEven...
    ExternalBinaryIds                     Property   Microsoft.SharePoint.SPExte...
    FeatureDefinitions                    Property   Microsoft.SharePoint.Admini...
    Features                              Property   Microsoft.SharePoint.SPFeat...
    GlobalPermMask                        Property   Microsoft.SharePoint.SPRigh...
    .........

    ResourceQuotaWarningNotificationSent  Property   System.Boolean ResourceQuot...
    RootWeb                               Property   Microsoft.SharePoint.SPWeb ...
    SearchServiceInstance                 Property   Microsoft.SharePoint.Admini...
    SecondaryContact                      Property   Microsoft.SharePoint.SPUser...
    ServerRelativeUrl                     Property   System.String ServerRelativ...
    ShowURLStructure                      Property   System.Boolean ShowURLStruc...
    SiteSubscription                      Property   Microsoft.SharePoint.SPSite...
    Solutions                             Property   Microsoft.SharePoint.SPUser...
    SyndicationEnabled                    Property   System.Boolean SyndicationE...
    ....……

    UserToken                             Property   Microsoft.SharePoint.SPUser...
    WarningNotificationSent               Property   System.Boolean WarningNotif...
    WebApplication                        Property   Microsoft.SharePoint.Admini...
    WorkflowManager                       Property   Microsoft.SharePoint.Workfl...
    WriteLocked                           Property   System.Boolean WriteLocked ...
    Zone                                  Property   Microsoft.SharePoint.Admini...


    PS C:\Users\administrator.VSAT>

    引用

    ============

    Export-Clixml

    http://technet.microsoft.com/en-us/library/dd347657.aspx

  • 相关阅读:
    _CrtSetBreakAlloc(…)来检测内存泄漏+VC使用CRT调试功能检测内存泄漏(转)
    VC 2005 解决方案的目录结构设置和管理
    ArcGIS Engine基础开发教程(转)
    vc++实现avi文件的操作 用于视频解析及录制(转)
    微软免费杀毒软件下周二公测 年底推简体中文版 狼人:
    大量用户升级iPhone3.0系统导致苹果服务器故障 狼人:
    苹果发布45个iPhone和iTouch漏洞补丁 狼人:
    “汉网热血三国”“南方电视台”等网站被挂马 狼人:
    WAPI有望晋身国际标准 最大阻力美国首度支持 狼人:
    前Google员工推云安全服务检测网站挂马 狼人:
  • 原文地址:https://www.cnblogs.com/awpatp/p/2226832.html
Copyright © 2011-2022 走看看