Share via


SWbemObjectPath 개체

SWbemObjectPath 개체의 메서드 및 속성을 사용하여 개체 경로를 생성하고 유효성을 검사합니다. 이 개체는 VBScript CreateObject 호출로 만들 수 있습니다.

멤버

SWbemObjectPath 개체에는 다음과 같은 형식의 멤버가 있습니다.

메서드

SWbemObjectPath 개체에는 다음과 같은 메서드가 있습니다.

메서드 설명
SetAsClass 경로가 WMI 클래스의 주소를 지정하도록 합니다.
SetAsSingleton 경로가 싱글톤 WMI 인스턴스의 주소를 지정하도록 합니다.

속성

SWbemObjectPath 개체에는 다음과 같은 속성이 있습니다.

속성 액세스 유형 설명
Authority
읽기/쓰기
개체 경로의 Authority 구성 요소를 정의하는 문자열입니다.
클래스
읽기/쓰기
개체 경로의 일부인 클래스의 이름입니다.
DisplayName
읽기/쓰기
모니커 표시 이름으로 사용할 수 있는 양식의 경로를 포함하는 문자열입니다. WMI 애플리케이션 또는 스크립트 만들기를 참조하세요.
IsClass
읽기 전용
이 경로가 클래스를 의미하는지 여부를 나타내는 부울 값입니다. 이는 COM API의 __Genus 속성과 유사합니다.
IsSingleton
읽기 전용
이 경로가 싱글톤 인스턴스를 의미하는지 여부를 나타내는 부울 값입니다.
Keys
읽기 전용
키 값 바인딩을 포함하는 SWbemNamedValueSet 개체입니다.
Locale
읽기/쓰기
이 개체 경로에 대한 로캘을 포함하는 문자열입니다.
네임스페이스
읽기/쓰기
개체 경로의 일부인 네임스페이스의 이름입니다. 이는 COM API의 __Namespace 속성과 동일합니다.
ParentNamespace
읽기 전용
개체 경로의 일부인 네임스페이스의 부모 이름입니다.
Path
읽기/쓰기
절대 경로를 포함합니다. 이는 COM API의 __Path 시스템 속성과 동일합니다. 이 개체의 기본 속성입니다.
Relpath
읽기/쓰기
상대 경로를 포함합니다. 이는 COM API의 __Relpath 시스템 속성과 동일합니다.
Security_
읽기 전용
보안 설정을 읽거나 변경하는 데 사용됩니다.
서버
읽기/쓰기
서버의 이름입니다. 이는 COM API의 __Server 시스템 속성과 동일합니다.

예제

다음 VBScript 코드 샘플에서는 개체 경로를 빌드하는 방법을 보여줍니다.

on error resume next 
Set ObjectPath = CreateObject("WbemScripting.SWbemObjectPath")
ObjectPath.Server = "dingle"
ObjectPath.Namespace = "root/default/something"
ObjectPath.Class = "ho"
ObjectPath.Keys.Add "fred1", 10
ObjectPath.Keys.Add "fred2", -34
ObjectPath.Keys.Add "fred3", 65234654
ObjectPath.Keys.Add "fred4", "Wahaay"
ObjectPath.Keys.Add "fred5", -786186777

if err <> 0 then 
 WScript.Echo err.number
end if 

WScript.Echo "Pass 1:"
WScript.Echo ObjectPath.Path
WScript.Echo ObjectPath.DisplayName
WScript.Echo ""

ObjectPath.Security_.ImpersonationLevel = 3

WScript.Echo "Pass 2:"
WScript.Echo ObjectPath.Path
WScript.Echo ObjectPath.DisplayName
WScript.Echo ""

ObjectPath.Security_.AuthenticationLevel = 5

WScript.Echo "Pass 3:"
WScript.Echo ObjectPath.Path
WScript.Echo ObjectPath.DisplayName
WScript.Echo ""

Set Privileges = ObjectPath.Security_.Privileges
if err <> 0 then
 WScript.Echo Hex(Err.Number), Err.Description
end if
Privileges.Add 8
Privileges.Add 20, false

WScript.Echo "Pass 4:"
WScript.Echo ObjectPath.Path
WScript.Echo ObjectPath.DisplayName
WScript.Echo ""

ObjectPath.DisplayName = "winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktprivacy,(Debug,!IncreaseQuota, CreatePagefile ) }!//fred/root/blah"

WScript.Echo "Pass 5:"
WScript.Echo ObjectPath.Path
WScript.Echo ObjectPath.DisplayName
WScript.Echo ""

다음 Perl 코드 샘플에서는 개체 경로를 빌드하는 방법을 보여줍니다.

use strict;
use Win32::OLE;
use constant FALSE=>"false";

my ( $ObjectPath, $Privileges );

eval { $ObjectPath = new Win32::OLE 'WbemScripting.SWbemObjectPath'; };
unless($@)
{
 eval
 {
  $ObjectPath->{Server} = "dingle";
  $ObjectPath->{Namespace} = "root/default/something";
  $ObjectPath->{Class} = "ho";
  $ObjectPath->{Keys}->Add("fred1", 10);
  $ObjectPath->{Keys}->Add("fred2", -34);
  $ObjectPath->{Keys}->Add("fred3", 65234654);
  $ObjectPath->{Keys}->Add("fred4", "Wahaay");
  $ObjectPath->{Keys}->Add("fred5", -786186777);
 };
 unless($@)
 {
  print "\n";
  print "Pass 1:\n";
  print $ObjectPath->{Path}, "\n";
  print $ObjectPath->{DisplayName} , "\n\n";

  $ObjectPath->{Security_}->{ImpersonationLevel} = 3 ;

  print "Pass 2:\n";
  print $ObjectPath->{Path}, "\n";
  print $ObjectPath->{DisplayName} , "\n\n";

  $ObjectPath->{Security_}->{AuthenticationLevel} = 5 ;

  print "Pass 3:\n";
  print $ObjectPath->{Path}, "\n";
  print $ObjectPath->{DisplayName} , "\n\n";

  eval { $Privileges = $ObjectPath->{Security_}->{Privileges}; };
  unless($@)
  {
   $Privileges->Add(8);
   $Privileges->Add(20,FALSE);

   print "Pass 4:\n";
   print $ObjectPath->{Path}, "\n";
   print $ObjectPath->{DisplayName} , "\n\n";

   $ObjectPath->{DisplayName} = "winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktprivacy,(Debug,!IncreaseQuota, CreatePagefile ) }!//fred/root/blah";

   print "Pass 5:\n";
   print $ObjectPath->{Path}, "\n";
   print $ObjectPath->{DisplayName} , "\n";
  }
  else
  {
   print STDERR Win32::OLE->LastError, "\n";
  }
 }
 else
 {
  print STDERR Win32::OLE->LastError, "\n";
 }
}
else
{
 print STDERR Win32::OLE->LastError, "\n";
}

요구 사항

요구 사항
지원되는 최소 클라이언트
Windows Vista
지원되는 최소 서버
Windows Server 2008
헤더
Wbemdisp.h
유형 라이브러리
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemObjectPath
IID
IID_ISWbemObjectPath

추가 정보

스크립팅 API 개체