Each folder README now has: - Quick Start section with batch file commands - Batch Launchers table listing entry points - PowerShell Scripts section for detailed documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.5 KiB
4.5 KiB
Setup & Utility Scripts
Scripts for configuring WinRM, scheduling tasks, and testing API connectivity.
Quick Start
Deploy scheduled task:
Deploy-AssetCollectionSchedule.bat
Install scheduled task locally:
Install-Schedule.bat
Batch Launchers (Entry Points)
| Batch File | Purpose |
|---|---|
Deploy-AssetCollectionSchedule.bat |
Deploy scheduled task to PCs |
Install-Schedule.bat |
Install scheduled task locally |
PowerShell Scripts
Setup-WinRM.ps1
WinRM configuration utility - Configures WinRM on the management server for remote asset collection.
What it does:
- Enables WinRM service
- Configures trusted hosts for remote connections
- Sets up HTTP listener on port 5985
- Tests connectivity to specified computers
Usage:
# Trust all hosts (less secure, simpler)
.\Setup-WinRM.ps1 -TrustedHosts "*"
# Trust specific IPs
.\Setup-WinRM.ps1 -TrustedHosts "10.48.130.100,10.48.130.101"
# Setup and test
.\Setup-WinRM.ps1 -TrustedHosts "*" -TestConnection @("10.48.130.100")
Parameters:
| Parameter | Default | Description |
|---|---|---|
-TrustedHosts |
"" |
Comma-separated list of trusted hosts |
-TestConnection |
@() |
Array of computers to test after setup |
Requires: Administrator privileges
Install-AssetCollectionSchedule.ps1
Scheduled task installer - Creates Windows scheduled task for automated asset collection.
What it does:
- Creates scheduled task running 4 times daily (6:00, 12:00, 18:00, 00:00)
- Configures silent execution (no window popup)
- Runs as SYSTEM account
- Handles battery/network conditions appropriately
Usage:
# Install with defaults
.\Install-AssetCollectionSchedule.ps1
# Custom script path
.\Install-AssetCollectionSchedule.ps1 -ScriptPath "C:\Scripts\Update-PC-CompleteAsset-Silent.bat"
Parameters:
| Parameter | Default | Description |
|---|---|---|
-ScriptPath |
S:\DT\adata\script\Update-PC-CompleteAsset-Silent.bat |
Path to batch file |
-TaskName |
"GE Asset Collection" |
Name for scheduled task |
Schedule:
- 6:00 AM
- 12:00 PM
- 6:00 PM
- 12:00 AM
Requires: Administrator privileges
Test-API-Connection.ps1
API connectivity tester - Tests connectivity and functionality of the ShopDB API.
What it does:
- Tests basic API connectivity (GET request)
- Tests INSERT operation (creates test PC record)
- Tests UPDATE operation (modifies test record)
- Tests DELETE operation (cleans up test record)
- Reports success/failure for each operation
Usage:
# Test development API
.\Test-API-Connection.ps1
# Test production API
.\Test-API-Connection.ps1 -DashboardURL "https://production-server/shopdb/api.asp"
Parameters:
| Parameter | Default | Description |
|---|---|---|
-DashboardURL |
http://192.168.122.151:8080/api.asp |
API endpoint to test |
Output Example:
========================================
ShopDB API Connection Test
========================================
Test 1: Basic API Connectivity
[OK] API is online
Message: Dashboard API ready
Version: 2.0
Schema: Phase 2
Test 2: INSERT New PC Record
[OK] PC record created successfully
Hostname: TEST-PS-1234
Machine ID: 567
Operation: insert
Test 3: UPDATE PC Record
[OK] PC record updated successfully
Test 4: DELETE Test Record
[OK] Test record cleaned up
========================================
All tests passed!
========================================
Batch File Launchers
| File | Purpose |
|---|---|
Deploy-AssetCollectionSchedule.bat |
Deploys scheduled task to multiple PCs |
Install-Schedule.bat |
Local scheduled task installation |
Requirements
- PowerShell 5.1 or later
- Administrator privileges
- Network access to ShopDB API (for Test-API-Connection.ps1)
Common Use Cases
Initial Setup on Management Server
# 1. Configure WinRM to trust all shopfloor PCs
.\Setup-WinRM.ps1 -TrustedHosts "*"
# 2. Test API connectivity
.\Test-API-Connection.ps1 -DashboardURL "https://production-server/shopdb/api.asp"
Deploy Scheduled Collection to a PC
# On each target PC (as administrator):
.\Install-AssetCollectionSchedule.ps1
Verify Everything is Working
# Test API
.\Test-API-Connection.ps1
# Check scheduled task
Get-ScheduledTask -TaskName "GE Asset Collection" | Format-List