다음을 통해 공유


2장 - 도움말 시스템

PowerShell의 숙련도를 평가하기 위해 고안된 실험에서 초급자와 전문가라는 두 가지 IT 전문가 그룹이 먼저 컴퓨터에 액세스하지 않고 서면 검사를 받았습니다. 놀랍게도, 테스트 점수는 두 그룹 모두에서 비슷한 기술을 나타냈습니다. 그런 다음 후속 테스트를 관리하여 첫 번째 테스트를 미러링했지만 한 가지 주요 차이점이 있습니다. 참가자는 PowerShell이 장착된 오프라인 컴퓨터에 액세스할 수 있었습니다. 결과는 이번에는 두 그룹 사이에 상당한 기술 격차를 보였습니다.

두 평가 간에 관찰된 결과에 기여한 요인은 무엇인가요?

전문가들은 항상 답을 알지는 못하지만 답을 파악하는 방법을 알고 있습니다.

두 테스트의 결과에서 관찰된 결과는 전문가가 수천 개의 PowerShell 명령을 기억하지 않기 때문입니다. 대신 PowerShell 내에서 도움말 시스템을 사용하여 필요한 경우 명령을 검색하고 사용하는 방법을 배울 수 있습니다.

PowerShell을 통해 도움말 시스템에 능숙해지는 것이 성공의 열쇠입니다.

PowerShell의 제작자인 제프리 스노버(Jeffrey Snover)가 여러 차례 비슷한 이야기를 나누는 것을 들었습니다.

검색 가능성

PowerShell에서 컴파일된 명령을 cmdlet이라고 하며 , "CMD-let"이 아닌 "command-let"으로 발음됩니다. cmdlet에 대한 명명 규칙은 쉽게 검색할 수 있도록 단수 동사-명사 형식을 따릅니다. 예를 들어 Get-Process 실행 중인 프로세스를 결정하는 cmdlet이며 Get-Service 서비스 목록을 검색하는 cmdlet입니다. 스크립트 cmdlet이라고도 하는 함수 및 별칭은 이 책의 뒷부분에서 설명하는 다른 유형의 PowerShell 명령입니다. "PowerShell 명령"이라는 용어는 cmdlet, 함수 또는 별칭에 관계없이 PowerShell의 모든 명령을 설명합니다.

PowerShell에서 운영 체제 네이티브 명령(예: 기존 명령줄 프로그램 등)을 실행할 수도 있습니다 ping.exeipconfig.exe.

PowerShell의 세 가지 핵심 cmdlet

  • Get-Help
  • Get-Command
  • Get-Member(3장에서 설명)

"PowerShell에서 명령이 무엇인지 어떻게 파악합니까?"라는 질문을 자주 받았습니다. Get-Command 둘 다 Get-Help PowerShell에서 명령을 검색하고 이해하기 위한 매우 귀중한 리소스입니다.

Get-Help

PowerShell의 도움말 시스템에 대해 가장 먼저 알아야 할 것은 cmdlet을 사용하는 Get-Help 방법입니다.

Get-Help 는 명령을 찾은 후 사용하는 방법을 배우는 데 도움이 되는 다목적 명령입니다. 명령을 찾는 데도 사용할 Get-Help 수 있지만 비교했을 때는 다른 간접적인 방식으로도 찾을 수 Get-Command있습니다.

명령을 찾는 데 사용하는 Get-Help 경우 처음에는 입력에 따라 명령 이름에 대한 와일드카드 검색을 수행합니다. 일치하는 항목을 찾을 수 없는 경우 시스템의 모든 PowerShell 도움말 문서에서 포괄적인 전체 텍스트 검색을 수행합니다. 결과도 찾지 못하면 오류가 반환됩니다.

cmdlet에 대한 Get-Help 도움말 콘텐츠를 보는 데 사용하는 Get-Help 방법은 다음과 같습니다.

Get-Help -Name Get-Help

PowerShell 버전 3.0부터 도움말 콘텐츠는 운영 체제와 함께 미리 설치되지 않습니다. 처음으로 실행 Get-Help 하면 PowerShell 도움말 파일을 컴퓨터에 다운로드할지 묻는 메시지가 표시됩니다.

Y 키를 눌러 라고 대답하면 cmdlet이 Update-Help 실행되어 도움말 콘텐츠가 다운로드됩니다.

Do you want to run Update-Help?
The Update-Help cmdlet downloads the most current Help files for Windows
PowerShell modules, and installs them on your computer. For more information
about the Update-Help cmdlet, see
https:/go.microsoft.com/fwlink/?LinkId=210614.
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

이 메시지를 받지 못하면 관리자 권한으로 실행되는 관리자 권한 PowerShell 세션에서 실행 Update-Help 합니다.

업데이트가 완료되면 도움말 문서가 표시됩니다.

잠시 시간을 내어 컴퓨터에서 예제를 실행하고, 출력을 검토하고, 도움말 시스템에서 정보를 구성하는 방법을 확인합니다.

  • 이름
  • 개요
  • 통사론
  • 설명
  • 관련 링크
  • REMARKS

출력을 검토할 때 도움말 문서에는 방대한 양의 정보가 포함되어 있는 경우가 많으며 기본적으로 표시되는 내용이 전체 도움말 문서가 아니라는 점을 명심하세요.

매개 변수

PowerShell에서 명령을 실행할 때 명령에 추가 정보 또는 입력을 제공해야 할 수 있습니다. 매개 변수를 사용하면 명령의 동작을 변경하는 옵션 및 인수를 지정할 수 있습니다. 각 도움말 문서의 구문 섹션에서는 명령에 사용할 수 있는 매개 변수를 간략하게 설명합니다.

Get-Help 에는 명령의 전체 도움말 문서 또는 하위 집합을 반환하도록 지정할 수 있는 여러 매개 변수가 있습니다. 사용 가능한 모든 매개 변수를 Get-Help보려면 다음 예제와 같이 도움말 문서의 SYNTAX 섹션을 참조하세요.

...
SYNTAX
    Get-Help [[-Name] <System.String>] [-Category {Alias | Cmdlet | Provider
    | General | FAQ | Glossary | HelpFile | ScriptCommand | Function |
    Filter | ExternalScript | All | DefaultHelp | Workflow | DscResource |
    Class | Configuration}] [-Component <System.String[]>] [-Full]
    [-Functionality <System.String[]>] [-Path <System.String>] [-Role
    <System.String[]>] [<CommonParameters>]

    Get-Help [[-Name] <System.String>] [-Category {Alias | Cmdlet | Provider
    | General | FAQ | Glossary | HelpFile | ScriptCommand | Function |
    Filter | ExternalScript | All | DefaultHelp | Workflow | DscResource |
    Class | Configuration}] [-Component <System.String[]>] -Detailed
    [-Functionality <System.String[]>] [-Path <System.String>] [-Role
    <System.String[]>] [<CommonParameters>]

    Get-Help [[-Name] <System.String>] [-Category {Alias | Cmdlet | Provider
    | General | FAQ | Glossary | HelpFile | ScriptCommand | Function |
    Filter | ExternalScript | All | DefaultHelp | Workflow | DscResource |
    Class | Configuration}] [-Component <System.String[]>] -Examples
    [-Functionality <System.String[]>] [-Path <System.String>] [-Role
    <System.String[]>] [<CommonParameters>]

    Get-Help [[-Name] <System.String>] [-Category {Alias | Cmdlet | Provider
    | General | FAQ | Glossary | HelpFile | ScriptCommand | Function |
    Filter | ExternalScript | All | DefaultHelp | Workflow | DscResource |
    Class | Configuration}] [-Component <System.String[]>] [-Functionality
    <System.String[]>] -Online [-Path <System.String>] [-Role
    <System.String[]>] [<CommonParameters>]

    Get-Help [[-Name] <System.String>] [-Category {Alias | Cmdlet | Provider
    | General | FAQ | Glossary | HelpFile | ScriptCommand | Function |
    Filter | ExternalScript | All | DefaultHelp | Workflow | DscResource |
    Class | Configuration}] [-Component <System.String[]>] [-Functionality
    <System.String[]>] -Parameter <System.String> [-Path <System.String>]
    [-Role <System.String[]>] [<CommonParameters>]

    Get-Help [[-Name] <System.String>] [-Category {Alias | Cmdlet | Provider
    | General | FAQ | Glossary | HelpFile | ScriptCommand | Function |
    Filter | ExternalScript | All | DefaultHelp | Workflow | DscResource |
    Class | Configuration}] [-Component <System.String[]>] [-Functionality
    <System.String[]>] [-Path <System.String>] [-Role <System.String[]>]
    -ShowWindow [<CommonParameters>]
...

매개 변수 집합

SYNTAX 섹션을 Get-Help검토하면 정보가 6번 반복되는 것처럼 보입니다. 이러한 각 블록은 개별 매개 변수 집합으로, cmdlet에 Get-Help 6개의 고유한 매개 변수 집합이 있음을 나타냅니다. 자세히 살펴보면 각 매개 변수 집합에 하나 이상의 고유 매개 변수가 포함되어 다른 매개 변수와 다르게 표시됩니다.

매개 변수 집합은 상호 배타적입니다. 하나의 매개 변수 집합에만 존재하는 고유 매개 변수를 지정하면 PowerShell은 해당 매개 변수 집합에 포함된 매개 변수를 사용하도록 제한합니다. 예를 들어 서로 다른 매개 변수 집합에 속하기 때문에 전체상세 매개 변수 Get-Help 를 함께 사용할 수 없습니다.

다음 매개 변수 각각은 cmdlet에 대해 설정된 다른 매개 변수에 Get-Help 속합니다.

  • 전체
  • 자세히
  • 예제
  • 온라인
  • 매개 변수
  • ShowWindow

명령 구문

PowerShell을 접하는 경우 SYNTAX 섹션에서 대괄호 및 꺾쇠 괄호로 특징지어지는 비밀 정보를 이해하는 것이 어려울 수 있습니다. 그러나 이러한 구문 요소를 학습하는 것은 PowerShell을 능숙하게 하는 데 필수적입니다. PowerShell 도움말 시스템을 자주 사용할수록 모든 뉘앙스를 더 쉽게 기억할 수 있습니다.

cmdlet의 구문을 Get-EventLog 봅니다.

Get-Help Get-EventLog

다음 출력은 도움말 문서의 관련 부분을 보여줍니다.

...
SYNTAX
    Get-EventLog [-LogName] <System.String> [[-InstanceId]
    <System.Int64[]>] [-After <System.DateTime>] [-AsBaseObject] [-Before
    <System.DateTime>] [-ComputerName <System.String[]>] [-EntryType {Error
    | Information | FailureAudit | SuccessAudit | Warning}] [-Index
    <System.Int32[]>] [-Message <System.String>] [-Newest <System.Int32>]
    [-Source <System.String[]>] [-UserName <System.String[]>]
    [<CommonParameters>]

    Get-EventLog [-AsString] [-ComputerName <System.String[]>] [-List]
    [<CommonParameters>]
...

구문 정보에는 대괄호 쌍([])이 포함됩니다. 사용량에 따라 이러한 대괄호는 서로 다른 두 가지 용도로 사용됩니다.

  • 대괄호로 묶인 요소는 선택 사항입니다.
  • 데이터 형식 <string[]>다음에 있는 대괄호의 빈 집합은 매개 변수가 배열 또는 컬렉션 개체로 전달된 여러 값을 허용할 수 있음을 나타냅니다.

위치 매개 변수

일부 cmdlet은 위치 매개 변수를 허용하도록 설계되었습니다. 위치 매개 변수를 사용하면 매개 변수의 이름을 지정하지 않고 값을 제공할 수 있습니다. 매개 변수를 위치적으로 사용하는 경우 명령줄의 올바른 위치에 해당 값을 지정해야 합니다. 명령 도움말 문서의 PARAMETERS 섹션에서 매개 변수에 대한 위치 정보를 찾을 수 있습니다. 매개 변수 이름을 명시적으로 지정하는 경우 임의의 순서로 매개 변수를 사용할 수 있습니다.

cmdlet의 Get-EventLog 경우 첫 번째 매개 변수 집합의 첫 번째 매개 변수는 LogName입니다. LogName 은 위치 매개 변수임을 나타내는 대괄호로 묶입니다.

Get-EventLog [-LogName] <System.String>

LogName은 위치 매개 변수이므로 이름 또는 위치로 지정할 수 있습니다. 매개 변수 이름 다음에 있는 꺾쇠 괄호에 따라 LogName은 단일 문자열이어야 합니다. 매개 변수 이름과 데이터 형식을 모두 묶는 대괄호가 없는 경우 LogName이 이 특정 매개 변수 집합 내에서 필수 매개 변수임을 나타냅니다.

해당 매개 변수 집합의 두 번째 매개 변수는 InstanceId입니다. 매개 변수 이름과 데이터 형식은 모두 대괄호로 묶어 InstanceId가 선택적 매개 변수임을 나타냅니다.

[[-InstanceId] <System.Int64[]>]

또한 InstanceId에는 LogName 매개 변수와 유사한 위치 매개 변수임을 나타내는 고유한 대괄호 쌍이 있습니다. 데이터 형식에 따라 빈 대괄호 집합은 InstanceId가 여러 값을 수락할 수 있음을 의미합니다.

Switch 매개 변수

값을 요구하지 않는 매개 변수를 스위치 매개 변수라고 합니다. 매개 변수 이름 다음에 데이터 형식이 없으므로 스위치 매개 변수를 쉽게 식별할 수 있습니다. switch 매개 변수를 지정하면 해당 값은 .입니다 true. switch 매개 변수를 지정하지 않으면 해당 값은 .입니다 false.

두 번째 매개 변수 집합에는 Switch 매개 변수인 List 매개 변수가 포함됩니다. List 매개 변수를 지정하면 로컬 컴퓨터의 이벤트 로그 목록이 반환됩니다.

[-List]

구문에 대한 간소화된 접근 방식

일반 영어를 제외하고 일부 명령에 대한 비밀 명령 구문과 동일한 정보를 가져오는 보다 사용자에게 친숙한 방법이 있습니다. PowerShell은 전체 매개 변수와 함께 사용할 Get-Help 때 전체 도움말 문서를 반환하므로 명령의 사용량을 더 쉽게 이해할 수 있습니다.

Get-Help -Name Get-Help -Full

잠시 시간을 내어 컴퓨터에서 예제를 실행하고, 출력을 검토하고, 도움말 시스템에서 정보를 구성하는 방법을 확인합니다.

  • 이름
  • 개요
  • 통사론
  • 설명
  • PARAMETERS
  • 입력
  • 출력
  • 메모장
  • 예제
  • 관련 링크

cmdlet을 사용하여 Full 매개 변수를 Get-Help 지정하면 출력에 몇 가지 추가 섹션이 포함됩니다. 이러한 섹션 중 PARAMETERS 는 종종 각 매개 변수에 대한 자세한 설명을 제공합니다. 그러나 이 정보의 범위는 조사 중인 특정 명령에 따라 달라집니다.

...
    -Detailed <System.Management.Automation.SwitchParameter>
        Adds parameter descriptions and examples to the basic help display.
        This parameter is effective only when the help files are installed
        on the computer. It has no effect on displays of conceptual ( About_
        ) help.

        Required?                    true
        Position?                    named
        Default value                False
        Accept pipeline input?       False
        Accept wildcard characters?  false

    -Examples <System.Management.Automation.SwitchParameter>
        Displays only the name, synopsis, and examples. This parameter is
        effective only when the help files are installed on the computer. It
        has no effect on displays of conceptual ( About_ ) help.

        Required?                    true
        Position?                    named
        Default value                False
        Accept pipeline input?       False
        Accept wildcard characters?  false

    -Full <System.Management.Automation.SwitchParameter>
        Displays the entire help article for a cmdlet. Full includes
        parameter descriptions and attributes, examples, input and output
        object types, and additional notes.

        This parameter is effective only when the help files are installed
        on the computer. It has no effect on displays of conceptual ( About_
        ) help.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       False
        Accept wildcard characters?  false
...

이전 명령을 실행하여 명령에 대한 Get-Help 도움말을 표시했을 때 출력이 너무 빨리 스크롤되어 읽을 수 없는 것으로 나타났습니다.

PowerShell 콘솔, Windows 터미널 또는 VS Code를 사용하고 도움말 문서를 확인해야 하는 경우 이 함수가 help 유용할 수 있습니다. 출력을 Get-Help 파이프하여 more.com한 번에 한 페이지의 도움말 콘텐츠를 표시합니다. 더 나은 사용자 환경을 제공하고 형식이 Get-Help 적기 때문에 cmdlet 대신 함수를 사용하는 help 것이 좋습니다.

참고 항목

ISE는 사용을 more.com지원하지 않으므로 실행 help 은 .와 Get-Help동일한 방식으로 작동합니다.

컴퓨터의 PowerShell에서 다음 명령을 각각 실행합니다.

Get-Help -Name Get-Help -Full
help -Name Get-Help -Full
help Get-Help -Full

이전 명령을 실행할 때 출력의 변형을 관찰했나요?

이전 예제에서 첫 번째 줄은 cmdlet을 Get-Help 사용하고, 두 번째 줄은 함수를 help 사용하고, 세 번째 줄은 함수를 사용하는 동안 Name 매개 변수를 help 생략합니다. Name은 위치 매개 변수이므로 세 번째 예제에서는 매개 변수의 이름을 명시적으로 나타내는 대신 해당 위치를 활용합니다.

차이점은 마지막 두 명령이 출력을 한 번에 한 페이지씩 표시한다는 것입니다. 함수를 help 사용하는 경우 스페이스바눌러 콘텐츠의 다음 페이지를 표시하거나 종료할 Q를 표시합니다. PowerShell에서 대화형으로 실행되는 명령을 종료해야 하는 경우 Ctrl C+누릅니다.

특정 매개 변수에 대한 정보를 빠르게 찾으려면 매개 변수 매개 변수를 사용합니다. 이 방법은 전체 도움말 문서가 아닌 매개 변수 관련 정보만 포함하는 콘텐츠를 반환합니다. 이 방법은 특정 매개 변수에 대한 정보를 찾는 가장 쉬운 방법입니다.

다음 예제에서는 매개 변수 매개 변수와 함께 함수를 사용하여 help Name 매개 변수Get-Help에 대한 도움말 문서의 정보를 반환합니다.

help Get-Help -Parameter Name

도움말 정보는 Name 매개 변수가 위치이며 위치 지정 시 첫 번째 위치(위치 0)에 지정되어야 임을 보여 줍니다.

-Name <System.String>
    Gets help about the specified command or concept. Enter the name of a
    cmdlet, function, provider, script, or workflow, such as `Get-Member`,
    a conceptual article name, such as `about_Objects`, or an alias, such
    as `ls`. Wildcard characters are permitted in cmdlet and provider
    names, but you can't use wildcard characters to find the names of
    function help and script help articles.

    To get help for a script that isn't located in a path that's listed in
    the `$env:Path` environment variable, type the script's path and file
    name.

    If you enter the exact name of a help article, `Get-Help` displays the
    article contents.

    If you enter a word or word pattern that appears in several help
    article titles, `Get-Help` displays a list of the matching titles.

    If you enter any text that doesn't match any help article titles,
    `Get-Help` displays a list of articles that include that text in their
    contents.

    The names of conceptual articles, such as `about_Objects`, must be
    entered in English, even in non-English versions of PowerShell.

    Required?                    false
    Position?                    0
    Default value                None
    Accept pipeline input?       True (ByPropertyName)
    Accept wildcard characters?  true

Name 매개 변수에는 매개 변수 이름 옆에 있는 데이터 형식으로 <String> 식별되는 문자열 값이 필요합니다.

도움말 문서의 하위 집합을 반환하기 위해 지정할 Get-Help 수 있는 몇 가지 다른 매개 변수가 있습니다. 작동 방식을 확인하려면 컴퓨터에서 다음 명령을 실행합니다.

Get-Help -Name Get-Command -Full
Get-Help -Name Get-Command -Detailed
Get-Help -Name Get-Command -Examples
Get-Help -Name Get-Command -Online
Get-Help -Name Get-Command -Parameter Noun
Get-Help -Name Get-Command -ShowWindow

일반적으로 전체 또는 온라인 매개 변수와 함께 사용합니다help <command name>. 예제에만 관심이 있는 경우 Examples 매개 변수를 사용합니다. 특정 매개 변수에만 관심이 있는 경우 Parameter 매개 변수를 사용합니다.

ShowWindow 매개 변수를 사용하면 도움말 콘텐츠가 별도의 검색 가능한 창에 표시됩니다. 모니터가 여러 개 있는 경우 해당 창을 다른 모니터로 이동할 수 있습니다. 그러나 ShowWindow 매개 변수에는 전체 도움말 문서를 표시하지 못할 수 있는 알려진 버그가 있습니다. ShowWindow 매개 변수에는 GUI(그래픽 사용자 인터페이스)가 있는 운영 체제도 필요합니다. Windows Server Core에서 사용하려고 하면 오류가 반환됩니다.

인터넷에 액세스할 수 있는 경우 Online 매개 변수를 대신 사용할 수 있습니다. Online 매개 변수는 기본 웹 브라우저에서 도움말 문서를 엽니다. 온라인 콘텐츠는 최신 콘텐츠입니다. 브라우저를 사용하면 도움말 콘텐츠를 검색하고 다른 관련 도움말 문서를 볼 수 있습니다.

참고 항목

온라인 매개 변수는 정보 문서에 대해 지원되지 않습니다.

help Get-Command -Online

Get-Help를 사용하여 명령 찾기

명령을 찾으려면 Name 매개 변수 값에 대한 별표(*) 와일드카드 문자로 둘러싸인 검색어를 지정합니다Get-Help. 다음 예제에서는 Name 매개 변수를 위치적으로 사용합니다.

help *process*
Name                              Category  Module                    Synops
----                              --------  ------                    ------
Enter-PSHostProcess               Cmdlet    Microsoft.PowerShell.Core Con...
Exit-PSHostProcess                Cmdlet    Microsoft.PowerShell.Core Clo...
Get-PSHostProcessInfo             Cmdlet    Microsoft.PowerShell.Core Get...
Debug-Process                     Cmdlet    Microsoft.PowerShell.M... Deb...
Get-Process                       Cmdlet    Microsoft.PowerShell.M... Get...
Start-Process                     Cmdlet    Microsoft.PowerShell.M... Sta...
Stop-Process                      Cmdlet    Microsoft.PowerShell.M... Sto...
Wait-Process                      Cmdlet    Microsoft.PowerShell.M... Wai...
Invoke-LapsPolicyProcessing       Cmdlet    LAPS                      Inv...
ConvertTo-ProcessMitigationPolicy Cmdlet    ProcessMitigations        Con...
Get-ProcessMitigation             Cmdlet    ProcessMitigations        Get...
Set-ProcessMitigation             Cmdlet    ProcessMitigations        Set...

이 시나리오에서는 와일드카드 문자를 추가할 * 필요가 없습니다. 제공한 값과 일치하는 명령을 찾을 수 없는 경우 Get-Help 해당 값에 대한 전체 텍스트 검색을 수행합니다. 다음 예제에서는 각 끝에 와일드카드 문자를 지정하는 것과 * 동일한 결과를 생성합니다 process.

help process

Get-Help 내에서 와일드카드 문자를 지정하는 경우 제공한 패턴과 일치하는 명령만 검색합니다. 전체 텍스트 검색을 수행하지 않습니다. 다음 명령은 결과를 반환하지 않습니다.

help pr*cess

PowerShell은 대시를 매개 변수 이름으로 해석하기 때문에 대시를 따옴표로 묶지 않고 대시로 시작하는 값을 지정하면 오류를 생성합니다. cmdlet에 대해 Get-Help 이러한 매개 변수 이름이 없습니다.

help -process

끝으로 끝나는 -process명령을 검색하려는 경우 값의 시작 부분에 추가 * 해야 합니다.

help *-process

PowerShell 명령을 Get-Help검색할 때 너무 구체적이기보다는 모호하게 하는 것이 좋습니다.

이전에 검색한 결과 이름에 process 포함된 process 명령만 반환되었습니다. 그러나 검색하는 경우 명령 이름에 processes대한 일치 항목을 찾을 수 없습니다. 앞에서 설명한 것처럼 도움말에서 일치하는 항목을 찾지 못하면 시스템의 모든 도움말 문서에 대한 포괄적인 전체 텍스트 검색을 수행하고 해당 결과를 반환합니다. 이러한 유형의 검색은 사용자와 관련이 없는 정보를 포함하여 예상보다 많은 결과를 생성하는 경우가 많습니다.

help processes
Name                              Category  Module                    Synops
----                              --------  ------                    ------
Disconnect-PSSession              Cmdlet    Microsoft.PowerShell.Core Dis...
Enter-PSHostProcess               Cmdlet    Microsoft.PowerShell.Core Con...
ForEach-Object                    Cmdlet    Microsoft.PowerShell.Core Per...
Get-PSHostProcessInfo             Cmdlet    Microsoft.PowerShell.Core Get...
Get-PSSessionConfiguration        Cmdlet    Microsoft.PowerShell.Core Get...
New-PSSessionOption               Cmdlet    Microsoft.PowerShell.Core Cre...
New-PSTransportOption             Cmdlet    Microsoft.PowerShell.Core Cre...
Out-Host                          Cmdlet    Microsoft.PowerShell.Core Sen...
Start-Job                         Cmdlet    Microsoft.PowerShell.Core Sta...
Where-Object                      Cmdlet    Microsoft.PowerShell.Core Sel...
Debug-Process                     Cmdlet    Microsoft.PowerShell.M... Deb...
Get-Process                       Cmdlet    Microsoft.PowerShell.M... Get...
Get-WmiObject                     Cmdlet    Microsoft.PowerShell.M... Get...
Start-Process                     Cmdlet    Microsoft.PowerShell.M... Sta...
Stop-Process                      Cmdlet    Microsoft.PowerShell.M... Sto...
Wait-Process                      Cmdlet    Microsoft.PowerShell.M... Wai...
Clear-Variable                    Cmdlet    Microsoft.PowerShell.U... Del...
Convert-String                    Cmdlet    Microsoft.PowerShell.U... For...
ConvertFrom-Csv                   Cmdlet    Microsoft.PowerShell.U... Con...
ConvertFrom-Json                  Cmdlet    Microsoft.PowerShell.U... Con...
ConvertTo-Html                    Cmdlet    Microsoft.PowerShell.U... Con...
ConvertTo-Xml                     Cmdlet    Microsoft.PowerShell.U... Cre...
Debug-Runspace                    Cmdlet    Microsoft.PowerShell.U... Sta...
Export-Csv                        Cmdlet    Microsoft.PowerShell.U... Con...
Export-FormatData                 Cmdlet    Microsoft.PowerShell.U... Sav...
Format-List                       Cmdlet    Microsoft.PowerShell.U... For...
Format-Table                      Cmdlet    Microsoft.PowerShell.U... For...
Get-Unique                        Cmdlet    Microsoft.PowerShell.U... Ret...
Group-Object                      Cmdlet    Microsoft.PowerShell.U... Gro...
Import-Clixml                     Cmdlet    Microsoft.PowerShell.U... Imp...
Import-Csv                        Cmdlet    Microsoft.PowerShell.U... Cre...
Measure-Object                    Cmdlet    Microsoft.PowerShell.U... Cal...
Out-File                          Cmdlet    Microsoft.PowerShell.U... Sen...
Out-GridView                      Cmdlet    Microsoft.PowerShell.U... Sen...
Select-Object                     Cmdlet    Microsoft.PowerShell.U... Sel...
Set-Variable                      Cmdlet    Microsoft.PowerShell.U... Set...
Sort-Object                       Cmdlet    Microsoft.PowerShell.U... Sor...
Tee-Object                        Cmdlet    Microsoft.PowerShell.U... Sav...
Trace-Command                     Cmdlet    Microsoft.PowerShell.U... Con...
Write-Information                 Cmdlet    Microsoft.PowerShell.U... Spe...
Export-BinaryMiLog                Cmdlet    CimCmdlets                Cre...
Get-CimAssociatedInstance         Cmdlet    CimCmdlets                Ret...
Get-CimInstance                   Cmdlet    CimCmdlets                Get...
Import-BinaryMiLog                Cmdlet    CimCmdlets                Use...
Invoke-CimMethod                  Cmdlet    CimCmdlets                Inv...
New-CimInstance                   Cmdlet    CimCmdlets                Cre...
Remove-CimInstance                Cmdlet    CimCmdlets                Rem...
Set-CimInstance                   Cmdlet    CimCmdlets                Mod...
Compress-Archive                  Function  Microsoft.PowerShell.A... Cre...
Get-Counter                       Cmdlet    Microsoft.PowerShell.D... Get...
Invoke-WSManAction                Cmdlet    Microsoft.WSMan.Manage... Inv...
Remove-WSManInstance              Cmdlet    Microsoft.WSMan.Manage... Del...
Get-WSManInstance                 Cmdlet    Microsoft.WSMan.Manage... Dis...
New-WSManInstance                 Cmdlet    Microsoft.WSMan.Manage... Cre...
Set-WSManInstance                 Cmdlet    Microsoft.WSMan.Manage... Mod...
about_Arithmetic_Operators        HelpFile
about_Arrays                      HelpFile
about_Environment_Variables       HelpFile
about_Execution_Policies          HelpFile
about_Functions                   HelpFile
about_Jobs                        HelpFile
about_Logging                     HelpFile
about_Methods                     HelpFile
about_Objects                     HelpFile
about_Pipelines                   HelpFile
about_Preference_Variables        HelpFile
about_Remote                      HelpFile
about_Remote_Jobs                 HelpFile
about_Session_Configuration_Files HelpFile
about_Simplified_Syntax           HelpFile
about_Switch                      HelpFile
about_Variables                   HelpFile
about_Variable_Provider           HelpFile
about_Windows_Powershell_5.1      HelpFile
about_WQL                         HelpFile
about_WS-Management_Cmdlets       HelpFile
about_Foreach-Parallel            HelpFile
about_Parallel                    HelpFile
about_Sequence                    HelpFile

검색하면 process12개의 결과가 반환되었습니다. 그러나 검색할 processes때 78개의 결과가 생성되었습니다. 검색에서 일치하는 Get-Help 항목이 하나만 발견되면 검색 결과를 나열하는 대신 도움말 콘텐츠를 표시합니다.

help *hotfix*
NAME
    Get-HotFix

SYNOPSIS
    Gets the hotfixes that are installed on local or remote computers.


SYNTAX
    Get-HotFix [-ComputerName <System.String[]>] [-Credential
    <System.Management.Automation.PSCredential>] [-Description
    <System.String[]>] [<CommonParameters>]

    Get-HotFix [[-Id] <System.String[]>] [-ComputerName <System.String[]>]
    [-Credential <System.Management.Automation.PSCredential>]
    [<CommonParameters>]


DESCRIPTION
    > This cmdlet is only available on the Windows platform. The
    `Get-Hotfix` cmdlet uses the Win32_QuickFixEngineering WMI class to
    list hotfixes that are installed on the local computer or specified
    remote computers.


RELATED LINKS
    Online Version: https://learn.microsoft.com/powershell/module/microsoft.
    powershell.management/get-hotfix?view=powershell-5.1&WT.mc_id=ps-gethelp
    about_Arrays
    Add-Content
    Get-ComputerRestorePoint
    Get-Credential
    Win32_QuickFixEngineering class

REMARKS
    To see the examples, type: "get-help Get-HotFix -examples".
    For more information, type: "get-help Get-HotFix -detailed".
    For technical information, type: "get-help Get-HotFix -full".
    For online help, type: "get-help Get-HotFix -online"

이 기능은 일반적으로 알려지지는 않지만 도움말 문서가 Get-Help없는 명령을 찾을 수도 있습니다. 이 more 함수는 도움말 문서가 없는 명령 중 하나입니다. 도움말 문서가 포함되지 않은 명령을 Get-Help 찾을 수 있는지 확인하려면 함수를 help 사용하여 찾 more습니다.

help *more*

검색에서 일치하는 항목이 하나만 발견되었으므로 명령에 도움말 문서가 없을 때 표시되는 기본 구문 정보를 반환했습니다.

NAME
    more

SYNTAX
    more [[-paths] <string[]>]

ALIASES
    None

REMARKS
    None

PowerShell 도움말 시스템에는 개념 정보 도움말 문서도 포함되어 있습니다. 정보 문서를 얻으려면 시스템의 도움말 콘텐츠를 업데이트해야 합니다. 자세한 내용은 이 장의 업데이트 도움말 섹션을 참조하세요.

다음 명령을 사용하여 시스템의 모든 정보 도움말 문서 목록을 반환합니다.

help About_*

결과를 정보 도움말 문서 Get-Help제한하면 해당 문서의 내용이 표시됩니다.

help about_Updatable_Help

도움말 업데이트

이 장 앞부분에서는 cmdlet을 처음 실행할 Get-Help 때 컴퓨터의 PowerShell 도움말 문서를 업데이트했습니다. 도움말 콘텐츠에 대한 업데이트를 받으려면 컴퓨터에서 Update-Help cmdlet을 주기적으로 실행해야 합니다.

Important

Windows PowerShell 5.1에서는 관리자 권한 PowerShell 세션에서 관리자 권한으로 실행 Update-Help 해야 합니다.

다음 예제 Update-Help 에서는 컴퓨터에 설치된 모든 모듈에 대한 PowerShell 도움말 콘텐츠를 다운로드합니다. Force 매개 변수를 사용하여 최신 버전의 도움말 콘텐츠를 다운로드해야 합니다.

Update-Help -Force

다음 결과와 같이 모듈에서 오류를 반환했습니다. 오류는 일반적이지 않으며 일반적으로 모듈 작성자가 수정 가능한 도움말을 올바르게 구성하지 않는 경우에 발생합니다.

Update-Help : Failed to update Help for the module(s) 'BitsTransfer' with UI
culture(s) {en-US} : Unable to retrieve the HelpInfo XML file for UI culture
en-US. Make sure the HelpInfoUri property in the module manifest is valid or
check your network connection and then try the command again.
At line:1 char:1
+ Update-Help
+ ~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Update-Help], Except
   ion
    + FullyQualifiedErrorId : UnableToRetrieveHelpInfoXml,Microsoft.PowerShe
   ll.Commands.UpdateHelpCommand

Update-Help 는 도움말 콘텐츠를 다운로드하기 위해 인터넷에 액세스해야 합니다. 컴퓨터에 인터넷에 액세스할 수 없는 경우 인터넷에 액세스할 수 있는 컴퓨터의 Save-Help cmdlet을 사용하여 업데이트된 도움말 콘텐츠를 다운로드하고 저장합니다. 그런 다음 SourcePath 매개 변수 Update-Help 를 사용하여 저장된 업데이트된 도움말 콘텐츠의 위치를 지정합니다.

Get-Command

Get-Command 는 명령을 찾는 데 도움이 되는 또 다른 다목적 명령입니다. 매개 변수 없이 실행 Get-Command 하면 시스템의 모든 PowerShell 명령 목록이 반환됩니다. .을( Get-Command 를) 클릭하여 다음과 유사한 명령 구문을 가져올 수도 있습니다 Get-Help.

에 대한 구문을 확인하려면 어떻게 해야 할까 Get-Command요? 이 챕터의 Get-Help 섹션에 표시된 것처럼 도움말 문서를 Get-Command표시하는 데 사용할 Get-Help 수 있습니다. 구문 매개 변수와 함께 사용하여 Get-Command 명령에 대한 구문을 볼 수도 있습니다. 이 바로 가기를 사용하면 도움말 콘텐츠를 탐색하지 않고 명령을 사용하는 방법을 빠르게 결정할 수 있습니다.

Get-Command -Name Get-Command -Syntax

구문 매개 변수와 함께 사용하면 Get-Command 쇼와 같은 Get-Help 허용 가능한 특정 값을 나열하지 않고 매개 변수 및 해당 값 형식을 보여 주는 구문을 보다 간결하게 볼 수 있습니다.

Get-Command [[-ArgumentList] <Object[]>] [-Verb <string[]>]
[-Noun <string[]>] [-Module <string[]>]
[-FullyQualifiedModule <ModuleSpecification[]>] [-TotalCount <int>]
[-Syntax] [-ShowCommandInfo] [-All] [-ListImported]
[-ParameterName <string[]>] [-ParameterType <PSTypeName[]>]
[<CommonParameters>]

Get-Command [[-Name] <string[]>] [[-ArgumentList] <Object[]>]
[-Module <string[]>] [-FullyQualifiedModule <ModuleSpecification[]>]
[-CommandType <CommandTypes>] [-TotalCount <int>] [-Syntax]
[-ShowCommandInfo] [-All] [-ListImported] [-ParameterName <string[]>]
[-ParameterType <PSTypeName[]>] [<CommonParameters>]

명령을 사용하는 방법에 대한 자세한 정보가 필요한 경우 다음을 사용합니다 Get-Help.

help Get-Command -Full

SYNTAX 섹션 Get-Help매개 변수에 대한 열거형 값을 확장하여 사용자에게 친숙한 표시를 제공합니다. 사용할 수 있는 실제 값을 보여 주므로 사용 가능한 옵션을 더 쉽게 이해할 수 있습니다.

...
    Get-Command [[-Name] <System.String[]>] [[-ArgumentList]
    <System.Object[]>] [-All] [-CommandType {Alias | Function | Filter |
    Cmdlet | ExternalScript | Application | Script | Workflow |
    Configuration | All}] [-FullyQualifiedModule
    <Microsoft.PowerShell.Commands.ModuleSpecification[]>] [-ListImported]
    [-Module <System.String[]>] [-ParameterName <System.String[]>]
    [-ParameterType <System.Management.Automation.PSTypeName[]>]
    [-ShowCommandInfo] [-Syntax] [-TotalCount <System.Int32>]
    [<CommonParameters>]

    Get-Command [[-ArgumentList] <System.Object[]>] [-All]
    [-FullyQualifiedModule
    <Microsoft.PowerShell.Commands.ModuleSpecification[]>] [-ListImported]
    [-Module <System.String[]>] [-Noun <System.String[]>] [-ParameterName
    <System.String[]>] [-ParameterType
    <System.Management.Automation.PSTypeName[]>] [-ShowCommandInfo]
    [-Syntax] [-TotalCount <System.Int32>] [-Verb <System.String[]>]
    [<CommonParameters>]
...

도움말의 PARAMETERS 섹션은 이름, 명사동사 매개 변수가 와일드카드 문자를 허용한다는 것을 나타냅니다.Get-Command

...
    -Name <System.String[]>
        Specifies an array of names. This cmdlet gets only commands that
        have the specified name. Enter a name or name pattern. Wildcard
        characters are permitted.

        To get commands that have the same name, use the All parameter. When
        two commands have the same name, by default, `Get-Command` gets the
        command that runs when you type the command name.

        Required?                    false
        Position?                    0
        Default value                None
        Accept pipeline input?       True (ByPropertyName, ByValue)
        Accept wildcard characters?  true

    -Noun <System.String[]>
        Specifies an array of command nouns. This cmdlet gets commands,
        which include cmdlets, functions, and aliases, that have names that
        include the specified noun. Enter one or more nouns or noun
        patterns. Wildcard characters are permitted.

        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       True (ByPropertyName)
        Accept wildcard characters?  true
    -Verb <System.String[]>
        Specifies an array of command verbs. This cmdlet gets commands,
        which include cmdlets, functions, and aliases, that have names that
        include the specified verb. Enter one or more verbs or verb
        patterns. Wildcard characters are permitted.

        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       True (ByPropertyName)
        Accept wildcard characters?  true
...

다음 예제에서는 Name 매개 변수Get-Command의 값과 함께 와일드카드 문자를 사용합니다*.

Get-Command -Name *service*

이름 매개 변수Get-Command와 함께 와일드카드 문자를 사용하면 다음 결과와 같이 PowerShell 명령과 네이티브 명령이 반환됩니다.


CommandType     Name                                               Version
-----------     ----                                               -------
Function        Get-NetFirewallServiceFilter                       2.0.0.0
Function        Set-NetFirewallServiceFilter                       2.0.0.0
Cmdlet          Get-Service                                        3.1.0.0
Cmdlet          New-Service                                        3.1.0.0
Cmdlet          New-WebServiceProxy                                3.1.0.0
Cmdlet          Restart-Service                                    3.1.0.0
Cmdlet          Resume-Service                                     3.1.0.0
Cmdlet          Set-Service                                        3.1.0.0
Cmdlet          Start-Service                                      3.1.0.0
Cmdlet          Stop-Service                                       3.1.0.0
Cmdlet          Suspend-Service                                    3.1.0.0
Application     SecurityHealthService.exe                          10.0.2...
Application     SensorDataService.exe                              10.0.2...
Application     services.exe                                       10.0.2...
Application     services.msc                                       0.0.0.0
Application     TieringEngineService.exe                           10.0.2...
Application     Windows.WARP.JITService.exe                        10.0.2...

CommandType 매개 변수를 사용하여 결과를 Get-Command PowerShell 명령으로 제한할 수 있습니다.

Get-Command -Name *service* -CommandType Cmdlet, Function, Alias, Script

또 다른 옵션은 동사 또는 명사 매개 변수를 사용하거나 PowerShell 명령에만 동사와 명사가 있기 때문에 둘 다 사용하는 것입니다.

다음 예제에서는 프로세스와 함께 작동 하는 컴퓨터에서 명령을 찾는 데 사용 Get-Command 합니다. Noun 매개 변수를 사용하고 해당 값으로 지정 Process 합니다.

Get-Command -Noun Process
CommandType     Name                                               Version
-----------     ----                                               -------
Cmdlet          Debug-Process                                      3.1.0.0
Cmdlet          Get-Process                                        3.1.0.0
Cmdlet          Start-Process                                      3.1.0.0
Cmdlet          Stop-Process                                       3.1.0.0
Cmdlet          Wait-Process                                       3.1.0.0

요약

이 챕터에서는 명령과 Get-Command함께 Get-Help 명령을 찾는 방법을 알아보았습니다. 또한 도움말 시스템을 사용하여 명령을 찾은 후 사용하는 방법을 이해하는 방법도 알아보았습니다. 또한 새 도움말 콘텐츠를 사용할 수 있는 경우 컴퓨터에서 도움말 시스템을 업데이트하는 방법을 알아보았습니다.

검토

  1. 위치의 DisplayName 매개 변수 Get-Service 인가요?
  2. cmdlet에는 몇 개의 매개 변수 집합이 Get-Process 있나요?
  3. 이벤트 로그 작업을 위한 PowerShell 명령은 무엇인가요?
  4. 컴퓨터에서 실행되는 PowerShell 프로세스 목록을 반환하기 위한 PowerShell 명령은 무엇인가요?
  5. 컴퓨터에 저장된 PowerShell 도움말 콘텐츠를 업데이트하려면 어떻게 해야 할까요?

참조

이 챕터에서 다루는 개념에 대해 자세히 알아보려면 다음 PowerShell 도움말 문서를 참조하세요.

다음 단계

다음 챕터에서는 개체, 속성, 메서드 및 cmdlet에 Get-Member 대해 알아봅니다.