> For the complete documentation index, see [llms.txt](https://docs.videc.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.videc.de/june5-3.7/datenquellenunterstuetzung-und-einbindung/honeywell-experion-batch-heb/zusaetze.md).

# Zusätze

Im Fehlerfall kann mit Powershell eine einfache Diagnose auf der Honeywell Datenbank ausführen werden. Powershell ist Bestandteil des Windows Betriebssystemes.

Powershell Kurz Einführung

1. Um Powershell anzuwenden ist die IDE zu starten. (Ausführen als Administrator)

C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell\_ISE.exe

{% hint style="info" %}
Es gibt die 32Bit und 64 Bit Variante!
{% endhint %}

2. Folgender Befehl muss ausgeführt werden damit die Ausführung von PS (Powerskript) erlaubt ist:

Set-ExecutionPolicy Unrestricted

Die Meldung mit "Ja" bestätigen. Windows erlaubt jetzt die Ausführung von Powerskripten.

Um die u.A. Skripte zu testen kopieren Sie den Code in eine Datei mit der Endung .ps1

Diese Datei kann dann in der Powershell Anwendung (ISE) ausgeführt werden.

<details>

<summary>Analyse der Datenbank via SQL Client Verbindung</summary>

{% code overflow="wrap" lineNumbers="true" %}

```powershell
# Powershell Skript
# Eine einfache Abfrage auf einen Honeywell Procedure Analyst SQL Server
Function Main{
# SQL Server definieren
$SQLServer = "ServerHWE"
$SQLDBName = "ProcedureAnalyst"
$uid ="Admin"
$pwd = "#june5"
# Step 1: Abfrage aller Datenbanken
$sql1 = @"
SELECT * FROM sys.databases
"@
# Step 2: Abfrage aller Ereignisse
$sql2 = @"
SELECT TOP 50
   [PROCEDURAL_ELEMENT_EXECUTION].[STARTTIME] AS [StartTime],
   [PROCEDURAL_ELEMENT_EXECUTION].[ENDTIME] AS [EndTime],
   [PROCEDURAL_ELEMENT_EXECUTION].[USERPROCEDUREID] AS [LotNumber],
   [EQUIPMENT].[FULLNAME] AS [Namespace],
   [EQUIPMENT].[NAME] AS [ItemName],
   [EQUIPMENT].[EQUIPMENTLEVELNAME] AS [EquipmentName],
   [PROCEDURAL_ELEMENT].[FULLNAME] AS [ProceduralPath],
   [PROCEDURAL_ELEMENT].[PROCEDURELEVELNAME] AS [ProceduralLevelName],
   [PROCEDURAL_ELEMENT].[PHASENAME] AS [ProceduralPhaseName],
   [PROCEDURAL_ELEMENT].[NAME] AS [ProceduralName],
   [PE_EVENTS].[CATEGORYNAME] AS [EventCategoryName],
   [PE_EVENTS].[CONDITIONNAME] AS [EventConditionName],
   [PE_EVENTS].[SUBCONDITIONNAME] AS [EventSubcondition],
   [PE_EVENTS].[SOURCE] AS [EventSource],
   [PE_EVENTS].[PRIORITY] AS [EventPriority],
   [PE_EVENTS].[VALUE] AS [EventValue],
   [PE_EVENTS].[TIMESTAMP] AS [EventTime],
   [EQ_PE_XREF].[AREANAME] AS [EventAreaName],
   [PE_EVENTS].[DESCRIPTION] AS [EventDescription],
   [PROCEDURAL_ELEMENT_EXECUTION].[PROCEDUREEXECUTIONID] AS [ProcExecutionID],
   [PROCEDURAL_ELEMENT_EXECUTION].[PARENTID] AS [ProcElExecID]
FROM
   [ProcedureAnalyst].[pa].[TPB_VW_PROC_EXEC] [PROCEDURAL_ELEMENT_EXECUTION],
   [ProcedureAnalyst].[pa].[TPB_VW_PROC] [PROCEDURAL_ELEMENT],
   [ProcedureAnalyst].[pa].[TPB_VW_EQ] [EQUIPMENT],
   [ProcedureAnalyst].[pa].[TPB_VW_EQ_PE_XREF] [EQ_PE_XREF],
   [ProcedureAnalyst].[pa].[TPB_VW_PE_EVENTS] [PE_EVENTS]
WHERE
      [EQ_PE_XREF].[EQUIPMENTID]=[PROCEDURAL_ELEMENT_EXECUTION].[EQUIPMENTID] AND
      [PE_EVENTS].[AREANAME]=[EQ_PE_XREF].[AREANAME] AND
      [PE_EVENTS].[TIMESTAMP]>=[PROCEDURAL_ELEMENT_EXECUTION].[STARTTIME] AND
      [PE_EVENTS].[TIMESTAMP]<=[PROCEDURAL_ELEMENT_EXECUTION].[ENDTIME] AND
      [PROCEDURAL_ELEMENT_EXECUTION].[PROCEDUREID]=[PROCEDURAL_ELEMENT].[PROCEDUREID] AND
      [PROCEDURAL_ELEMENT_EXECUTION].[EQUIPMENTID]=[EQUIPMENT].[EQUIPMENTID]
"@
# Step 3: Abfrage aller Batches
$sql3 = @"
SELECT TOP 10
    [TPB_VW_PROC_EXEC].[USERPROCEDUREID] AS [LotNumber]
   ,[TPB_VW_PROC_EXEC].[STARTTIME] AS [Start]
   ,[TPB_VW_PROC_EXEC].[ENDTIME] AS [End]
   ,[TPB_VW_EQ].[NAME] AS [BatchID]
   ,[TPB_VW_EQ].[FULLNAME] AS [Namespace]
   ,[TPB_VW_PROC_EXEC].[DURATION] AS [Duration]
   ,[TPB_VW_PROC_EXEC].[PROCEDUREEXECUTIONID] AS [ProductID]
   ,[TPB_VW_EQ].[EQUIPMENTLEVELNAME] AS [UnitBatchID]
FROM
   [ProcedureAnalyst].[pa].[TPB_VW_PROC_EXEC],
   [ProcedureAnalyst].[pa].[TPB_VW_PROC],
   [ProcedureAnalyst].[pa].[TPB_VW_EQ]
WHERE
   [ProcedureAnalyst].[pa].[TPB_VW_PROC_EXEC].[PROCEDUREID]=[ProcedureAnalyst].[pa].[TPB_VW_PROC].[PROCEDUREID] AND
   [ProcedureAnalyst].[pa].[TPB_VW_PROC_EXEC].[EQUIPMENTID]=[ProcedureAnalyst].[pa].[TPB_VW_EQ].[EQUIPMENTID] AND
   [ProcedureAnalyst].[pa].[TPB_VW_EQ].[EQUIPMENTLEVELNAME]= 'Unit' AND
   [ProcedureAnalyst].[pa].[TPB_VW_PROC].[PROCEDURELEVELNAME] = 'Unit Procedure'
"@
# Step 4: Abfrage einer Datenbank
$sql4 = @"
SELECT * FROM sys.databases  WHERE Name = 'ProcedureAnalyst'
"@
# Ausführen der einzelenen Steps.
MySQLData($sql1) | ft
MySQLData($sql2) | ft
MySQLData($sql3) | ft
MySQLData($sql4) | ft
}
Main
Function MySQLData($sql)
# Funktion zur Datenabfrage der SQL Daten via SQL Client Verbindung
# Integrated Security = SSPI  (Windows Authentifizierung)
# Integrated Security = false (SQL Server Authentifizierung)
{
    $conn = New-Object System.Data.SqlClient.SqlConnection
    $conn.Connectionstring = "Server = $SQLServer; Database = $SQLDBName; Integrated Security = false; User ID = $uid; Password = $pwd;"
    $conn.Open()
    $cmd = New-Object System.Data.SqlClient.SqlCommand($sql,$conn)
    $da = New-Object System.Data.SqlClient.SqlDataAdapter($cmd)
    $ds = New-Object System.Data.DataSet
    $da.Fill($ds)
    return $ds.Tables
    $conn.Close()
}
```

{% endcode %}

</details>

<details>

<summary>Analyse der Datenbank via OLE DB Client Verbindung</summary>

{% code overflow="wrap" lineNumbers="true" %}

```powershell
# Powershell Skript
# Eine einfache Abfrage auf einen Honeywell Procedure Analyst SQL Server via MSOLEDBSQL Provider
Function Main{
# Listet alle Tabellen auf
$sql1 = "SELECT * FROM sys.tables ORDER BY Name ASC"
# Listet alle Spalten einer Tabelle auf
$sql2 = "SELECT column_name FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'TPB_APPL_VERSION'"
# Listet alle Zeilen einer Tabelle auf
$sql3 = "SELECT * FROM pa.TPB_APPL_VERSION"
MySQLData($sql1) | ft # Alle Tabellen
MySQLData($sql2) | ft # Alle Spalten einer Tabelle
MySQLData($sql3) | ft # Alle Zeilen einer Tabelle
}
Main
Function MySQLData($sql)
# Funktion zur Datenabfrage der SQL Daten via MSOLEDDBSQL Provider
{
$conn = New-Object System.Data.OleDb.OleDbConnection
$conn.ConnectionString = "Provider=MSOLEDBSQL;Data Source=ServerHWE;User ID = Admin;Password = #june5;Initial Catalog=ProcedureAnalyst"
$cmd = New-Object System.Data.OleDb.OleDbCommand $sql,$conn
$conn.Open()
$adapter = New-Object System.Data.OleDb.OleDbDataAdapter $cmd
$dataset = New-Object System.Data.DataSet
$adapter.Fill($dataset)
return $dataset.Tables
$conn.Close()
}
```

{% endcode %}

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.videc.de/june5-3.7/datenquellenunterstuetzung-und-einbindung/honeywell-experion-batch-heb/zusaetze.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
