zoukankan      html  css  js  c++  java
  • [持续更新]一些有用的PowerShell收集

    [2012-09-05]

    可以使用下面的powershell命令来dump某web application中符合某条件的timerjob, 比如说, 下面的命令dump出端口在1007的web application的variation timer job.

    PS> (get-spwebapplication http://servername).JobDefinitions | where {$_.DisplayName -match "variation"} | select DisplayName, IsDisabled, LastRunTime, Schedule | fl

    使用下面的powershll来查看某个timer job的历史记录. 比如说, 下面的命令dump了端口在1007的web application中所有的variation timer jobs的历史记录.

    PS> (get-spwebapplication http://servername).JobHistoryEntries | where {$_.JobDefinitionTitle -match "variation"}

    下面的dump了"Variation create hierarchies job definition"的所有job history

    PS> (get-spwebapplication http://servername).JobHistoryEntries | where {$_.JobDefinitionTitle -match "Variations Create Hierarchies Job Definition"}

    使用下面的powershell来dump与某个page library相关联的所有的event receivers.

    PS> (get-spweb http://servername/en).Lists["Pages"].EventReceivers | select Type,Class | fl

    使用下面的powershell命令来dump出于某个站点相关联的所有的event receivers.

    PS> (get-spweb http://servername/en).EventReceivers | select Type,Class | fl

    使用下面的powershell命令来dump从SPFile对象中dump出二进制信息, 写到文件系统中去.

    PS> $byteArr = ((get-spweb http://server).Lists["Master Page Gallery"].Items | where{$_.Name -match "VariationRootPageLayout.aspx" }).File.OpenBinary()

    PS> [System.IO.File]::WriteAllBytes( "c:\VariationRootPageLayout.aspx", $byteArr)

    当Microsoft SharePoint Foundation Administration是disabled的状态时, 可以使用下面的脚本来启动它. 感谢Eric Zhang提供此脚本.

    $LocalServer =$null
    $LocalServer = [Microsoft.SharePoint.Administration.SPServer]::Local;
    $srvList = $LocalServer.ServiceInstances

    foreach($srv in $srvList)
    {
            $a = $srv.Service.GetType().FullName
            if ($a.Contains("Microsoft.SharePoint.Administration.SPAdministrationService"))
            {
                write-host $a ":" $srv.Status
                            $srv.Provision()
            }
    }

    资料来源

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

    SharePoint Variations – The complete Guide – Part 14 – Troubleshooting

    http://blogs.technet.com/b/stefan_gossner/archive/2011/11/30/sharepoint-variations-the-complete-guide-part-14-troubleshooting.aspx

  • 相关阅读:
    第九章 类的定义属性和方法
    第八章 函数作用域
    第七章 函数基础
    第六章 控制流程
    Http请求
    Django学习之-带参数的路由应用
    Django学习之--Ajax
    第二章:Django项目实例
    第一章:Django简介
    pytest汇总
  • 原文地址:https://www.cnblogs.com/awpatp/p/2671777.html
Copyright © 2011-2022 走看看