솔루션에서 도구의 가시성을 제어하세요
사용 가능한 도구 목록에서 확장 또는 도구를 제외하거나 숨기려는 경우가 있을 수 있습니다. 예를 들어 도구가 Windows Server 2016(이전 버전 아님)만 대상으로 하는 경우 Windows Server 2012 R2 서버에 연결하는 사용자가 도구를 전혀 볼 수 없도록 할 수 있습니다. (사용자 환경을 상상해 보세요. 사용자는 클릭 후 도구 로드를 기다리다가 해당 기능을 연결에 사용할 수 없다는 메시지를 받습니다.) 도구의 manifest.json 파일에 기능을 표시하거나 숨길 시기를 정의할 수 있습니다.
도구를 표시할 시기를 결정하는 옵션
도구를 표시하고 특정 서버 또는 클러스터 연결에 사용할 수 있는지 여부를 결정하는 데 사용할 수 있는 세 가지 옵션이 있습니다.
- localhost
- 인벤토리(속성 배열)
- 스크립트
LocalHost
조건 개체의 localHost 속성에는 연결 노드가 localHost(Windows Admin Center가 설치된 컴퓨터와 동일한 컴퓨터)인지 여부를 유추하도록 평가할 수 있는 부울 값이 포함되어 있습니다. 속성에 값을 전달하여 도구를 표시할 시기(조건)를 나타냅니다. 예를 들어 사용자가 실제로 로컬 호스트에 연결하는 경우에만 도구를 표시하려면 다음과 같이 설정합니다.
"conditions": [
{
"localhost": true
}]
또는 연결 노드 가 localhost가 아닌 경우에만 도구를 표시하려면 다음을 수행합니다.
"conditions": [
{
"localhost": false
}]
연결 노드가 localhost가 아닌 경우에만 도구를 표시하는 구성 설정은 다음과 같습니다.
"entryPoints": [
{
"entryPointType": "tool",
"name": "main",
"urlName": "processes",
"displayName": "resources:strings:displayName",
"description": "resources:strings:description",
"icon": "sme-icon:icon-win-serverProcesses",
"path": "",
"requirements": [
{
"solutionIds": [
"msft.sme.server-manager!windowsClients"
],
"connectionTypes": [
"msft.sme.connection-type.windows-client"
],
"conditions": [
{
"localhost": true
}
]
}
]
}
인벤토리 속성
SDK에는 도구 사용 여부를 결정하기 위해 조건을 빌드하는 데 사용할 수 있는 미리 큐레이팅된 인벤토리 속성 집합이 포함되어 있습니다. '인벤토리' 배열에는 다음과 같은 9가지 속성이 있습니다.
속성 이름 | 예상 값 형식 |
---|---|
computerManufacturer | 문자열 |
operatingSystemSKU | 번호 |
operatingSystemVersion | version_string(예: "10.1.*") |
productType | 번호 |
clusterFqdn | 문자열 |
isHyperVRoleInstalled | 부울 값 |
isHyperVPowershellInstalled | 부울 값 |
isManagementToolsAvailable | 부울 값 |
isWmfInstalled | 부울 값 |
인벤토리 배열의 모든 개체는 다음 json 구조를 준수해야 합니다.
"<property name>": {
"type": "<expected type>",
"operator": "<defined operator to use>",
"value": "<expected value to evaluate using the operator>"
}
연산자 값
연산자 | 설명 |
---|---|
gt | 보다 큼 |
ge | 보다 크거나 같음 |
lt | 미만 |
le | 보다 작거나 같음 |
eq | 다음과 같음 |
ne | 같지 않음 |
is | 값이 true인지 확인합니다. |
not | 값이 false인지 확인합니다 |
contains | 항목이 문자열에 존재함 |
notContains | 문자열에 항목이 존재하지 않음 |
데이터 유형
'type' 속성에 사용할 수 있는 옵션.
유형 | 설명 |
---|---|
version | 버전 번호(예: 10.1.*) |
번호 | 숫자 값 |
문자열 | 문자열 값입니다. |
부울 값 | true 또는 false |
값 형식
'value' 속성은 다음 형식을 허용합니다.
- 문자열
- number
- 부울 값
올바른 형식의 인벤토리 조건 집합은 다음과 같습니다.
"entryPoints": [
{
"entryPointType": "tool",
"name": "main",
"urlName": "processes",
"displayName": "resources:strings:displayName",
"description": "resources:strings:description",
"icon": "sme-icon:icon-win-serverProcesses",
"path": "",
"requirements": [
{
"solutionIds": [
"msft.sme.server-manager!servers"
],
"connectionTypes": [
"msft.sme.connection-type.server"
],
"conditions": [
{
"inventory": {
"operatingSystemVersion": {
"type": "version",
"operator": "gt",
"value": "6.3"
},
"operatingSystemSKU": {
"type": "number",
"operator": "eq",
"value": "8"
}
}
}
]
}
]
}
스크립트
마지막으로 사용자 지정 PowerShell 스크립트를 실행하여 노드의 가용성 및 상태를 식별할 수 있습니다. 모든 스크립트는 다음 구조의 개체를 반환해야 합니다.
@{
State = 'Available' | 'NotSupported' | 'NotConfigured';
Message = '<Message to explain the reason of state such as not supported and not configured.>';
Properties =
@{ Name = 'Prop1'; Value = 'prop1 data'; Type = 'string' },
@{Name='Prop2'; Value = 12345678; Type='number'; };
}
상태 속성은 도구 목록에서 확장을 표시하거나 숨기는 결정을 제어하는 중요한 값입니다. 허용되는 값은 다음과 같습니다.
값 | 설명 |
---|---|
사용 가능 | 확장은 도구 목록에 표시되어야 합니다. |
NotSupported | 확장은 도구 목록에 표시되면 안됩니다. |
NotConfigured | 이 값은 도구를 사용할 수 있게 되기 전 사용자에게 추가 구성을 요청하는 향후 작업의 자리 표시자 값입니다. 현재 이 값은 도구가 표시되게 하는 '사용 가능'과 동일한 기능입니다. |
예를 들어 원격 서버에 BitLocker가 설치된 경우에만 도구를 로드하려는 경우, 스크립트는 다음과 같습니다.
$response = @{
State = 'NotSupported';
Message = 'Not executed';
Properties = @{ Name = 'Prop1'; Value = 'prop1 data'; Type = 'string' },
@{Name='Prop2'; Value = 12345678; Type='number'; };
}
if (Get-Module -ListAvailable -Name servermanager) {
Import-module servermanager;
$isInstalled = (Get-WindowsFeature -name bitlocker).Installed;
$isGood = $isInstalled;
}
if($isGood) {
$response.State = 'Available';
$response.Message = 'Everything should work.';
}
$response
스크립트 옵션을 사용하는 진입점 구성은 다음과 같습니다.
"entryPoints": [
{
"entryPointType": "tool",
"name": "main",
"urlName": "processes",
"displayName": "resources:strings:displayName",
"description": "resources:strings:description",
"icon": "sme-icon:icon-win-serverProcesses",
"path": "",
"requirements": [
{
"solutionIds": [
"msft.sme.server-manager!windowsClients"
],
"connectionTypes": [
"msft.sme.connection-type.windows-client"
],
"conditions": [
{
"localhost": true,
"inventory": {
"operatingSystemVersion": {
"type": "version",
"operator": "eq",
"value": "10.0.*"
},
"operatingSystemSKU": {
"type": "number",
"operator": "eq",
"value": "4"
}
},
"script": "$response = @{ State = 'NotSupported'; Message = 'Not executed'; Properties = @{ Name = 'Prop1'; Value = 'prop1 data'; Type = 'string' }, @{Name='Prop2'; Value = 12345678; Type='number'; }; }; if (Get-Module -ListAvailable -Name servermanager) { Import-module servermanager; $isInstalled = (Get-WindowsFeature -name bitlocker).Installed; $isGood = $isInstalled; }; if($isGood) { $response.State = 'Available'; $response.Message = 'Everything should work.'; }; $response"
}
]
}
]
}
여러 요구 사항 집합 지원
두 개 이상의 요구 사항 집합을 사용하여 여러 '요구 사항' 블록을 정의하여 도구를 표시할 시기를 결정할 수 있습니다.
예를 들어 '시나리오 A' 또는 '시나리오 B'가 참인 경우 도구를 표시하려면 두 가지 요구 사항 블록을 정의합니다. 둘 중 하나가 true면(즉, 요구 사항 블록 내의 모든 조건이 충족됨) 도구가 표시되는 것입니다.
"entryPoints": [
{
"requirements": [
{
"solutionIds": [
…"scenario A"…
],
"connectionTypes": [
…"scenario A"…
],
"conditions": [
…"scenario A"…
]
},
{
"solutionIds": [
…"scenario B"…
],
"connectionTypes": [
…"scenario B"…
],
"conditions": [
…"scenario B"…
]
}
]
}
지원 조건 범위
동일한 속성을 사용하지만 연산자가 다른 여러 '조건' 블록을 정의하여 조건 범위를 정의할 수도 있습니다.
동일한 속성이 다른 연산자로 정의되면 두 조건 사이에 값이 있는 한 도구가 표시됩니다.
예를 들어 운영 체제가 6.3.0에서 10.0.0 사이의 버전인 경우 이 도구가 표시됩니다.
"entryPoints": [
{
"entryPointType": "tool",
"name": "main",
"urlName": "processes",
"displayName": "resources:strings:displayName",
"description": "resources:strings:description",
"icon": "sme-icon:icon-win-serverProcesses",
"path": "",
"requirements": [
{
"solutionIds": [
"msft.sme.server-manager!servers"
],
"connectionTypes": [
"msft.sme.connection-type.server"
],
"conditions": [
{
"inventory": {
"operatingSystemVersion": {
"type": "version",
"operator": "gt",
"value": "6.3.0"
},
}
},
{
"inventory": {
"operatingSystemVersion": {
"type": "version",
"operator": "lt",
"value": "10.0.0"
}
}
}
]
}
]
}