Local data collection script that runs directly on shopfloor PCs to collect comprehensive system information and send it to the ShopDB database.
This script runs locally on individual shopfloor PCs to collect comprehensive system information and send it to the ShopDB API. Unlike the remote collection script, this script runs in the local user context, allowing it to collect additional data like mapped drives and user-specific settings.
Location: S:\dt\shopfloor\scripts\complete-asset\Update-PC-CompleteAsset.ps1
Use Cases:
Advantages over Remote Collection:
This script sends collected data to the ShopDB API:
POST /api.asp?action=updateCompleteAsset
Parameters include:
hostname, serialNumber (required)manufacturer, model, osVersionpcType - Auto-detected based on installed softwarenetworkInterfaces - JSON array of network configurationsdncConfig - DNC/FTP settings (if applicable)installedApps - Tracked applications with versionshasVnc, hasWinRM - Feature detection flagsIf a default printer is detected:
POST /api.asp?action=updatePrinterMapping
Links the PC to its default network printer in ShopDB.
POST /api.asp?action=updateInstalledApps
Updates the list of tracked applications (matched against applications.csv).
See: ShopDB API Reference for complete API documentation.
$PSVersionTable.PSVersion
The script depends on a helper file that should be in the same directory:
complete-asset/
├── Update-PC-CompleteAsset.ps1 # Main script
├── Get-ShopfloorConfig.ps1 # Helper functions (auto-loaded)
And the applications tracking file should be at:
powershell/
└── applications.csv # Application definitions
Copy the complete-asset folder to the target PC:
C:\Scripts\complete-asset\
├── Update-PC-CompleteAsset.ps1
├── Get-ShopfloorConfig.ps1
Right-click PowerShell and select "Run as administrator"
cd C:\Scripts\complete-asset
.\Update-PC-CompleteAsset.ps1
The script will display collection progress and API response:
========================================
Complete PC Asset Collection & Storage
========================================
Computer: SHOPFLOOR-PC01
Dashboard: https://production-server/shopdb/api.asp
=== STEP 1: COLLECT SYSTEM INFO ===
Collecting comprehensive system information...
System Details:
Hostname: SHOPFLOOR-PC01
Manufacturer: Dell Inc.
Model: OptiPlex 7080
Serial: ABC1234
PC Type: Shopfloor
...
=== STEP 4: SEND TO DATABASE ===
[OK] Complete asset data stored in database!
PCID: 1234
Operation: update
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
-DashboardURL |
string | No | Auto-detect | Override the API endpoint URL |
-TestConnections |
switch | No | False | Test connectivity only, no data collection |
# Navigate to script directory
cd C:\Scripts\complete-asset
# Run with default settings (auto-detects production API)
.\Update-PC-CompleteAsset.ps1
# Use development server
.\Update-PC-CompleteAsset.ps1 -DashboardURL "http://192.168.122.151:8080/api.asp"
# Use staging server
.\Update-PC-CompleteAsset.ps1 -DashboardURL "https://staging-server/shopdb/api.asp"
# Full path execution
& "C:\Scripts\complete-asset\Update-PC-CompleteAsset.ps1"
# With UNC path
& "\\server\share\scripts\Update-PC-CompleteAsset.ps1"
Before deploying widely, test that the PC can reach the API:
.\Update-PC-CompleteAsset.ps1 -TestConnections
Expected Output (Success):
=== CONNECTION TESTS ===
Skipping proxy test (not accessible from client PCs)
Testing dashboard connection...
Dashboard URL: https://production-server/shopdb/api.asp
[OK] Dashboard responded successfully
[OK] Dashboard connection working!
Expected Output (Failure):
=== CONNECTION TESTS ===
Testing dashboard connection...
Dashboard URL: https://production-server/shopdb/api.asp
[FAIL] Could not connect to dashboard
[FAIL] Dashboard connection failed
Troubleshooting Failed Connections:
ping production-server-DashboardURL "http://..."Win + R, type taskschd.msc, press EnterShopDB PC CollectionCollects PC data and sends to ShopDBpowershell.exe-ExecutionPolicy Bypass -WindowStyle Hidden -File "C:\Scripts\complete-asset\Update-PC-CompleteAsset.ps1"# Run this on target PC as administrator
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
-Argument '-ExecutionPolicy Bypass -WindowStyle Hidden -File "C:\Scripts\complete-asset\Update-PC-CompleteAsset.ps1"'
$trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay (New-TimeSpan -Minutes 5)
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries `
-StartWhenAvailable -ExecutionTimeLimit (New-TimeSpan -Hours 1)
Register-ScheduledTask -TaskName "ShopDB PC Collection" `
-Action $action -Trigger $trigger -Principal $principal -Settings $settings `
-Description "Collects PC data and sends to ShopDB"
# Run daily at 6:00 AM
$trigger = New-ScheduledTaskTrigger -Daily -At 6am
Register-ScheduledTask -TaskName "ShopDB PC Collection" `
-Action $action -Trigger $trigger -Principal $principal -Settings $settings
# List the task
Get-ScheduledTask -TaskName "ShopDB PC Collection"
# Run the task manually to test
Start-ScheduledTask -TaskName "ShopDB PC Collection"
# Check task history
Get-ScheduledTaskInfo -TaskName "ShopDB PC Collection"
Create a network share accessible to all shopfloor PCs:
\\fileserver\shopdb-scripts\
├── complete-asset\
│ ├── Update-PC-CompleteAsset.ps1
│ └── Get-ShopfloorConfig.ps1
└── applications.csv
Set permissions:
Navigate to:
Computer Configuration > Policies > Windows Settings > Scripts > Startup
Add PowerShell script:
\\fileserver\shopdb-scripts\complete-asset\Update-PC-CompleteAsset.ps1Or create a batch wrapper:
startup-collection.bat:
@echo off
REM Wait for network
ping -n 30 127.0.0.1 > nul
REM Run collection script
powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File "\\fileserver\shopdb-scripts\complete-asset\Update-PC-CompleteAsset.ps1"
On target PC:
gpupdate /force
Then restart to trigger startup script.
# Detect if last collection was within 24 hours
$logPath = "C:\Logs\CompleteAsset"
$recentLog = Get-ChildItem $logPath -Filter "*.log" |
Where-Object { $_.LastWriteTime -gt (Get-Date).AddHours(-24) }
if ($recentLog) { Write-Output "Installed" }
powershell.exe -ExecutionPolicy Bypass -File "Update-PC-CompleteAsset.ps1"
Check 1: API Response Look at script output for API errors:
[FAIL] Dashboard could not store data: Invalid hostname
Check 2: Network Connectivity
.\Update-PC-CompleteAsset.ps1 -TestConnections
Check 3: Log Files
# Find recent log files
Get-ChildItem "C:\Logs\CompleteAsset" -Recurse | Sort-Object LastWriteTime -Descending | Select -First 5
Check installed applications:
# List installed apps the script sees
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
Where-Object { $_.DisplayName } |
Select-Object DisplayName |
Sort-Object DisplayName
Verify detection criteria:
Check registry paths:
# Check 32-bit registry
Test-Path "HKLM:\SOFTWARE\GE Aircraft Engines"
# Check 64-bit registry
Test-Path "HKLM:\SOFTWARE\WOW6432Node\GE Aircraft Engines"
# List DNC settings
Get-ChildItem "HKLM:\SOFTWARE\WOW6432Node\GE Aircraft Engines\DNC" -Recurse
Check Win32_SerialPort:
Get-CimInstance -ClassName Win32_SerialPort | Select DeviceID, Description
If empty, serial ports may be virtual or use different drivers.
Check manually:
# Check registry
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" |
Where-Object { $_.DisplayName -like "*VNC*" }
# Check service
Get-Service -Name "vncserver*"
Check execution policy:
Get-ExecutionPolicy
# Should be RemoteSigned or Bypass
# Fix:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Check script signing: If policy requires signed scripts, sign the script or use:
powershell.exe -ExecutionPolicy Bypass -File "script.ps1"
| Field | Source | Example |
|---|---|---|
| Hostname | $env:COMPUTERNAME |
SHOPFLOOR-PC01 |
| Serial Number | CIM_BIOSElement | ABC1234 |
| Service Tag | CIM_BIOSElement | ABC1234 |
| Manufacturer | CIM_ComputerSystem | Dell Inc. |
| Model | CIM_ComputerSystem | OptiPlex 7080 |
| Total Physical Memory | CIM_ComputerSystem | 16.0 GB |
| Domain Role | CIM_ComputerSystem | 1 (Member Workstation) |
| OS Version | CIM_OperatingSystem | Windows 10 Enterprise |
| Last Boot Time | CIM_OperatingSystem | 2025-01-15 08:30:00 |
| Current Time Zone | Get-TimeZone | Eastern Standard Time |
| Logged In User | CIM_ComputerSystem | DOMAIN\jsmith |
| PC Type | Software Detection | Shopfloor |
| Machine No | Hostname/Registry | M0612 |
| Field | Registry Path | Example |
|---|---|---|
| Site | DNC\General\Site |
WJF |
| CNC | DNC\General\Cnc |
FANUC |
| NcIF | DNC\General\NcIF |
FOCAS2 |
| Machine No | DNC\General\MachineNo |
M0612 |
| Host Type | DNC\General\HostType |
MX |
| FTP Primary | DNC\MX\FtpHostPrimary |
10.134.50.10 |
| FTP Secondary | DNC\MX\FtpHostSecondary |
10.134.50.11 |
| Field | Source | Example |
|---|---|---|
| Registry 32-bit | Path exists check | true |
| Registry 64-bit | Path exists check | true |
| Dual Path Enabled | eFocas registry | true |
| Path 1 Name | eFocas registry | Primary |
| Path 2 Name | eFocas registry | Backup |
| Field | Source | Example |
|---|---|---|
| Interface Name | Get-NetAdapter | Ethernet0 |
| IP Address | Get-NetIPConfiguration | 10.134.50.101 |
| Subnet Mask | Get-NetIPConfiguration | 24 |
| Default Gateway | Get-NetIPConfiguration | 10.134.50.1 |
| MAC Address | Get-NetAdapter | 00-11-22-33-44-55 |
| Is DHCP | Get-NetIPConfiguration | false |
| Is Active | Get-NetAdapter | true |
| Is Machine Network | IP pattern match | false (192.168. or 100.0.0. for CMM) |
| Is Primary | IP pattern match | true (10.134.*) |
| Field | Source | Example |
|---|---|---|
| Serial Ports | Win32_SerialPort | COM1, COM2 |
| Has VNC | Registry + Service check | true |
| Default Printer FQDN | Win32_Printer | 10.80.92.53 |
| All Installed Apps | Registry (HKLM + HKU) | 127 apps |
| Tracked Applications | CSV matching | UDC v2.1, Tanium v7.4 |
The script detects PC type based on installed software in this priority order:
| Priority | Type | Detection Method |
|---|---|---|
| 1 | Dashboard | GE Aerospace Dashboard installed |
| 2 | Lobby Display | GE Aerospace Lobby Display installed |
| 3 | CMM | PC-DMIS, goCMM, or DODA software |
| 4 | Wax Trace | FormTracePak or FormStatusMonitor |
| 5 | Keyence | VR-3000, VR-5000, or VR-6000 |
| 6 | EAS1000 | GageCal or NI Software |
| 7 | Genspect | Genspect measuring software |
| 8 | Heat Treat | HeatTreat application |
| 9 | Inspection | Machine #: 0612, 0613, 0615, 8003 |
| 10 | Shopfloor | Default for domain shop PCs |
| 11 | Engineer | Has C:\Apps AND V-Drive access |
| 12 | Standard | Default for other domain PCs |
Note: Priority matters - a PC with both Dashboard and CMM software will be classified as "Dashboard".
S:\dt\shopfloor\scripts\complete-asset\
├── Update-PC-CompleteAsset.ps1 # Main script
└── Get-ShopfloorConfig.ps1 # Helper functions (REQUIRED)
Important: Both files must be in the same directory. The main script dot-sources the helper:
. "$PSScriptRoot\Get-ShopfloorConfig.ps1"
Helper script providing these functions:
| Function | Purpose |
|---|---|
Get-NetworkInterfaceConfig |
Network adapters with IsPrimary/IsMachineNetwork |
Get-SerialPortConfig |
DNC serial port settings |
Get-GERegistryInfo |
GE Aircraft Engines registry (DualPath, paths) |
Get-DNCConfig |
DNC general configuration |
Get-ShopfloorConfigurations |
Combines all above into one call |
Get-InstalledApplications |
Detects UDC/CLM processes |
Defines tracked applications for version tracking:
app_id,app_name,search_patterns
2,UDC,"Universal Data Collector"
4,CLM,"Cell Level Manager|ppdcs"
77,HeatTreat,"HeatTreat"
82,GE Aerospace Dashboard,"GE Aerospace Dashboard"
83,GE Aerospace Lobby Display,"GE Aerospace Lobby Display"
Location: S:\dt\shopfloor\scripts\applications.csv
| Feature | Local Script | Remote Script |
|---|---|---|
| Execution | On target PC | From admin workstation |
| WinRM Required | No | Yes |
| V-Drive Detection | Yes | No |
| C:\Apps Detection | Yes | Limited |
| Batch Operations | No (one PC) | Yes (many PCs) |
| User Context | Local user | WinRM context |
| Admin Rights | Needed locally | Needed remotely |