Reset_wincc.vbs PCS 7 OS Download: Root Cause and Recovery

David Krause13 min read
SiemensTroubleshootingWinCC
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Problem Summary: PCS 7 OS Download Blocked by "Target System Active" State

On a PCS 7 V6.1 SP4 system configured with redundant Operator Stations (OS), an engineer attempted to download OS changes from the Engineering Station (ES) to the OS server pair. The download was rejected with the condition "the target system was active." This state persisted even after the engineer performed the standard recovery actions:

  • Closing the WinCC Explorer on the affected OS server
  • Shutting down and rebooting both OS servers
  • Rebooting the Engineering Station

Only after invoking reset_wincc.vbs from the affected OS server did the OS download succeed. This article documents the exact behavior of reset_wincc.vbs, the relationship with CCCleaner.xml, and the field-proven recovery sequence for this class of PCS 7 OS fault.

Root Cause: Stale WinCC Process Holding the Project Lock

The "target system is active" error during an OS change download is generated by WinCC when the runtime database, archive database, or message services on the target server report that the project is loaded and running. In a redundant OS pair, the lock can be held by several process categories:

  • A user-mode WinCC Explorer process that did not release its handle to the runtime project file
  • A hung archive subsystem instance holding an exclusive write lock on the archive database
  • An orphaned child process spawned by a previous runtime load that the service control manager (SCM) did not cleanly terminate
  • A non-service executable started by a startup entry that re-creates the lock before WinCC is fully initialized

A standard Windows reboot of the OS server normally releases these handles because the SCM stops WinCC services in dependency order. When the lock survives a full reboot — as in the reported incident — the lock is being re-acquired by a process that the standard shutdown sequence does not address. reset_wincc.vbs addresses this gap by walking the explicit process catalog defined in CCCleaner.xml and terminating every entry in a controlled sequence.

Important: The script is not an SQL-level operation. The SQL-level symptom of "target system is active" is a downstream effect of the runtime process holding a lock on the project database file. Terminating the process releases the lock; the database itself is not modified.

What reset_wincc.vbs Actually Executes

reset_wincc.vbs is a Windows Script Host (WSH) VBScript file shipped with the SIMATIC WinCC / PCS 7 installation. Its function is narrow and explicit:

  1. Reads the process catalog from CCCleaner.xml (the WinCC Cleanup configuration file).
  2. Iterates each <process> entry in the catalog.
  3. Invokes a graceful shutdown signal first; if the process does not exit within a defined timeout, it issues a forced termination.
  4. Stops the WinCC service group in the correct dependency order so that, for example, the archive subsystem is halted before SQL Server for the WinCC project database.

The script takes no command-line parameters and produces no GUI feedback. Execution completes silently apart from a brief command-window flash and entries in the Windows Application log.

Do not manually edit CCCleaner.xml. The file is parsed by reset_wincc.vbs and any malformed entry will cause the script to abort mid-iteration, leaving the OS in a partially-cleaned state that is harder to recover from than the original fault.

CCCleaner.xml Structure and Process Catalog

CCCleaner.xml lives in the WinCC installation directory, typically C:\Program Files\Siemens\Automation\WinCC\bin or the PCS 7 equivalent path. The file lists every executable that the cleanup utility recognizes as part of the WinCC runtime. In a full PCS 7 V6.1 SP4 install, the printed list is approximately three pages of process names, covering the following functional groups:

Functional Group Representative Processes Role in OS Download Lock
WinCC Core Runtime WinCCExplorer.exe, PDLRT.exe, CCEServer.exe Hold project file handles; primary lock holders
Archive Subsystem CCArchiveServer.exe, CCWriteArchiveServer.exe Open archive DBs in exclusive mode during runtime
Messaging / Alarm CCMessageServer.exe, CCAlg.exe, CCMsgQueue.exe Hold message queue locks that block project switch
Redundancy CCRedundancyServer.exe, CCPartner.exe Maintain partner connection state; prevent graceful failover
Web Navigator / DataMonitor CCWebServer.exe, CCPubCenter.exe Cache clients holding read locks
SQL Server (WinCC instance) sqlservr.exe (WinCC instance only) Host the runtime project database; not modified by the script

The exact executable names and the catalog length are version-dependent. PCS 7 V6.1 SP4 uses the legacy CC process naming; V7.x and V8.x rename several components but the cleanup mechanism is functionally unchanged.

Step-by-Step Recovery Procedure

Use this procedure only when the standard "Close WinCC Explorer → redownload" path fails and the error "the target system is active" persists.

  1. Confirm the ES download is staged. In WinCC Explorer on the ES, verify the project state is "Compiling" complete and the change list is ready. Do not initiate the download until step 6.
  2. Identify the master server. On the redundant pair, determine which server currently holds the master role. The error is almost always raised against the master. The standby server will accept the download only after a switchover.
  3. Stop user activity on the target server. Disconnect any WinCC clients (standard or WebNavigator) that may be holding read locks. In the OS project editor, verify active clients via Tools → WinCC Explorer → Computer → Runtime Properties.
  4. Run reset_wincc.vbs on the locked server.
    cscript "C:\Program Files\Siemens\Automation\WinCC\bin\reset_wincc.vbs"
    Run the script from an elevated command prompt. Allow up to 60 seconds for the script to complete; the runtime depends on the number of catalog entries and the responsiveness of the target processes.
  5. Verify the process list is clean. Open Task Manager and confirm that no CC* process, no PDLRT.exe, and no sqlservr.exe instance bound to the WinCC project database is still running. If a process remains, wait 10 seconds and re-check; do not terminate SQL Server manually.
  6. Retry the OS download from the ES. In WinCC Explorer on the ES, select the OS server target and trigger the change download. The "target system is active" condition should clear because the process-level lock has been released.
  7. Re-verify redundancy state. Once the download completes, open the redundancy diagnostics on both OS servers and confirm the partner connection is "Connected" and the role (Master/Standby) is correctly assigned.

Alternative Recovery Methods (in Order of Preference)

Before resorting to reset_wincc.vbs, attempt the following less invasive methods. The script is an emergency tool and should be used only when the standard path is exhausted.

Priority Method What It Clears When It Fails
1 Close WinCC Explorer on the target server User-mode lock from a running Explorer session When a service-level process is the lock holder
2 Use the WinCC Project Stopper or the Stop Runtime command from WinCC Explorer All WinCC services in dependency order via the configured service shutdown When the service itself is hung and Stop Runtime hangs
3 Stop the SIMATIC WinCC service group via services.msc Same as method 2 but from the SCM directly When the dependency chain is broken by a process not registered as a service
4 Reboot the OS server All non-kernel locks, including orphaned service children When a respawn-on-startup entry re-creates the lock before WinCC is fully initialized (the reported case)
5 Run reset_wincc.vbs Every process in the CCCleaner.xml catalog, including non-service children Rarely; mainly when the catalog itself is corrupted
6 Manual taskkill against the CC* and PDLRT processes Same as method 5 but operator-driven; risk of leaving WinCC services in a bad state Should be the last resort before a clean reinstallation of the project
Field-proven note: A reboot that fails to clear the lock typically indicates a third-party utility (backup agent, antivirus real-time scanner, or UPS monitoring service) is holding a handle on the WinCC project files. Run Sysinternals handle.exe or openfiles /query on the locked file to identify the offending process before the next maintenance window.

Verification: Confirm the Lock Is Released

After the script completes, perform the following checks in order. Each must pass before proceeding to the next:

  1. Process check. Task Manager shows zero entries for PDLRT.exe, CC*, and any WinCC-instance sqlservr.exe.
  2. Service check. services.msc shows the SIMATIC WinCC service group in Stopped state. The SQL Server (WINCC) service may still be Running — this is normal; do not stop it.
  3. File handle check. The WinCC project file (<OS_Project>.MCP) and the runtime project database files are not held open. Use openfiles /query /v | findstr "<OS_Project>" to confirm.
  4. Download check. From the ES, the OS change download completes without the "target system is active" prompt.
  5. Redundancy check. After the download, both servers re-establish their partner connection and the master/standby roles are correct.

Safety Constraints and Operational Guardrails

Because reset_wincc.vbs terminates processes without grace, the following constraints must be observed:

  • Do not run the script while the process is in mid-write of an archive segment. Forcing a termination can leave an archive segment in an inconsistent state. Schedule the script during a planned maintenance window, or after stopping user activity.
  • Do not run the script on a Master server while the Standby is still online. The redundancy protocol will detect the master's loss of state and trigger an uncontrolled failover. Perform a manual switchover first, or stop the Standby's redundancy service briefly to prevent the failover.
  • Do not run the script on a server that is the active node for any PCS 7 batch or route control execution. Batch master role and route control master role must be released before termination.
  • Always verify the SQL Server (WINCC) instance is healthy after the script. If the script terminates the SQL Server process itself (catalog-dependent), restart the SQL Server service manually and confirm the WinCC databases attach cleanly.

Process-Level Detail: Observable Behavior at Runtime

For the field engineer who needs to predict the impact of running reset_wincc.vbs, here is the observable behavior at the process level for each functional group:

Process Group Signal Sent First Observable Side Effect
WinCC Explorer / PDLRT WM_CLOSE to top-level window Any unsaved view configuration is discarded; runtime graphics close
Archive Server Service stop via SCM Active archive segment is flushed; segment counter increments by 1
Message / Alarm Service stop via SCM Pending acknowledged alarms remain in the database; unacknowledged alarms may be lost from the in-memory queue
Redundancy Service stop via SCM Partner connection is dropped; standby server reports "Partner not reachable"
Web Navigator / DataMonitor Service stop via SCM Active web client sessions are terminated; user receives a session timeout
SQL Server (WINCC instance) Service stop via SCM (catalog-dependent) Database enters shutdown; attach cycle required on restart

The grace period before a force-terminate is embedded in the script itself and is not user-configurable through command-line parameters. Customizing the timing requires editing the script (not recommended) or modifying the corresponding catalog entry in CCCleaner.xml (also not recommended).

Why a Reboot Does Not Clear the Lock

The incident report states that a full server reboot did not release the lock. The mechanism is well-understood in PCS 7 V6.x and applies to V7.x / V8.x with the same root cause:

  1. During shutdown, the Windows Service Control Manager sends SERVICE_STOP to the SIMATIC WinCC service group.
  2. The WinCC service group depends on SQL Server (WINCC instance), and the SQL dependency is correctly honored: SQL stops last.
  3. However, the catalog entry for the SQL Server process in CCCleaner.xml can race with the service stop: if the SQL stop is delayed, the script (or the SCM) may force-terminate sqlservr.exe mid-shutdown, leaving a half-attached database.
  4. On the next boot, the SQL service starts in recovery mode, and during recovery, the WinCC project database is opened in exclusive mode. This exclusive open is what blocks the OS download even though the user-mode WinCC processes are not running.

The recovery action in this case is to allow SQL Server to complete its recovery cycle (the duration is proportional to the size of the project database and the volume of pending transactions), then re-attempt the OS download. reset_wincc.vbs is effective here because the script's process termination order respects the SQL dependency, avoiding the force-terminate race that the SCM-initiated shutdown may not handle cleanly.

When the Script Does Not Help

There are documented cases where reset_wincc.vbs does not clear the "target system is active" error:

  • The lock is on the archive database, not the runtime project. If the archive MDF/LDF files are held by a third-party backup or replication process, the script will not touch that process. Identify the holder with openfiles or Process Monitor and resolve at that level.
  • The lock is on the WinCC project file in the ES path, not the OS path. The OS download first stages the change in the ES project directory; if that directory is locked (e.g., by an antivirus scan), the download fails before reaching the OS server. Run the script on the ES, not the OS server, in this case.
  • The lock is on the OPC UA / OPC DA gateway. Modern WinCC versions register OPC gateway processes separately; older versions of CCCleaner.xml may not include them.
  • The catalog is corrupted. Restore CCCleaner.xml from the WinCC installation media before retrying.

Logging and Post-Event Diagnostics

For each invocation of reset_wincc.vbs, the following log artifacts are produced and should be collected for post-incident review:

  • Windows Event Log → Application log. Each terminated process produces a 7034 (service) or 1015 (WinCC) entry.
  • WinCC diagnostic files. <OS_Project>_<Computer>_Diagnostic.log in the WinCC project directory records the shutdown sequence.
  • SQL Server ERRORLOG. If SQL was force-terminated, the next startup logs a "Recovery completed" entry with the elapsed time; cross-reference this with the event log to confirm clean shutdown.
  • Custom reset_wincc.vbs log. The script writes a session log to %TEMP%\reset_wincc_<timestamp>.log; capture this before it is rotated.

FAQ

Does reset_wincc.vbs modify the WinCC SQL database?

No. The script only terminates processes defined in CCCleaner.xml. It does not run any SQL commands, truncate tables, or alter the project database. The SQL-level symptom of "target system is active" is a downstream effect of the runtime process holding a lock on the project file, and that lock is released when the script terminates the process — not by modifying the database.

Why did a full server reboot not clear the "target system is active" state?

On PCS 7 V6.1 SP4, the SIMATIC WinCC service shutdown can race with the SQL Server stop. If SQL Server is force-terminated mid-recovery, it re-opens the WinCC project database in exclusive mode on the next boot, blocking the OS download even though the user-mode WinCC processes are not running. reset_wincc.vbs handles this case by stopping processes in the dependency order defined in CCCleaner.xml, avoiding the race.

Is it safe to edit CCCleaner.xml to add or remove processes?

No. The file is parsed by reset_wincc.vbs, and any malformed entry causes the script to abort mid-iteration, leaving the OS in a partially-cleaned state. If a process is missing from the catalog and you need it terminated, use Task Manager or taskkill directly and then report the gap to Siemens support so the catalog can be updated in a future WinCC service pack.

On which server should reset_wincc.vbs be run — the master, the standby, or both?

Run it on the server that holds the lock. In a redundant pair, the "target system is active" error is almost always raised against the master, so start there. If the error persists after running on the master, run it on the standby. Do not run it on both servers simultaneously — that will cause both partners to lose state and produce a split-brain condition that requires manual intervention to resolve.

Can reset_wincc.vbs be run during a live process operation?

It can, but it should not be. The script terminates processes without grace, which can corrupt in-flight archive writes, drop unacknowledged alarms from the in-memory queue, and trigger an uncontrolled redundancy failover. Always schedule the script during a planned maintenance window, or at minimum after stopping all batch / route control master activity and disconnecting WinCC clients.

Back to blog