我有以下幾點:訪問PowerShell的屬性與空間名
$test = Test-CsWebScheduler -TargetFqdn "pool.int.contoso.com"
Write-Output $test
Target Fqdn : pool.int.contoso.com
Target Uri : https://pool.int.contoso.com/Scheduler/
Result : Failure
Latency : 00:00:00
Error Message : Scheduling conference at
https://pool.int.contoso.com/Scheduler/Handler/WebSchedulerHandler.ashx failed
with status Failure.
Diagnosis :
現在的問題是:
我怎樣才能訪問「錯誤信息」,「目標URI」或「目標FQDN 「?我可以通過訪問結果:
Write-Output $test.result
Failure
沒有問題,但該有的都有了裏面的空間,我haven't找到了一種方法來訪問它們。我嘗試以下(發現here):
Write-Output $test."Target Uri"
或
Write-Output $test.{Target Uri}
我也試過如下:
$test | Select-Object -Property "Target Uri"
或
Write-Output ($test."Target Uri")
或非常簡單:
$test."Target Uri"
但這不起作用,我沒有得到回值(也沒有錯誤)。唯一的錯誤消息我得到的是,當我使用:
$test | select -ExpandProperty "Target Uri"
select : Property "Target Uri" cannot be found.
At line:1 char:9
+ $test | select -ExpandProperty "Target Uri"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Rtc.S...s.WebTaskOutput:PSObject) [Selec
t-Object], PSArgumentException
+ FullyQualifiedErrorId : ExpandPropertyNotFound,Microsoft.PowerShell.Commands.SelectObjectCom
mand
有沒有人有一個想法如何,我可以訪問(沒有傾銷,要一個臨時文件,並解析它)?
更新01:
這裏要求是從$測試輸出|克
$test | gm
TypeName: Microsoft.Rtc.SyntheticTransactions.WebTaskOutput
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Diagnosis Property string Diagnosis {get;}
Error Property string Error {get;}
Latency Property timespan Latency {get;}
Result Property Microsoft.Rtc.SyntheticTransactions.ResultStatus Result {get;}
TargetFqdn Property string TargetFqdn {get;}
TargetUri Property string TargetUri {get;}
WorkflowLogger Property Microsoft.Rtc.SyntheticTransactions.Logging.SyntheticTransactionsWorkf...
'$測試 「目標URI」' - 應做工精細;你可以粘貼(更新問題)從'$ test |輸出gm'? – 4c74356b41
是的,我也希望如此,但正如上面所寫,情況並非如此。 – BastianW
當我使用'Write-Output($ test。「Target Uri」)'或'$ test。「時,沒有什麼區別。Target Uri」'...'$ test | gm'現在添加到我的原始發佈。 – BastianW