Powershell脚本只获取branchcache状态

问题描述 投票:0回答:1

我试图从控制台获取分支缓存状态,但一直无法这样做

有一个命令Get-BCStatus,它返回下面的批量数据

GET-BCStatus

BranchCacheIsEnabled:False BranchCacheServiceStatus:已停止BranchCacheServiceStartType:Manual

ClientConfiguration:

CurrentClientMode           : Disabled
HostedCacheServerList       : 
HostedCacheDiscoveryEnabled : False

内容服务器配置:

ContentServerIsEnabled : False

托管缓存服务器配置:

HostedCacheServerIsEnabled        : False
ClientAuthenticationMode          : Domain
HostedCacheScpRegistrationEnabled : False

我正在尝试使用powershell查询但是没有成功

我只需要分支缓存的状态而不需要其他任何东西

我尝试了下面的查询

Get-BCStatus | Where-Object {$_.BranchCacheIsEnabled}

我只需要False但它返回nil

powershell
1个回答
0
投票

Get-BCStatus | Select-Object -ExpandProperty BranchCacheIsEnabled

只需选择您想要的一个属性即可。您要求powershell获取-BCStatus,然后给出BranchCacheIsEnabled属性不为null的那些。但你的价值是假的,所以什么都没有返回。

© www.soinside.com 2019 - 2024. All rights reserved.