PowerShell Logo Small

Invoke-WmiMethod



This is the built-in help made by Microsoft for the command 'Invoke-WmiMethod', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' 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 <AuthenticationLevel>] [-Authority
<String>] [-ComputerName <String[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-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 <AuthenticationLevel>] [-Authority <String>]
[-ComputerName <String[]>] [-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-Locale <String>]
[-Namespace <String>] [-ThrottleLimit <Int32>] -Path <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Invoke-WmiMethod [-Name] <String> [-AsJob] [-Authentication <AuthenticationLevel>] [-Authority <String>] [-ComputerName <String[]>]
[-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-Locale <String>] [-Namespace <String>]
[-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Invoke-WmiMethod [-Name] <String> [-AsJob] [-Authentication <AuthenticationLevel>] [-Authority <String>] [-ComputerName <String[]>]
[-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-Locale <String>] [-Namespace <String>]
[-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Invoke-WmiMethod [-Name] <String> [-AsJob] [-Authentication <AuthenticationLevel>] [-Authority <String>] [-ComputerName <String[]>]
[-Credential <PSCredential>] [-EnableAllPrivileges] [-Impersonation <ImpersonationLevel>] [-Locale <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 the 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/?LinkID=113346
Get-WmiObject
Remove-WmiObject
Set-WmiInstance
Get-WSManInstance
Invoke-WSManAction
New-WSManInstance
Remove-WSManInstance

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')invoke-wmimethod -path win32_process -name create -argumentlist notepad.exe

PS C:\Users\UserName> ([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:\Users\UserName> wmi getHelp



This command starts 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 instance.

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