Export (0) Print
Expand All
17 out of 29 rated this helpful - Rate this topic

winmgmt

Winmgmt is the WMI service within the SVCHOST process running under the LocalSystem account. In all cases, the WMI service automatically starts when the first management application or script requests connection to a WMI namespace. For more information, see Starting and Stopping the WMI Service.

When run from the command prompt, the WMI service has the following switches.


winmgmt 
  [/backup <filename>] 
  [/restore <filename> <mode>] 
  [/resyncperf <winmgmt service process id>] 
  [/standalonehost <level>]
  [/sharedhost]
  [/verifyrepository <path>]
  [/salvagerepository] 
  [/resetrepository]

Switches

TermDescription

/backup <filename>

Causes WMI to back up the repository to the specified file name. The filename argument should contain the full path to the file location. This process requires a write lock on the repository so that write operations to the repository are suspended until the backup process is completed.

/restore <filename> <flag>

Manually restores the WMI repository from the specified backup file. The filename argument should contain the full path to the backup file location. To perform the restore operation, WMI saves the existing repository to write back if the operation fails. Then the repository is restored from the backup file that is specified in the filename argument. If exclusive access to the repository cannot be achieved, existing clients are disconnected from WMI.

The flag argument must be a 1 (force — disconnect users and restore) or 0 (default — restore if no users connected) and specifies the restore mode.

/resyncperf <winmgmt-service-process-id>

Registers the system performance libraries with WMI.

/standalonehost [<level>]

Moves the Winmgmt service to a standalone Svchost process that has a fixed DCOM endpoint. The default endpoint is "ncacn_ip_tcp.0.24158". However, the endpoint may be changed by running Dcomcnfg.exe. For more information about setting up a fixed port for WMI, see Setting Up a Fixed Port for WMI.

The level argument is the authentication level for the Svchost process. WMI normally runs as part of a shared service host and you cannot increase the authentication level for WMI alone. If level is not specified, the default is 4 (RPC_C_AUTHN_LEVEL_PKT or WbemAuthenticationLevelPkt).

You can run WMI more securely by increasing the authentication level to Packet Privacy (RPC_C_AUTHN_LEVEL_PKT_PRIVACY or WbemAuthenticationLevelPktPrivacy). The authentication levels for Visual Basic and scripting are described in WbemAuthenticationLevelEnum. For C++, see Setting the Default Process Security Level Using C++. For more information, see Maintaining WMI Security.

Windows Server 2003 and Windows XP:  This switch is not available.

/sharedhost

Moves the Winmgmt service into the shared Svchost process.

Windows Server 2003 and Windows XP:  This switch is not available.

/verifyrepository <path>

Performs a consistency check on the WMI repository. When you add the /verifyrepository switch without the <path> argument, then the live repository currently used by WMI is verified. When you specify the path argument, you can verify any saved copy of the repository. In this case, the path argument should contain the full path to the saved repository copy. The saved repository should be a copy of the entire repository folder. For more information about errors returned by this command, see the Remarks section.

Windows Server 2003 and Windows XP:  This switch is not available.

/salvagerepository

Performs a consistency check on the WMI repository, and if an inconsistency is detected, rebuilds the repository. The content of the inconsistent repository is merged into the rebuilt repository, if it can be read. The salvage operation always works with the repository that the WMI service is currently using. For more information about errors returned by this command, see the Remarks section.

% MOF files that contain the #pragma autorecover preprocessor statement are restored to the repository.

Windows Server 2003 and Windows XP:  This switch is not available.

/resetrepository

The repository is reset to the initial state when the operating system is first installed. MOF files that contain the #pragma autorecover preprocessor statement are restored to the repository.

Windows Server 2003 and Windows XP:  This switch is not available.

 

Obsolete Switches

TermDescription

/exe

Causes Winmgmt.exe to run as an application rather than as a service. The primary use of the /exe switch is to allow you to debug providers more easily. When the /exe switch is used, Winmgmt.exe is run in the user security context. Normally, WMI should run as a service. Using this switch places an icon in the taskbar.

/kill

Terminates all Winmgmt.exe processes on the local system, including WMI processes started as a service by the Service Control manager or invoked by using the /exe switch. You must have administrative rights to use this switch.

Windows Vista and Windows Server 2008:  This switch is not available. Instead use net stop wmiapsrv and net stop winmgmt at the command prompt.

Windows Server 2003 and Windows XP:  This switch is available.

/clearadap

The ADAP process is not available starting in Windows Vista. The Performance Counter Classes are created by the WMIPerfClass Provider and data is supplied by the WMIPerfInst Provider. Be aware that you can still use the wmiadap command for certain performance counter operations. For more information, see wmiadap.

Windows Server 2003 and Windows XP:   Removes all of the ADAP information from the registry, effectively resetting the state of each performance library. The ADAP utility stores state information about the system performance libraries in the registry.

/unregserver

Removes registry entries added through the self-registration process and should rarely be used.

Windows Vista and Windows Server 2008:  This switch is not available. Instead use regsvr32 -u wmisvc.dll at the command prompt.

Windows Server 2003 and Windows XP:  This switch is available.

/regserver

Registers the Windows Management Service, adding entries to the operating system registry. The /regserver switch should be implemented by any .exe server.

Windows Vista and Windows Server 2008:  This switch is not available. Instead use regsvr32 wmisvc.dll at the command prompt.

Windows Server 2003 and Windows XP:  This switch is available.

 

Remarks

The WMI repository, also known as the CIM repository, is not just a single file, but a collection of files within the Repository folder that work together as a database. When you use the /backup switch to backup the repository, the resulting backup is a single compressed file.

WMI returns the error ERROR_INTERNAL_DB_CORRUPTION (net helpmsg 1358) if a verification operation indicates that the repository is not in a consistent state. This error can be returned from any command which performs repository verification, such as /verifyrepository or /salvagerepository.

Note  If WMI returns error messages, be aware that they may not indicate problems in the WMI service or in WMI providers. Failures can originate in other parts of the operating system and emerge as errors through WMI. Under any circumstances, do not delete the WMI repository as a first action because deleting the repository can cause damage to the system or to installed applications.

For more information about the source of the problem, download and run the WMI Diagnosis Utility diagnostic command line tool. This tool produces a report that can usually isolate the source of the problem and provide instructions on how to fix it. The report also aids Microsoft support services in assisting you. You can download the WMI Diagnosis Utility.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

See also

WMI Troubleshooting
Connecting to WMI Remotely Starting with Vista

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.