What does Windows error code 1271 (ERROR_MACHINE_LOCKED) mean?

 
Previous Next
ERROR_DOWNGRADE_DETECTED ERROR_SMB_GUEST_LOGON_BLOCKED

ERROR_MACHINE_LOCKED

The locked computer cannot be shut down without forcing closure.

ERROR_MACHINE_LOCKED is Win32 error 1271 (0x4F7). Microsoft documents it for legacy shutdown behavior: when a computer is locked and InitiateSystemShutdownEx is called with forced application closure disabled, the shutdown request can fail with this code.

Why the force option matters

A locked desktop can still contain interactive applications with unsaved data. A non-forced shutdown allows those applications to participate in shutdown and potentially block it. Enabling force can bypass that protection and terminate applications, which may lose user work or leave application data inconsistent.

Evidence to capture

  • local or remote target computer and shutdown API used
  • whether applications were allowed to block and whether force was requested
  • shutdown reason code, message, timeout, and planned/unplanned classification
  • interactive session state and identities of signed-in users
  • the maintenance job, operator, or management system that initiated the request

Operational decision

Do not automatically retry with force merely because 1271 was returned. Determine whether the shutdown is urgent enough to accept possible data loss. For routine maintenance, notify users, allow sign-out, or reschedule. For emergency containment, document the justification and use the supported force option with an appropriate reason code.

Diagnostic sequence

Confirm that the code comes from the shutdown operation rather than an application-defined mapping. Enumerate active sessions through administrative tools and verify whether the machine is genuinely locked. Check for concurrent logon, logoff, or another shutdown request, because legacy systems can also return readiness and shutdown-in-progress statuses around the same time.

Developer guidance

  • make force an explicit policy choice rather than a silent retry
  • display the data-loss consequence to authorized operators
  • record the system shutdown reason and correlation ID
  • handle ERROR_NOT_READY and shutdown-in-progress results separately

Difference from other shutdown states

ERROR_SHUTDOWN_IN_PROGRESS means shutdown has already begun. ERROR_SERVER_SHUTDOWN_IN_PROGRESS describes a server that is draining. Error 1271 specifically ties refusal to the locked state and absence of a force request.

Example

A remote patch system schedules a reboot on an old server while an administrator’s desktop is locked. The non-forced call returns 1271. The maintenance policy postpones the reboot and alerts the user; an emergency workflow could instead require a privileged operator to approve forced closure explicitly.

References


Looking for a different code? Search another status or error code.