###前提・実現したいこと
PowerShlellでコマンドレットを実行して、結果をファイル出力するスクリプトを作っています。
コマンドレット(Test-NetConnection)の実行結果を、パイプを使用してOut-FileとExport-Csvでそれぞれ出力すると以下のようになります。Exort-Csvの場合もOut-Fileの場合と同じ項目で出力できるようにしたいです。
実現方法をご教示いただきたくよろしくお願いいたします。
Out-Fileの場合
ComputerName : 192.168.11.1
RemoteAddress : 192.168.11.1
RemotePort : 80
InterfaceAlias : Wi-Fi
SourceAddress : 192.168.11.3
PingSucceeded : True
PingReplyDetails (RTT) : 1 ms
TcpTestSucceeded : True
Exort-Csvの場合(項目のみ)
ComputerName
RemoteAddress
PingSucceeded
PingReplyDetails
TcpClientSocket
TcpTestSucceeded
RemotePort
TraceRoute
Detailed
InterfaceAlias
InterfaceIndex
InterfaceDescription
NetAdapter
NetRoute
SourceAddress
NameResolutionSucceeded
BasicNameResolution
LLMNRNetbiosRecords
DNSOnlyRecords
AllNameResolutionResults
IsAdmin
NetworkIsolationContext
MatchingIPsecRules
###該当のソースコード
PowerShell
Test-NetConnection 192.168.11.1 -port 80 | Out-File Result.txt
Test-NetConnection 192.168.11.1 -port 80 | Export-Csv -NoTypeInformation Result.csv
###補足情報(言語/FW/ツール等のバージョンなど)
PSVersion 5.0.10586.494

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/07/18 03:32