Remove-CimInstance
Removes a CIM instance from a computer.
구문
CimInstanceComputerSet (기본값)
Remove-CimInstance
[-InputObject] <CimInstance>
[-ResourceUri <Uri>]
[-ComputerName <String[]>]
[-OperationTimeoutSec <UInt32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CimInstanceSessionSet
Remove-CimInstance
[-InputObject] <CimInstance>
-CimSession <CimSession[]>
[-ResourceUri <Uri>]
[-OperationTimeoutSec <UInt32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
QuerySessionSet
Remove-CimInstance
[[-Namespace] <String>]
[-Query] <String>
-CimSession <CimSession[]>
[-OperationTimeoutSec <UInt32>]
[-QueryDialect <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
QueryComputerSet
Remove-CimInstance
[[-Namespace] <String>]
[-Query] <String>
[-ComputerName <String[]>]
[-OperationTimeoutSec <UInt32>]
[-QueryDialect <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
This cmdlet removes a CIM instance from a CIM server. You can specify the CIM instance to remove by
using either a CIM instance object retrieved by the Get-CimInstance
cmdlet, or by specifying a
query.
If the InputObject parameter is not specified, the cmdlet works in one of the following ways:
- If neither the ComputerName parameter nor the CimSession parameter is specified, then this cmdlet works on local Windows Management Instrumentation (WMI) using a Component Object Model (COM) session.
- If either the ComputerName parameter or the CimSession parameter is specified, then this cmdlet works against the CIM server specified by either the ComputerName parameter or the CimSession parameter.
예제
Example 1: Remove the CIM instance
This example use the Query parameter to remove CIM instances from the class named Win32_Environment that start with the character string testvar .
Remove-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"'
Example 2: Remove the CIM instance using CIM instance object
This example retrieves the CIM instance objects filtered by the Query parameter and stores them
in variable named $var
using the Get-CimInstance
cmdlet. The contents of the variable are then
passed to the Remove-CimInstance
cmdlet, which removes the CIM instances.
notepad.exe
$var = Get-CimInstance -Query 'Select * from Win32_Process where name LIKE "notepad%"'
Remove-CimInstance -InputObject $var
매개 변수
-CimSession
Runs the command using the specified CIM session. Enter a variable that contains the CIM session, or
a command that creates or gets the CIM session, such as the New-CimSession
or Get-CimSession
cmdlets. For more information, see
about_CimSession.
매개 변수 속성
형식: | |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CimInstanceSessionSet
Position: | Named |
필수: | True |
파이프라인의 값: | True |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
QuerySessionSet
Position: | Named |
필수: | True |
파이프라인의 값: | True |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-ComputerName
Specifies the name of the computer on which you want to run the CIM operation. You can specify a fully qualified ___domain name (FQDN) or a NetBIOS name.
If you specify this parameter, the cmdlet creates a temporary session to the specified computer using the WsMan protocol.
If you do not specify this parameter, the cmdlet performs the operation on the local computer using Component Object Model (COM).
If multiple operations are being performed on the same computer, connecting using a CIM session gives better performance.
매개 변수 속성
형식: | String[] |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | CN, ServerName |
매개 변수 집합
CimInstanceComputerSet
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
QueryComputerSet
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
매개 변수 속성
형식: | SwitchParameter |
Default value: | False |
와일드카드 지원: | False |
DontShow: | False |
별칭: | cf |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-InputObject
Specifies a CIM instance object to be removed from the CIM server. The object passed to the cmdlet is not changed, only the instance in the CIM server is removed.
The InputObject parameter doesn't enumerate over collections. If a collection is passed, an error is thrown. When working with collections, pipe the input to enumerate the values.
매개 변수 속성
형식: | CimInstance |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | CimInstance |
매개 변수 집합
CimInstanceComputerSet
Position: | 1 |
필수: | True |
파이프라인의 값: | True |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CimInstanceSessionSet
Position: | 1 |
필수: | True |
파이프라인의 값: | True |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Namespace
Specifies the namespace for the CIM operation. The default namespace is root/CIMV2. You can use tab completion to browse the list of namespaces, because PowerShell gets a list of namespaces from the local WMI server to provide the list of namespaces.
매개 변수 속성
형식: | String |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
QuerySessionSet
Position: | 2 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
QueryComputerSet
Position: | 2 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
-OperationTimeoutSec
Specifies the amount of time that the cmdlet waits for a response from the computer. By default, the
value of this parameter is 0
, which means that the cmdlet uses the default timeout value for the
server.
If the OperationTimeoutSec parameter is set to a value less than the robust connection retry timeout of 3 minutes, network failures that last more than the value of the OperationTimeoutSec parameter are not recoverable, because the operation on the server times out before the client can reconnect.
매개 변수 속성
형식: | UInt32 |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | OT |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Query
Specifies a query to run on the CIM server. You can specify the query dialect using the QueryDialect parameter.
If the value specified contains double quotes ("
), single quotes ('
), or a backslash (\
), you
must escape those characters by prefixing them with the backslash (\
) character. If the value
specified uses the WQL LIKE
operator, then you must escape the following characters by enclosing
them in square brackets ([]
): percent (%
), underscore (_
), or opening square bracket ([
).
매개 변수 속성
형식: | String |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
QuerySessionSet
Position: | 1 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
QueryComputerSet
Position: | 1 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
-QueryDialect
Specifies the query language used for the Query parameter. The acceptable values for this parameter
are: WQL
or CQL
. The default value is WQL
.
매개 변수 속성
형식: | String |
Default value: | WQL |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
QuerySessionSet
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
QueryComputerSet
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
-ResourceUri
Specifies the resource uniform resource identifier (URI) of the resource class or instance. The URI is used to identify a specific type of resource, such as disks or processes, on a computer.
A URI consists of a prefix and a path to a resource. For example:
http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_LogicalDisk
http://intel.com/wbem/wscim/1/amt-schema/1/AMT_GeneralSettings
By default, if you do not specify this parameter, the DMTF standard resource URI
http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/
is used and the class name is appended to it.
ResourceUri can only be used with CIM sessions created using the WSMan protocol, or when specifying the ComputerName parameter, which creates a CIM session using WSMan. If you specify this parameter without specifying the ComputerName parameter, or if you specify a CIM session created using DCOM protocol, you get an error, because the DCOM protocol does not support the ResourceUri parameter.
If both the ResourceUri parameter and the Filter parameter are specified, the Filter parameter is ignored.
매개 변수 속성
형식: | Uri |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CimInstanceComputerSet
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
CimInstanceSessionSet
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
매개 변수 속성
형식: | SwitchParameter |
Default value: | False |
와일드카드 지원: | False |
DontShow: | False |
별칭: | wi |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
입력
None
You can't pipe objects to this cmdlet.
출력
None
This cmdlet returns no output.