1

我正在学习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
    
4

2 回答 2

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-Help您可以使用和Save-Helpcmdlet下载帮助内容。

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

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

help about_Parameters

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

于 2013-06-13T11:04:16.387 回答
1

你可以先看看about_Command_Syntax

get_help about_Command_Syntax

然后看看其他一些关于,如果你想在你的 Cmd 中添加你自己的帮助,让我们看看这里

于 2013-06-13T11:07:34.523 回答