PowerShell Logo Small

Set-WmiInstance



This is the built-in help made by Microsoft for the command 'Set-WmiInstance', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 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

Creates or updates an instance of an existing Windows Management Instrumentation (WMI) class.

SYNTAX


Set-WmiInstance [-Class] <String> [[-Arguments] [<Hashtable>]] [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy |
Unchanged}] [-Authority [<String>]] [-ComputerName [<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify |
Impersonate | Delegate}] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]]
[-Namespace [<String>]] [-PutType {None | UpdateOnly | CreateOnly | UpdateOrCreate}] [-ThrottleLimit [<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-WmiInstance [-Arguments [<Hashtable>]] [-AsJob] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String>]] [-PutType {None | UpdateOnly | CreateOnly | UpdateOrCreate}] [-ThrottleLimit [<Int32>]] -InputObject <ManagementObject> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-WmiInstance [-Arguments [<Hashtable>]] [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority
[<String>]] [-ComputerName [<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}]
[-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]] [-Namespace [<String>]]
[-PutType {None | UpdateOnly | CreateOnly | UpdateOrCreate}] [-ThrottleLimit [<Int32>]] -Path <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Set-WmiInstance [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority [<String>]] [-ComputerName
[<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-InformationAction
{SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]] [-Namespace [<String>]] [-PutType {None |
UpdateOnly | CreateOnly | UpdateOrCreate}] [-ThrottleLimit [<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-WmiInstance [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority [<String>]] [-ComputerName
[<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-InformationAction
{SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]] [-Namespace [<String>]] [-PutType {None |
UpdateOnly | CreateOnly | UpdateOrCreate}] [-ThrottleLimit [<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-WmiInstance [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-Authority [<String>]] [-ComputerName
[<String[]>]] [-Credential [<PSCredential>]] [-EnableAllPrivileges] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-InformationAction
{SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-Locale [<String>]] [-Namespace [<String>]] [-PutType {None |
UpdateOnly | CreateOnly | UpdateOrCreate}] [-ThrottleLimit [<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-WmiInstance cmdlet creates or updates an instance of an existing WMI class. The created or updated instance is written to the WMI repository.


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 Set-WmiInstance, consider using the Set-CimInstance or New-CimInstance cmdlets.



<

RELATED LINKS

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

REMARKS

<

Examples


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

PS C:\>Set-WMIInstance -class Win32_WMISetting -argument @{LoggingLevel=2}

__GENUS : 2
__CLASS : Win32_WMISetting
__SUPERCLASS : CIM_Setting
__DYNASTY : CIM_Setting
__RELPATH : Win32_WMISetting=@
__PROPERTY_COUNT : 27
__DERIVATION : {CIM_Setting}
__SERVER : SYSTEM01
__NAMESPACE : root\cimv2
__PATH : \\SYSTEM01\root\cimv2:Win32_WMISetting=@
ASPScriptDefaultNamespace : \\root\cimv2
ASPScriptEnabled : False
AutorecoverMofs : {%windir%\system32\wbem\cimwin32.mof, %windir%\system32\wbem\ncprov.mof, %windir%\syst
em32\wbem\wmipcima.mof, %windir%\system32\wbem\secrcw32.mof...}
AutoStartWin9X :
BackupInterval :
BackupLastTime :
BuildVersion : 6001.18000
Caption :
DatabaseDirectory : C:\Windows\system32\wbem\repository
DatabaseMaxSize :
Description :
EnableAnonWin9xConnections :
EnableEvents : False
EnableStartupHeapPreallocation : False
HighThresholdOnClientObjects :
HighThresholdOnEvents : 20000000
InstallationDirectory : C:\Windows\system32\wbem
LastStartupHeapPreallocation :
LoggingDirectory : C:\Windows\system32\wbem\Logs\
LoggingLevel : 2
LowThresholdOnClientObjects :
LowThresholdOnEvents : 10000000
MaxLogFileSize : 65536
MaxWaitOnClientObjects :
MaxWaitOnEvents : 2000
MofSelfInstallDirectory :
SettingID :



This command sets the WMI logging level to 2. The command passes the property to be set and the value (together considered a value pair) in the argument parameter. The
parameter takes a hash table that is defined by the @{property = value} construction. The class information that is returned reflects the new value.










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

PS C:\>set-wmiinstance -class win32_environment -argument @{Name="testvar";VariableValue="testvalue";UserName="<SYSTEM>"}

__GENUS : 2
__CLASS : Win32_Environment
__SUPERCLASS : CIM_SystemResource
__DYNASTY : CIM_ManagedSystemElement
__RELPATH : Win32_Environment.Name="testvar",UserName="<SYSTEM>"
__PROPERTY_COUNT : 8
__DERIVATION : {CIM_SystemResource, CIM_LogicalElement, CIM_ManagedSystemElement}
__SERVER : SYSTEM01
__NAMESPACE : root\cimv2
__PATH : \\SYSTEM01\root\cimv2:Win32_Environment.Name="testvar",UserName="<SYSTEM>"
Caption : <SYSTEM>\testvar
Description : <SYSTEM>\testvar
InstallDate :
Name : testvar
Status : OK
SystemVariable : True
UserName : <SYSTEM>
VariableValue : testvalue



This command creates the testvar environment variable that has the value "testvalue". It does this by creating a new instance of the Win32_Environment WMI class. Note that
this operation requires appropriate credentials and that you may need to restart Windows PowerShell to see the new environment variable.










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

PS C:\>Set-WMIInstance -class Win32_WMISetting -argument @{LoggingLevel=2} -computername system01, system02, system03

__GENUS : 2
__CLASS : Win32_WMISetting
__SUPERCLASS : CIM_Setting
__DYNASTY : CIM_Setting
__RELPATH : Win32_WMISetting=@
__PROPERTY_COUNT : 27
__DERIVATION : {CIM_Setting}
__SERVER : SYSTEM01
__NAMESPACE : root\cimv2
__PATH : \\SYSTEM01\root\cimv2:Win32_WMISetting=@
ASPScriptDefaultNamespace : \\root\cimv2
ASPScriptEnabled : False
AutorecoverMofs : {%windir%\system32\wbem\cimwin32.mof, %windir%\system32\wbem\ncprov.mof, %windir%\syst
em32\wbem\wmipcima.mof, %windir%\system32\wbem\secrcw32.mof...}
AutoStartWin9X :
BackupInterval :
BackupLastTime :
BuildVersion : 6001.18000
Caption :
DatabaseDirectory : C:\Windows\system32\wbem\repository
DatabaseMaxSize :
Description :
EnableAnonWin9xConnections :
EnableEvents : False
EnableStartupHeapPreallocation : False
HighThresholdOnClientObjects :
HighThresholdOnEvents : 20000000
InstallationDirectory : C:\Windows\system32\wbem
LastStartupHeapPreallocation :
LoggingDirectory : C:\Windows\system32\wbem\Logs\
LoggingLevel : 2
LowThresholdOnClientObjects :
LowThresholdOnEvents : 10000000
MaxLogFileSize : 65536
MaxWaitOnClientObjects :
MaxWaitOnEvents : 2000
MofSelfInstallDirectory :
SettingID :
...



This command sets the WMI logging level to 2. The command passes the property to be set and the value (together considered a value pair) in the argument parameter. The
parameter takes a hash table that is defined by the @{property = value} construction. The returned class information reflects the new value.