PowerShell Logo Small

Invoke-WmiMethod



This is the built-in help made by Microsoft for the command 'Invoke-WmiMethod', in PowerShell version 4 - as retrieved from Windows version 'Microsoft Windows 8.1 Enterprise' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Calls Windows Management Instrumentation (WMI) methods.

SYNTAX


Invoke-WmiMethod [-Class] <String> [-Name] <String> [[-ArgumentList] <Object[]>] [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity
| PacketPrivacy | Unchanged}] [-Authority <String>] [-ComputerName <String[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymo
us | Identify | Impersonate | Delegate}] [-Locale <String>] [-Namespace <String>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Invoke-WmiMethod [-Name] <String> [-ArgumentList <Object[]>] [-AsJob] [-ThrottleLimit <Int32>] -InputObject <ManagementObject> [-Confirm] [-WhatIf] [<CommonParameters
>]
Invoke-WmiMethod [-Name] <String> [-ArgumentList <Object[]>] [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | U
nchanged}] [-Authority <String>] [-ComputerName <String[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impe
rsonate | Delegate}] [-Locale <String>] [-Namespace <String>] [-ThrottleLimit <Int32>] -Path <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Invoke-WmiMethod [-Name] <String> [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority <Str
ing>] [-ComputerName <String[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-Loca
le <String>] [-Namespace <String>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Invoke-WmiMethod [-Name] <String> [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority <Str
ing>] [-ComputerName <String[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-Loca
le <String>] [-Namespace <String>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Invoke-WmiMethod [-Name] <String> [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority <Str
ing>] [-ComputerName <String[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-Loca
le <String>] [-Namespace <String>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Invoke-WmiMethod cmdlet calls the methods of WMI objects.


New CIM cmdlets, introduced Windows PowerShell 3.0, perform the same tasks as the WMI cmdlets. The CIM cmdlets comply with WS-Management (WSMan) standards and with th
e Common Information Model (CIM) standard, which enables the cmdlets to use the same techniques to manage Windows computers and those running other operating systems.
Instead of using Invoke-WmiMethod, consider using Invoke-CimMethod.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=290507
Get-WSManInstance
Invoke-WSManAction
New-WSManInstance
Remove-WSManInstance
Get-WmiObject
Remove-WmiObject
Set-WmiInstance

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>([wmiclass]'Win32_Volume').GetMethodParameters('Format')
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 6
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ClusterSize : 0
EnableCompression : False
FileSystem : NTFS
Label :
QuickFormat : False
Version : 0
PSComputerName :



To invoke WMI in PowerShell 3.0 differs from alternate methods, and requires that object values are entered in a specific order. This command lists the required order
of the objects.




-------------------------- EXAMPLE 2 --------------------------

PS C:\>([Wmiclass]'Win32_Process').GetMethodParameters('Create')
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 3
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
CommandLine :
CurrentDirectory :
ProcessStartupInformation :
PSComputerName :PS C:\>invoke-wmimethod -path win32_process -name create -argumentlist notepad.exe
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 2
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ProcessId : 11312
ReturnValue : 0
PSComputerName :



The following two commands start an instance of Notepad by calling the Create method of the Win32_Process class.

Note: The ReturnValue property is populated with a 0, and the ProcessId property is populated with an integer (the next process ID number) if the command is completed
.





-------------------------- EXAMPLE 3 --------------------------

PS C:\>invoke-wmimethod -path "CIM_DataFile.Name='C:\scripts\test.txt'" -Name Rename -ArgumentList "C:\scripts\test_bu.txt"
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 0



This command renames a file. It uses the Path parameter to reference an instance of the CIM_DataFile class. Then, it applies the Rename method to that particular inst
ance.

Note: The ReturnValue property is populated with a 0 if the command is completed.