ConvertFrom-CliXml
CliXml 형식 문자열을 사용자 지정 PSObject로 변환합니다.
구문
Default (기본값)
ConvertFrom-CliXml
[-InputObject] <String>
[<CommonParameters>]
Description
ConvertFrom-CliXml cmdlet은 CLI(공용 언어 인프라) XML 형식의 문자열을 사용자 지정 PSObject변환합니다. 이 명령은 Import-Clixml비슷하지만 파일에서 읽지 않습니다. 대신 문자열을 입력으로 사용합니다.
새로 역직렬화된 개체는 라이브 개체가 아닙니다. serialization 시 개체의 스냅샷입니다. 역직렬화된 개체에는 속성이 포함되지만 메서드는 없습니다.
pstypenames 속성에는 Deserialized접두사로 된 원래 형식 이름이 포함됩니다.
이 cmdlet은 PowerShell 7.5-preview.4에서 도입되었습니다.
예제
예제 1 - 프로세스 개체를 CliXml로 변환 및 뒤로 변환
이 예제에서는 프로세스 개체를 CliXml로 변환하고 뒤로 변환한 결과를 보여줍니다. 먼저 현재 프로세스가 변수 $process저장됩니다. 프로세스 개체의 pstypenames 속성은 개체가 System.Diagnostics.Process 형식임을 보여 줍니다. 다음 명령은 프로세스 개체의 각 멤버 유형에 대한 개수를 표시합니다.
$process = Get-Process -Id $PID
$process.pstypenames
System.Diagnostics.Process
System.ComponentModel.Component
System.MarshalByRefObject
System.Object
$process | Get-Member | Group-Object MemberType | Select-Object Name, Count
Name Count
---- -----
AliasProperty 7
CodeProperty 1
Property 52
NoteProperty 1
ScriptProperty 8
PropertySet 2
Method 19
Event 4
$xml = $process | ConvertTo-CliXml
$fromXML = ConvertFrom-CliXml $xml
$fromXML.pstypenames
Deserialized.System.Diagnostics.Process
Deserialized.System.ComponentModel.Component
Deserialized.System.MarshalByRefObject
Deserialized.System.Object
$fromXML | Get-Member | Group-Object MemberType | Select-Object Name, Count
Name Count
---- -----
Property 46
NoteProperty 17
PropertySet 2
Method 2
다음으로 프로세스 개체가 CliXml로 변환되고 뒤로 변환됩니다. 새 개체의 형식에는 Deserialized접두사로 지정됩니다. 새 개체의 멤버 수는 원래 개체와 다릅니다.
매개 변수
-InputObject
변환할 CliXml 형식 문자열을 포함하는 개체입니다.
매개 변수 속성
| 형식: | String |
| Default value: | None |
| 와일드카드 지원: | False |
| DontShow: | False |
매개 변수 집합
(All)
| Position: | 0 |
| 필수: | True |
| 파이프라인의 값: | True |
| 속성 이름별 파이프라인의 값: | False |
| 나머지 인수의 값: | False |
CommonParameters
이 cmdlet은 일반적인 매개 변수인 -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction 및 -WarningVariable 매개 변수를 지원합니다. 자세한 내용은 about_CommonParameters를 참조하세요.