Structure: - asset-collection/: Local PC data collection scripts - remote-execution/: WinRM remote execution scripts - setup-utilities/: Configuration and testing utilities - registry-backup/: GE registry backup scripts - winrm-https/: WinRM HTTPS certificate setup - docs/: Complete documentation Each folder includes a README with detailed documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
167 lines
4.1 KiB
Markdown
167 lines
4.1 KiB
Markdown
# Setup & Utility Scripts
|
|
|
|
Scripts for configuring WinRM, scheduling tasks, and testing API connectivity.
|
|
|
|
## Scripts
|
|
|
|
### Setup-WinRM.ps1
|
|
**WinRM configuration utility** - Configures WinRM on the management server for remote asset collection.
|
|
|
|
**What it does:**
|
|
1. Enables WinRM service
|
|
2. Configures trusted hosts for remote connections
|
|
3. Sets up HTTP listener on port 5985
|
|
4. Tests connectivity to specified computers
|
|
|
|
**Usage:**
|
|
```powershell
|
|
# 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:**
|
|
1. Creates scheduled task running 4 times daily (6:00, 12:00, 18:00, 00:00)
|
|
2. Configures silent execution (no window popup)
|
|
3. Runs as SYSTEM account
|
|
4. Handles battery/network conditions appropriately
|
|
|
|
**Usage:**
|
|
```powershell
|
|
# 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:**
|
|
1. Tests basic API connectivity (GET request)
|
|
2. Tests INSERT operation (creates test PC record)
|
|
3. Tests UPDATE operation (modifies test record)
|
|
4. Tests DELETE operation (cleans up test record)
|
|
5. Reports success/failure for each operation
|
|
|
|
**Usage:**
|
|
```powershell
|
|
# 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
|
|
```powershell
|
|
# 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
|
|
```powershell
|
|
# On each target PC (as administrator):
|
|
.\Install-AssetCollectionSchedule.ps1
|
|
```
|
|
|
|
### Verify Everything is Working
|
|
```powershell
|
|
# Test API
|
|
.\Test-API-Connection.ps1
|
|
|
|
# Check scheduled task
|
|
Get-ScheduledTask -TaskName "GE Asset Collection" | Format-List
|
|
```
|