Win32_ProcessStartup

Win32 Process Startup
root/cimv2abstract

The Win32_ProcessStartup abstract WMI class represents the startup configuration of a Windows-based process.

On this page

Main example

List instances

# Abstract class: Get-CimInstance returns the instances of its subclasses
Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -Property CreateFlags, ErrorMode, FillAttribute, PriorityClass

Abstract class: it has no instances of its own. Get-CimInstance returns the instances of its subclasses.

Examples

Decode numeric values

# Lookup table for CreateFlags (values documented by Microsoft)
$createFlagsName = @{
    1 = 'Debug_Process'
    2 = 'Debug_Only_This_Process'
    4 = 'Create_Suspended'
    8 = 'Detached_Process'
    16 = 'Create_New_Console'
    512 = 'Create_New_Process_Group'
    1024 = 'Create_Unicode_Environment'
    16777216 = 'CREATE_BREAKAWAY_FROM_JOB'
    67108864 = 'Create_Default_Error_Mode'
}
# Lookup table for ErrorMode (values documented by Microsoft)
$errorModeName = @{
    2 = 'Fail_Critical_Errors'
    4 = 'No_Alignment_Fault_Except'
    8 = 'No_GP_Fault_Error_Box'
    16 = 'No_Open_File_Error_Box'
}

Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -Property @(
        @{ Name = 'CreateFlags'; Expression = { $createFlagsName[[int]$_.CreateFlags] } }
        @{ Name = 'ErrorMode'; Expression = { $errorModeName[[int]$_.ErrorMode] } }
        'FillAttribute'
        'PriorityClass'
    )

Query a remote computer (CIM session)

review before running
# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
    Get-CimInstance -CimSession $cimSession -ClassName Win32_ProcessStartup |
        Select-Object -Property CreateFlags, ErrorMode, FillAttribute, PriorityClass
} finally {
    Remove-CimSession -CimSession $cimSession
}

WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.

Show the class structure

# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName Win32_ProcessStartup
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

Properties

14 of 14 properties
NameTypeAccessDescription
CreateFlagsuint32read/write

Additional values that control the priority class and the creation of the process. The following creation values can be specified in any combination, except as noted.

Values (9)
ValueLabelDescription
1Debug_ProcessIf this flag is set, the calling process is treated as a debugger, and the new process is being debugged. The system notifies the debugger of all debug events that occur in the process being debugged.
2Debug_Only_This_ProcessIf this flag is not set and the calling process is being debugged, the new process becomes another process being debugged. If the calling process is not a process of being debugged, no debugging-related actions occur.
4Create_SuspendedThe primary thread of the new process is created in a suspended state and does not run until the ResumeThread method is called.
8Detached_ProcessFor console processes, the new process does not have access to the console of the parent process. This flag cannot be used if the **Create_New_Console** flag is set.
16Create_New_ConsoleThis new process has a new console, instead of inheriting the parent console. This flag cannot be used with the **Detached_Process** flag.
512Create_New_Process_GroupThis new process is the root process of a new process group. The process group includes all of the processes that are descendants of this root process. The process identifier of the new process group is the same as the process identifier that is returned in the **ProcessID** property of the Win32_Process class. Process groups are used by the GenerateConsoleCtrlEvent method to enable the sending of either a CTRL+C signal or a CTRL+BREAK signal to a group of console processes.
1024Create_Unicode_EnvironmentThe environment settings listed in the **EnvironmentVariables** property use Unicode characters. If this flag is not set, the environment block uses ANSI characters.
67108864Create_Default_Error_ModeNewly created processes are given the system default error mode of the calling process instead of inheriting the error mode of the parent process. This flag is useful for multithreaded shell applications that run with hard errors disabled.
16777216CREATE_BREAKAWAY_FROM_JOBUsed for the created process not to be limited by the job object.
Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of CreateFlags for each instance
# Lookup table for CreateFlags (values documented by Microsoft)
$createFlagsName = @{
    1 = 'Debug_Process'
    2 = 'Debug_Only_This_Process'
    4 = 'Create_Suspended'
    8 = 'Detached_Process'
    16 = 'Create_New_Console'
    512 = 'Create_New_Process_Group'
    1024 = 'Create_Unicode_Environment'
    16777216 = 'CREATE_BREAKAWAY_FROM_JOB'
    67108864 = 'Create_Default_Error_Mode'
}
Get-CimInstance -ClassName Win32_ProcessStartup -Property CreateFlags |
    Select-Object -Property @(
        @{ Name = 'CreateFlags'; Expression = { $createFlagsName[[int]$_.CreateFlags] } }
    )

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes CreateFlags on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ CreateFlags = 1 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
EnvironmentVariablesstring[]read/write

List of settings for the configuration of a computer. Environment variables specify search paths for files, directories for temporary files, application-specific options, and other similar information. The system maintains a block of environment settings for each user and one for the computer. The system environment block represents environment variables for all of the users of a specific computer. A user's environment block represents the environment variables that the system maintains for a specific user, and includes the set of system environment variables. By default, each process receives a copy of the environment block for its parent process. Typically, this is the environment block for the user who is logged on. A process can specify different environment blocks for its child processes.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of EnvironmentVariables for each instance
# EnvironmentVariables is an array: -ExpandProperty returns its items one by one
Get-CimInstance -ClassName Win32_ProcessStartup -Property EnvironmentVariables |
    Select-Object -ExpandProperty EnvironmentVariables

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes EnvironmentVariables on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ EnvironmentVariables = @('Example') }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
ErrorModeuint16read/write

On some non-x86 processors, misaligned memory references cause an alignment fault exception. The No_Alignment_Fault_Except flag lets you control whether or not an operating system automatically fixes such alignment faults, or makes them visible to an application. On a millions of instructions per second (MIPS) platform, an application must explicitly call SetErrorMode with the No_Alignment_Fault_Except flag to have the operating system automatically fix alignment faults.

How an operating system processes several types of serious errors. You can specify that the operating system process errors, or an application can receive and process errors.

The default setting is for the operating system to make alignment faults visible to an application. Because the x86 platform does not make alignment faults visible to an application, the No_Alignment_Fault_Except flag does not make the operating system raise an alignment fault error—even if the flag is not set. The default state for SetErrorMode is to set all of the flags to 0 (zero).

(1)

Default

Values (4)
ValueLabelDescription
2Fail_Critical_ErrorsIf this flag is set, the operating system does not display the critical error handler message box when such an error occurs. Instead, the operating system sends the error to the calling process.
4No_Alignment_Fault_ExceptIf this flag is set, the operating system automatically fixes memory alignment faults and makes them invisible to the application. It does this for the calling and descendant processes. This flag applies to reduced instruction set computing (RISC) only, and has no effect on x86 processors.
8No_GP_Fault_Error_BoxIf this flag is set, the operating system does not display the general protection (GP) fault message box when a GP error occurs. This flag should only be set by debugging applications that handle GP errors.
16No_Open_File_Error_BoxIf this flag is set, the operating system does not display a message box when it fails to find a file. Instead, the error is returned to the calling process. This flag is currently ignored.
Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of ErrorMode for each instance
# Lookup table for ErrorMode (values documented by Microsoft)
$errorModeName = @{
    2 = 'Fail_Critical_Errors'
    4 = 'No_Alignment_Fault_Except'
    8 = 'No_GP_Fault_Error_Box'
    16 = 'No_Open_File_Error_Box'
}
Get-CimInstance -ClassName Win32_ProcessStartup -Property ErrorMode |
    Select-Object -Property @(
        @{ Name = 'ErrorMode'; Expression = { $errorModeName[[int]$_.ErrorMode] } }
    )

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes ErrorMode on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ ErrorMode = 2 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
FillAttributeuint32read/write

The text and background colors if a new console window is created in a console application. These values are ignored in graphical user interface (GUI) applications. To specify both foreground and background colors, add the values together. For example, to have red type (4) on a blue background (16), set the FillAttribute to 20.

1

Foreground_Blue

2

Foreground_Green

4

Foreground_Red

8

Foreground_Intensity

16

Background_Blue

32

Background_Green

64

Background_Red

128

Background_Intensity

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of FillAttribute for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property FillAttribute |
    Select-Object -Property FillAttribute

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes FillAttribute on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ FillAttribute = 0 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
PriorityClassuint32read/write

Priority class of the new process. Use this property to determine the schedule priorities of the threads in the process. If the property is left null, the priority class defaults to Normal—unless the priority class of the creating process is Idle or Below_Normal. In these cases, the child process receives the default priority class of the calling process.

Values (6)
ValueLabelDescription
32NormalIndicates a normal process with no special schedule needs.
64IdleIndicates a process with threads that run only when the system is idle and are preempted by the threads of any process running in a higher priority class. An example is a screen saver. The idle priority class is inherited by child processes.
128HighIndicates a process that performs time-critical tasks that must be executed immediately to run correctly. The threads of a high-priority class process preempt the threads of normal-priority or idle-priority class processes. An example is Windows Task List, which must respond quickly when called by the user, regardless of the load on the operating system. Use extreme care when using the high-priority class, because a high-priority class CPU-bound application can use nearly all of the available cycles. Only a real-time priority preempts threads set to this level.
256RealtimeIndicates a process that has the highest possible priority. The threads of a real-time priority class process preempt the threads of all other processes—including high-priority threads and operating system processes performing important tasks. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush, or cause a mouse to be unresponsive.
16384Below_NormalIndicates a process that has a priority higher than Idle but lower than Normal.
32768Above_NormalIndicates a process that has a priority higher than Normal but lower than High.
Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of PriorityClass for each instance
# Lookup table for PriorityClass (values documented by Microsoft)
$priorityClassName = @{
    32 = 'Normal'
    64 = 'Idle'
    128 = 'High'
    256 = 'Realtime'
    16384 = 'Below_Normal'
    32768 = 'Above_Normal'
}
Get-CimInstance -ClassName Win32_ProcessStartup -Property PriorityClass |
    Select-Object -Property @(
        @{ Name = 'PriorityClass'; Expression = { $priorityClassName[[int]$_.PriorityClass] } }
    )

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes PriorityClass on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ PriorityClass = 32 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
ShowWindowuint16read/write

How the window is displayed to the user. It can be any of the values that can be specified in the *nCmdShow* parameter for the ShowWindow function.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of ShowWindow for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property ShowWindow |
    Select-Object -Property ShowWindow

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes ShowWindow on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ ShowWindow = 0 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
Titlestringread/write

Text displayed in the title bar when a new console window is created; used for console processes. If NULL, the name of the executable file is used as the window title. This property must be NULL for GUI or console processes that do not create a new console window.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Title for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property Title |
    Select-Object -Property Title

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes Title on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ Title = 'Example' }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
WinstationDesktopstringread/write

The name of the desktop or the name of both the desktop and window station for the process. A backslash in the string indicates that the string includes both desktop and window station names. If WinstationDesktop is NULL, the new process inherits the desktop and window station of its parent process. If WinstationDesktop is an empty string, the process does not inherit the desktop and window station of its parent process. The system determines if a new desktop and window station must be created. A window station is a secure object that contains a clipboard, a set of global atoms, and a group of desktop objects. The interactive window station that is assigned to the logon session of the interactive user also contains the keyboard, mouse, and display device. A desktop is a secure object contained within a window station. A desktop has a logical display surface and contains windows, menus, and hooks. A window station can have multiple desktops. Only the desktops of the interactive window station can be visible and receive user input.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of WinstationDesktop for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property WinstationDesktop |
    Select-Object -Property WinstationDesktop

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes WinstationDesktop on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ WinstationDesktop = 'Example' }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
Xuint32read/write

The X offset of the upper left corner of a window if a new window is created—in pixels. The offsets are from the upper left corner of the screen. For GUI processes, the specified position is used the first time the new process calls CreateWindow to create an overlapped window if the *X* parameter of CreateWindow is CW_USEDEFAULT.

[!Note X]

and Y cannot be specified independently.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of X for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property X |
    Select-Object -Property X

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes X on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ X = 0 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
XCountCharsuint32read/write

Screen buffer width in character columns. This property is used for processes that create a console window, and is ignored in GUI processes.

Note: XCountChars and YCountChars cannot be specified independently.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of XCountChars for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property XCountChars |
    Select-Object -Property XCountChars

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes XCountChars on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ XCountChars = 0 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
XSizeuint32read/write

Pixel width of a window if a new window is created. For GUI processes, this is only used the first time the new process calls CreateWindow to create an overlapped window if the nWidth parameter of CreateWindow is CW_USEDEFAULT.

Note: XSize and YSize cannot be specified independently.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of XSize for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property XSize |
    Select-Object -Property XSize

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes XSize on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ XSize = 0 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
Yuint32read/write

Pixel offset of the upper-left corner of a window if a new window is created. The offsets are from the upper-left corner of the screen. For GUI processes, the specified position is used the first time the new process calls CreateWindow to create an overlapped window if the *y* parameter of CreateWindow is CW_USEDEFAULT.

[!Note X]

and Y cannot be specified independently.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Y for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property Y |
    Select-Object -Property Y

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes Y on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ Y = 0 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
YCountCharsuint32read/write

Screen buffer height in character rows. This property is used for processes that create a console window, but is ignored in GUI processes.

Note: XCountChars and YCountChars cannot be specified independently.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of YCountChars for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property YCountChars |
    Select-Object -Property YCountChars

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes YCountChars on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ YCountChars = 0 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
YSizeuint32read/write

Pixel height of a window if a new window is created. For GUI processes, this is used only the first time the new process calls CreateWindow to create an overlapped window if the *nWidth* parameter of CreateWindow is CW_USEDEFAULT.

Note: XSize and YSize cannot be specified independently.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of YSize for each instance
Get-CimInstance -ClassName Win32_ProcessStartup -Property YSize |
    Select-Object -Property YSize

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes YSize on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_ProcessStartup |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ YSize = 0 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters

Remarks

This class is derived from Win32_MethodParameterClass.

Overview

The Win32_Process Create method enables you to configure startup options for any new process running on a computer. For example, you can configure a process so that it starts in a "hidden" window, which prevents a user from seeing, and possibly interrupting, it. If the process runs in a command window, you can configure the size, title, and foreground and background colors of the window.

Startup options are configured using the Win32_ProcessStartup class. Win32_ProcessStartup is a Method Type class; the Method Type class exists solely to pass information to a method. In this case, all the properties of an instance of Win32_ProcessStartup are passed to an instance of Win32_Process.

Using Win32_ProcessStartup

1. Create an instance of Win32_ProcessStartup.

2. Configure the properties of the new instance.

3. Include the instance as part of the Win32_Process Create method.

For example, if you have created a Win32_ProcessStartup instance named objConfig, you would pass the object name in the Create method as follows:

errReturn = objProcess.Create("Database.exe", null, objConfig, intProcessID)

Inheritance

Superclass chain

  1. Win32_MethodParameterClass
  2. Win32_ProcessStartup

Known subclasses

No known subclass.

Requirements

Namespace
root/cimv2
Minimum client
Windows Vista
Minimum server
Windows Server 2008
MOF file
CIMWin32.mof
DLL
CIMWin32.dll
Class qualifiers

Abstract UUID("{8502C4DB-5FBB-11D2-AAC1-006008C78BC7}") AMENDMENT

Microsoft source

Source: Microsoft Learn

Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.