0
XML 파일로 내 보낸 파일 서버 구성을 가져 오기위한 스크립트를 만듭니다. 이 XML 파일은 3 개체, 2 사용자 정의 개체를 포함 pstypenames로 개체 선택 powershell
, 1 가져올 구성으로하여 ComObject를 직렬화 복원 :내가 COM 객체 (SmtpServer
속성을 사용하여 객체를) 선택해야하지만, 나는 이것을 달성 할 길을 찾을 수 없었습니다.
$importedServerConfig = Import-Clixml -Path ("C:\empty\ServerConfigurations.xml")
$COMObject = $importedServerConfig|Where-Object{$_.notification -eq "notification"}
$COMObject
이 코드를 사용하면이 속성 값으로 psobject를 선택할 수 있지만 COMobject에서는 작동하지 않습니다.
.gettype() 메서드로 필터링하려고하지만 COMObject에서 작동하지 않으므로 pstypenames를 사용하고 있습니다.
$importedServerConfig = Import-Clixml -Path ("C:\empty\ServerConfigurations.xml")
$COMObject = $importedServerConfig|Where-Object{$_.pstypenames -eq "Deserialized.System.__ComObject"}
$COMObject
내 질문은 :이 XML 파일에 pstypenames
속성을 사용하여 특정하여 ComObject를 선택하는 방법이 있나요?
'$ importedServerConfig | ? PSTypeNames - Deserialized.System .__ ComObject' 포함 – PetSerAl