C#でRunspaceInvokerを使って、PowerShellの実行結果を取得したいです。
C#
1 .... 2 List<object> authMethod = new List<object>(); ; 3 string source = @"foreach($x in $input){$arg0 = $x} 4Invoke-Command -ComputerName $arg0 -FilePath GetGlobalAuthentication.ps1"; 5 using (var invoker = new RunspaceInvoke()) 6 { 7 var results = invoker.Invoke(source, new object[] { ComputerName }); 8 9 foreach (var result in results) 10 { 11 authMethod.Add(result); 12 } 13 } 14.....
Invoke-Commandで指定しているリモート先では以下のスクリプトを実行しています。
PowerShell
1Get-AdfsGlobalAuthenticationPolicy | Select PrimaryIntranetAuthenticationProvider
このauthMethodの一つ目の要素をstring化すると、
@{PrimaryIntranetAuthenticationProvider=System.Collections.ArrayList; PSComputerName=TEST; RunspaceId=eaabfa72-32e0-43f1-aa84-b233fc9d933f; PSShowComputerName=True}
のようになっています。
この"PrimaryIntranetAuthenticationProvider"の"System.Collections.ArrayList"の中身を取得したいのですが、取得の仕方が分かりません。
VSでデバッグ実行したいところですが、この処理を実行する環境ではVSが使えません。
ご助力のほどよろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。