The
Win32_StartupCommand WMI class represents a command that runs automatically when a user logs onto the computer system.
The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties and methods are in alphabetic order, not MOF order.
Syntax
class Win32_StartupCommand : CIM_Setting
{
string Caption;
string Command;
string Description;
string Location;
string Name;
string SettingID;
string User;
string UserSID[];
};
Methods
The Win32_StartupCommand class does not define any methods.
Properties
The Win32_StartupCommand class defines the following properties.
- Caption
-
- Data type: string
- Access type: Read-only
Short description (one-line string) of the CIM_Setting object.
- Command
-
- Data type: string
- Access type: Read-only
- Qualifiers: Key
Command run by the startup command.
WMI obtains this data from the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Example: "c:\winnt\notepad.exe myfile.txt"
- Description
-
- Data type: string
- Access type: Read-only
Description of the CIM_Setting object.
- Location
-
- Data type: string
- Access type: Read-only
- Qualifiers: Key
Path where the startup command resides on the disk file system.
- Name
-
- Data type: string
- Access type: Read-only
- Qualifiers: Key
File name of the startup command.
Example: "FindFast"
- SettingID
-
- Data type: string
- Access type: Read-only
Identifier by which the CIM_Setting object is known.
- User
-
- Data type: string
- Access type: Read-only
- Qualifiers: Key
User name for whom this startup command will run.
Example: "mydomain\myname"
- UserSID
-
- Data type: string array
- Access type: Read-only
Security identifier (SID) of the user for whom this startup command runs. The User property can be empty but the UserSID can still have a value if the user name cannot be resolved, for example, with the case of a deleted user. This property allows distinguishing between commands associated with two different users with unresolved names. The value of UserSID may be NULL when not actually associated with a user. For example, a startup command may exist for "All Users".
Example: S-1-5-21-1579938362-1064596589-3161144252-1006
Remarks
The
Win32_StartupCommand class is derived from CIM_Setting.
The calling process that uses this class must have the SE_RESTORE_NAME privilege on the computer in which the registry resides. For example, if you enumerate this class on the local computer, the account under which your application runs must have this privilege. For more information, see Executing Privileged Operations.
You can change the registry values where Win32_StartupCommand obtains data by calling the WMI System Registry Provider methods in script or in C++. For more information, see Modifying the System Registry and WMI Registry Classes.
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
For C++ code examples, see WMI C++ Application Examples.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| MOF | Cimwin32.mof |
| DLL | Cimwin32.dll |
| Namespace | \root\cimv2 |
See Also
- Operating System Classes
Send comments about this topic to Microsoft
Build date: 11/3/2009