Powershell帮助系统使用

时间:2013-06-13 10:48:29

标签: powershell powershell-v3.0

我正在学习powershell,所以首先我要学习如何使用powershell的帮助系统。以下是命令“Get-EventLog”的帮助,

  1. 我们的意思是什么:位置?命名
  2. 还有任何链接可以获得有关如何使用帮助系统的更多信息 由powershell提供?

    概要         获取本地或远程计算机上的事件日志或事件日志列表中的事件。

       Syntax   Get-EventLog [-LogName] <String> [[-InstanceId] <Int64[]>] [-After <DateTime>] [-AsBaseObject <SwitchParameter>] [-Before <DateTime>] [-ComputerName <String[]>] [-EntryType <String[]>] [-Index <Int32[]>] [-Message <String>] [-Newest <Int32>] [-Source <String[]>] [-UserName <String[]>] [<CommonParameters>]
    
    Get-EventLog [-AsString <SwitchParameter>] [-ComputerName <String[]>] [-List <SwitchParameter>] [<CommonParameters>]
    
     Parameters
             -After <DateTime>
                    Gets only the events that occur after the specified date and time. Enter a DateTime object, such as the one returned by the Get-Date cmdlet.
                Required?                    false
                Position?                    named
                Default value                
                Accept pipeline input?       false
                Accept wildcard characters?  false
    
            -InstanceId <Int64[]>
                Gets only events with the specified instance IDs.
                Required?                    false
                Position?                    2
                Default value                
                Accept pipeline input?       false
    
                Accept wildcard characters?  false
    
            -LogName <String>
                Specifies the event log.  Enter the log name (the value of the Log property; not the LogDisplayName) of one event log. Wildcard characters are not permitted. This parameter is required.
                Required?                    true
                Position?                    1
                Default value                
                Accept pipeline input?       false
                Accept wildcard characters?  false
    

2 个答案:

答案 0 :(得分:3)

对于#1,您需要了解PowerShell中如何使用位置参数。您可以参考以下脚本专家文章。

http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/22/the-problem-with-powershell-positional-parameters.aspx

对于#2,在PowerShell v3中,有可更新的帮助。默认情况下,在PowerShell 3.0系统上,没有安装帮助。一切都在线。您可以使用Update-HelpSave-Help cmdlet下载帮助内容。

此外,Get-Help <cmdletname> -Online显示任何cmdlet的在线(最新)内容。

您可以使用PowerShell中的about主题来学习这些概念。可以使用help about*访问这些主题。您将看到可以使用帮助或Get-Help访问的大量主题列表。例如,

help about_Parameters

再一次,如果您使用的是PowerShell 3.0,则需要先更新帮助才能看到任何帮助内容。

答案 1 :(得分:1)

您可以先查看about_Command_Syntax

get_help about_Command_Syntax

然后看看其他几个问题,如果你想将自己的帮助添加到你的Cmd-Lets看看here