ManagementObject 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
ManagementObject 클래스의 새 인스턴스를 초기화합니다.
오버로드
| Name | Description |
|---|---|
| ManagementObject() |
ManagementObject 클래스의 새 인스턴스를 초기화합니다. 매개 변수가 없는 생성자입니다. |
| ManagementObject(ManagementPath) |
지정된 WMI 개체 경로에 ManagementObject 대한 클래스의 새 인스턴스를 초기화합니다. 경로는 .로 ManagementPath제공됩니다. |
| ManagementObject(String) |
지정된 WMI 개체 경로에 ManagementObject 대한 클래스의 새 인스턴스를 초기화합니다. 경로가 문자열로 제공됩니다. |
| ManagementObject(ManagementPath, ObjectGetOptions) |
지정된 추가 옵션을 포함하여 지정된 WMI 경로에 바인딩된 클래스의 ManagementObject 새 인스턴스를 초기화합니다. |
| ManagementObject(SerializationInfo, StreamingContext) |
사용되지 않음.
serialize할 수 있는 클래스의 ManagementObject 새 인스턴스를 초기화합니다. |
| ManagementObject(String, ObjectGetOptions) |
지정된 추가 옵션을 포함하여 지정된 WMI 경로에 바인딩된 클래스의 ManagementObject 새 인스턴스를 초기화합니다. 이 변형에서는 경로를 문자열로 지정할 수 있습니다. |
| ManagementObject(ManagementScope, ManagementPath, ObjectGetOptions) |
지정된 옵션을 포함하는 지정된 WMI 경로에 바인딩된 클래스의 ManagementObject 새 인스턴스를 초기화합니다. |
| ManagementObject(String, String, ObjectGetOptions) |
지정된 WMI 경로에 바인딩된 클래스의 ManagementObject 새 인스턴스를 초기화하고 지정된 옵션을 포함합니다. 범위와 경로는 문자열로 지정됩니다. |
ManagementObject()
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
ManagementObject 클래스의 새 인스턴스를 초기화합니다. 매개 변수가 없는 생성자입니다.
public:
ManagementObject();
public ManagementObject();
Public Sub New ()
예제
다음 예제에서는 매개 변수가 없는 생성자를 사용하여 클래스의 ManagementObject 새 인스턴스를 초기화합니다.
using System;
using System.Management;
class Sample
{
public static int Main(string[] args)
{
ManagementObject o = new ManagementObject();
// Now set the path on this object to
// bind it to a 'real' manageable entity
o.Path =
new ManagementPath("Win32_LogicalDisk='c:'");
//Now it can be used
Console.WriteLine(o["FreeSpace"]);
return 0;
}
}
Imports System.Management
Class Sample_ManagementClass
Public Overloads Shared Function Main( _
ByVal args() As String) As Integer
Dim o As New ManagementObject
Dim mp As New _
ManagementPath("Win32_LogicalDisk='c:'")
' Now set the path on this object to
' bind it to a 'real' manageable entity
o.Path = mp
'Now it can be used
Console.WriteLine(o("FreeSpace"))
Return 0
End Function
End Class
설명
.NET Framework 보안
즉시 호출자에 대한 완전 신뢰입니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드의 라이브러리 사용을 참조하세요.
적용 대상
ManagementObject(ManagementPath)
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
지정된 WMI 개체 경로에 ManagementObject 대한 클래스의 새 인스턴스를 초기화합니다. 경로는 .로 ManagementPath제공됩니다.
public:
ManagementObject(System::Management::ManagementPath ^ path);
public ManagementObject(System.Management.ManagementPath path);
new System.Management.ManagementObject : System.Management.ManagementPath -> System.Management.ManagementObject
Public Sub New (path As ManagementPath)
매개 변수
- path
- ManagementPath
ManagementPath WMI 개체에 대한 경로를 포함하는 A입니다.
예제
다음 예제에서는 지정된 WMI 개체 경로를 사용하여 클래스의 ManagementObject 새 인스턴스를 초기화합니다.
using System;
using System.Management;
class Sample
{
public static int Main(string[] args)
{
ManagementPath p =
new ManagementPath(
"Win32_Service.Name='Alerter'");
ManagementObject o = new ManagementObject(p);
//Now it can be used
Console.WriteLine(o["Name"]);
return 0;
}
}
Imports System.Management
Class Sample_ManagementClass
Public Overloads Shared Function Main( _
ByVal args() As String) As Integer
Dim p As New ManagementPath( _
"Win32_Service.Name=""Alerter""")
Dim o As New ManagementObject(p)
'Now it can be used
Console.WriteLine(o("Name"))
Return 0
End Function
End Class
설명
.NET Framework 보안
즉시 호출자에 대한 완전 신뢰입니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드의 라이브러리 사용을 참조하세요.
적용 대상
ManagementObject(String)
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
지정된 WMI 개체 경로에 ManagementObject 대한 클래스의 새 인스턴스를 초기화합니다. 경로가 문자열로 제공됩니다.
public:
ManagementObject(System::String ^ path);
public ManagementObject(string path);
new System.Management.ManagementObject : string -> System.Management.ManagementObject
Public Sub New (path As String)
매개 변수
- path
- String
WMI 경로입니다.
예제
다음 예제에서는 클래스의 새 인스턴스를 초기화합니다 ManagementObject .
using System;
using System.Management;
class Sample
{
public static int Main(string[] args)
{
ManagementObject o =
new ManagementObject("Win32_Service.Name='Alerter'");
//or with a full path :
ManagementObject mObj =
new ManagementObject(
"\\\\MyServer\\root\\MyApp:MyClass.Key='abc'");
return 0;
}
}
Imports System.Management
Class Sample_ManagementClass
Public Overloads Shared Function Main( _
ByVal args() As String) As Integer
Dim o As New ManagementObject( _
"Win32_Service.Name=""Alerter""")
' or with a full path :
Dim mObj As New ManagementObject( _
"\\\\MyServer\\root\\MyApp:MyClass.Key=""abc""")
Return 0
End Function
End Class
설명
지정된 경로가 상대 경로(서버 또는 네임스페이스를 지정하지 않은 경우)인 경우 기본 경로는 로컬 컴퓨터이고 기본 네임스페이스는 경로(기본적으로 root\cimv2)입니다 DefaultPath . 사용자가 전체 경로를 지정하는 경우 기본 설정이 재정의됩니다.
.NET Framework 보안
즉시 호출자에 대한 완전 신뢰입니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드의 라이브러리 사용을 참조하세요.
적용 대상
ManagementObject(ManagementPath, ObjectGetOptions)
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
지정된 추가 옵션을 포함하여 지정된 WMI 경로에 바인딩된 클래스의 ManagementObject 새 인스턴스를 초기화합니다.
public:
ManagementObject(System::Management::ManagementPath ^ path, System::Management::ObjectGetOptions ^ options);
public ManagementObject(System.Management.ManagementPath path, System.Management.ObjectGetOptions options);
new System.Management.ManagementObject : System.Management.ManagementPath * System.Management.ObjectGetOptions -> System.Management.ManagementObject
Public Sub New (path As ManagementPath, options As ObjectGetOptions)
매개 변수
- path
- ManagementPath
ManagementPath WMI 경로를 포함하는 A.
- options
- ObjectGetOptions
ObjectGetOptions WMI 개체에 바인딩하기 위한 추가 옵션이 포함되어 있습니다. 기본 옵션을 사용하는 경우 이 매개 변수는 null일 수 있습니다.
예제
다음 예제에서는 특정 WMI 경로에 ManagementObject 바인딩된 클래스의 새 인스턴스를 초기화합니다.
using System;
using System.Management;
class Sample
{
public static int Main(string[] args)
{
ManagementPath p =
new ManagementPath("Win32_Service");
// Set options for no context info
// but requests amended qualifiers
// to be contained in the object
ObjectGetOptions opt =
new ObjectGetOptions(
null, System.TimeSpan.MaxValue, true);
ManagementClass c =
new ManagementClass(p, opt);
Console.WriteLine(
c.Qualifiers["Description"].Value);
return 0;
}
}
Imports System.Management
Class Sample_ManagementClass
Public Overloads Shared Function Main( _
ByVal args() As String) As Integer
Dim p As New ManagementPath("Win32_Service")
' Set options for no context info
' but requests amended qualifiers
' to be contained in the object
Dim opt As New ObjectGetOptions( _
Nothing, TimeSpan.MaxValue, True)
Dim c As New ManagementClass(p, opt)
Console.WriteLine(c.Qualifiers("Description").Value)
Return 0
End Function
End Class
설명
.NET Framework 보안
즉시 호출자에 대한 완전 신뢰입니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드의 라이브러리 사용을 참조하세요.
적용 대상
ManagementObject(SerializationInfo, StreamingContext)
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
주의
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
serialize할 수 있는 클래스의 ManagementObject 새 인스턴스를 초기화합니다.
protected:
ManagementObject(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
public:
ManagementObject(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected ManagementObject(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
public ManagementObject(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected ManagementObject(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Management.ManagementObject : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.ManagementObject
new System.Management.ManagementObject : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.ManagementObject
Protected Sub New (info As SerializationInfo, context As StreamingContext)
Public Sub New (info As SerializationInfo, context As StreamingContext)
매개 변수
- info
- SerializationInfo
SerializationInfo 데이터로 채울 수 있습니다.
- context
- StreamingContext
이 serialization의 대상(참조 StreamingContext)입니다.
- 특성
설명
.NET Framework 보안
즉시 호출자에 대한 완전 신뢰입니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드의 라이브러리 사용을 참조하세요.
적용 대상
ManagementObject(String, ObjectGetOptions)
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
지정된 추가 옵션을 포함하여 지정된 WMI 경로에 바인딩된 클래스의 ManagementObject 새 인스턴스를 초기화합니다. 이 변형에서는 경로를 문자열로 지정할 수 있습니다.
public:
ManagementObject(System::String ^ path, System::Management::ObjectGetOptions ^ options);
public ManagementObject(string path, System.Management.ObjectGetOptions options);
new System.Management.ManagementObject : string * System.Management.ObjectGetOptions -> System.Management.ManagementObject
Public Sub New (path As String, options As ObjectGetOptions)
매개 변수
- path
- String
개체에 대한 WMI 경로입니다.
- options
- ObjectGetOptions
ObjectGetOptions 지정된 WMI 개체를 가져오는 표시 옵션입니다.
예제
다음 예제에서는 클래스의 새 인스턴스를 초기화합니다 ManagementObject .
using System;
using System.Management;
class Sample
{
public static int Main(string[] args)
{
// Set options for no context info,
// but requests amended qualifiers
// to be contained in the object
ObjectGetOptions opt =
new ObjectGetOptions(null, System.TimeSpan.MaxValue, true);
ManagementObject o =
new ManagementObject(
"Win32_Service", opt);
Console.WriteLine(o.GetQualifierValue("Description"));
return 0;
}
}
Imports System.Management
Class Sample_ManagementClass
Public Overloads Shared Function Main( _
ByVal args() As String) As Integer
' Set options for no context info,
' but requests amended qualifiers
' to be contained in the object
Dim opt As New ObjectGetOptions( _
Nothing, System.TimeSpan.MaxValue, True)
Dim o As New ManagementObject( _
"Win32_Service", opt)
Console.WriteLine(o.GetQualifierValue("Description"))
Return 0
End Function
End Class
설명
.NET Framework 보안
즉시 호출자에 대한 완전 신뢰입니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드의 라이브러리 사용을 참조하세요.
적용 대상
ManagementObject(ManagementScope, ManagementPath, ObjectGetOptions)
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
지정된 옵션을 포함하는 지정된 WMI 경로에 바인딩된 클래스의 ManagementObject 새 인스턴스를 초기화합니다.
public:
ManagementObject(System::Management::ManagementScope ^ scope, System::Management::ManagementPath ^ path, System::Management::ObjectGetOptions ^ options);
public ManagementObject(System.Management.ManagementScope scope, System.Management.ManagementPath path, System.Management.ObjectGetOptions options);
new System.Management.ManagementObject : System.Management.ManagementScope * System.Management.ManagementPath * System.Management.ObjectGetOptions -> System.Management.ManagementObject
Public Sub New (scope As ManagementScope, path As ManagementPath, options As ObjectGetOptions)
매개 변수
- scope
- ManagementScope
ManagementScope WMI 개체가 있는 범위를 나타내는 값입니다. 이 버전에서 범위는 WMI 네임스페이스만 될 수 있습니다.
- path
- ManagementPath
ManagementPath 관리 가능한 개체에 대한 WMI 경로를 나타내는 값입니다.
- options
- ObjectGetOptions
ObjectGetOptions 개체를 가져오기 위한 추가 옵션을 지정하는 것입니다.
예제
다음 예제에서는 특정 WMI 경로에 ManagementObject 바인딩된 클래스의 새 인스턴스를 초기화합니다.
using System;
using System.Management;
class Sample
{
public static int Main(string[] args)
{
ManagementScope s = new ManagementScope(
"\\\\MyMachine\\root\\cimv2");
ManagementPath p =
new ManagementPath(
"Win32_Service");
// Set options for no context info,
// but requests amended qualifiers
// to be contained in the object
ObjectGetOptions opt =
new ObjectGetOptions(
null, TimeSpan.MaxValue, true);
ManagementObject o = new ManagementObject(s, p, opt);
Console.WriteLine(o.Qualifiers["Description"].Value);
return 0;
}
}
Imports System.Management
Class Sample_ManagementClass
Public Overloads Shared Function Main( _
ByVal args() As String) As Integer
Dim s As New ManagementScope( _
"\\MyMachine\root\cimv2")
Dim p As New ManagementPath( _
"Win32_Service")
' Set options for no context info,
' but requests amended qualifiers
' to be contained in the object
Dim opt As ObjectGetOptions
opt = New ObjectGetOptions( _
Nothing, TimeSpan.MaxValue, True)
Dim o As ManagementObject
o = New ManagementObject(s, p, opt)
Console.WriteLine(o.Qualifiers("Description").Value)
Return 0
End Function
End Class
설명
WMI 경로는 상대 경로이거나 꽉 찼을 수 있으므로 범위와 지정된 경로 간에 충돌이 발생할 수 있습니다. 그러나 범위가 지정되고 상대 WMI 경로가 지정된 경우 충돌이 없습니다. 다음은 몇 가지 가능한 충돌입니다.
범위가 지정되지 않고 상대 WMI 경로가 지정된 경우 범위는 기본적으로 로컬 컴퓨터의 DefaultPath경로로 설정됩니다.
범위를 지정하지 않고 전체 WMI 경로를 지정하면 전체 경로의 범위 부분에서 범위가 유추됩니다. 예를 들어 전체 WMI 경로: \\MyMachine\root\MyNamespace:MyClass.Name='abc' '\\MyMachine\root\MyNamespace' 범위에서 WMI 개체 'MyClass.Name='abc'"를 나타냅니다.
범위가 지정되고 전체 WMI 경로가 지정된 경우 범위는 전체 경로의 범위 부분을 재정의합니다. 예를 들어 \\MyMachine\root\MyScope를 지정하고 다음 전체 경로를 지정한 경우 \\MyMachine\root\MyNamespace:MyClass.Name='abc'를 찾은 다음을 찾 object: \\MyMachine\root\MyScope:MyClass.Name= 'abc' 습니다(전체 경로의 범위 부분은 무시됨).
.NET Framework 보안
즉시 호출자에 대한 완전 신뢰입니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드의 라이브러리 사용을 참조하세요.
적용 대상
ManagementObject(String, String, ObjectGetOptions)
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
- Source:
- ManagementObject.cs
지정된 WMI 경로에 바인딩된 클래스의 ManagementObject 새 인스턴스를 초기화하고 지정된 옵션을 포함합니다. 범위와 경로는 문자열로 지정됩니다.
public:
ManagementObject(System::String ^ scopeString, System::String ^ pathString, System::Management::ObjectGetOptions ^ options);
public ManagementObject(string scopeString, string pathString, System.Management.ObjectGetOptions options);
new System.Management.ManagementObject : string * string * System.Management.ObjectGetOptions -> System.Management.ManagementObject
Public Sub New (scopeString As String, pathString As String, options As ObjectGetOptions)
매개 변수
- scopeString
- String
WMI 개체의 범위입니다.
- pathString
- String
WMI 개체 경로입니다.
- options
- ObjectGetOptions
ObjectGetOptions WMI 개체를 가져오기 위한 추가 옵션을 나타냅니다.
예제
다음 예제에서는 특정 WMI 경로 및 옵션을 사용하여 클래스의 ManagementObject 새 인스턴스를 초기화합니다.
using System;
using System.Management;
class Sample
{
public static int Main(string[] args)
{
ObjectGetOptions opt =
new ObjectGetOptions(null, System.TimeSpan.MaxValue, true);
ManagementObject o =
new ManagementObject(
"root\\MyNamespace", "MyClass", opt);
return 0;
}
}
Imports System.Management
Class Sample_ManagementClass
Public Overloads Shared Function Main( _
ByVal args() As String) As Integer
Dim opt As New ObjectGetOptions( _
Nothing, System.TimeSpan.MaxValue, True)
Dim o As New ManagementObject( _
"root\MyNamespace", "MyClass", opt)
Return 0
End Function
End Class
설명
자세한 내용은 해당하는 오버로드를 참조하세요.
.NET Framework 보안
즉시 호출자에 대한 완전 신뢰입니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드의 라이브러리 사용을 참조하세요.