-
Notifications
You must be signed in to change notification settings - Fork 6
rename_workstation_manual.ps1
Corey Watson edited this page Dec 19, 2025
·
1 revision
Manually rename Windows workstation and sync to SuperOps using custom CLIENT-USERUUID pattern.
Rename a Windows device and sync the same name to SuperOps.
Naming (Windows-legal; max 15 chars; no trailing hyphen):
- CLIENT-USERUUID
- CLIENT : Custom override $YourCustomClientHere, else from $YourClientNameHere Variable length; sanitized A–Z0–9; trimmed if needed to ensure fit.
- USER : Sanitized username; maximized; truncated if needed to ensure fit.
- UUID : SMBIOS UUID tail; at least 3 chars; trimmed to fill exactly 15.
Notes:
- Only A–Z, 0–9, and hyphen used.
- Name never starts or ends with '-'.
- Always exactly 15 chars.
- SuperOps asset name is updated to match.
Rename a Windows device and sync the same name to SuperOps. Allows manual override of client segment with custom value instead of auto-generated 3-character abbreviation.
- PowerShell 5.1 or later
- Administrator privileges required
- SuperOps module available
- Internet connectivity for SuperOps API calls
- Runtime:
$YourApiKeyHere - Placeholders:
$YourAssetIdHere,$YourClientNameHere,$YourAssetNameHere - Optional:
$YourCustomClientHere(custom client segment override)
-
$SUPEROPS_API_KEY: SuperOps API key (injected at runtime) -
$CUSTOM_CLIENT_SEG_INPUT: Custom client segment override -
$SUPEROPS_SUBDOMAIN: "limehawk" (hardcoded) -
$ASSET_ID: Asset ID placeholder -
$ASSET_NAME_PLACEHOLDER: Asset name placeholder -
$CLIENT_NAME_INPUT: Client name placeholder -
$MaxUserSegmentLen: 8 (maximum username segment length) -
$MinUuidSuffixLen: 3 (minimum UUID suffix length) -
$MaxHostLen: 15 (maximum hostname length)
- Hardcoded values (SuperOps subdomain, length constraints)
- Runtime placeholders (API key, asset ID, client name, custom client override)
- System information (CIM)
- SMBIOS UUID
- SuperOps GraphQL API
- Validates SuperOps variables and system information
- Uses custom client segment if provided, else derives from client name
- Sanitizes logged-in username
- Constructs CLIENT-USERUUID hostname (exactly 15 characters)
- Checks if current hostname already matches desired name
- Renames Windows computer if needed
- Updates SuperOps asset name via GraphQL API
- Reports success or handles benign rename errors
- API key is injected at runtime, not hardcoded
- No secrets logged to console
- Uses HTTPS for SuperOps API calls
- Validates hostname format before applying
- 0: Success
- 1: Failure (validation error, API error, or rename failure)
[ SUPEROPS VARIABLES ]
--------------------------------------------------------------
AssetId (placeholder) : 12345
AssetName (placeholder) : OLD-NAME
ClientName (placeholder) : Example Client Inc
CustomClient (override) : CUSTOM
Subdomain (hardcoded) : limehawk
MaxUserSegmentLen : 8
[ RAW SYSTEM VALUES ]
--------------------------------------------------------------
ENV USERNAME : jdoe
CIM UserName : DOMAIN\jdoe
Current HostName (CIM) : OLD-HOSTNAME
SMBIOS UUID : 12345678-ABCD-EFGH-IJKL-MNOPQRSTUVWX
[ DERIVED SEGMENTS ]
--------------------------------------------------------------
CLIENT SEGMENT : CUSTOM
USER SEGMENT : JDOE
DESIRED/OS NAME : CUSTOM-JDOE1234
Name Length : 15
[ RENAME ACTION ]
--------------------------------------------------------------
CURRENT NAME(S) : OLD-HOSTNAME
STATUS : RENAMING
[ SUPEROPS UPDATE ]
--------------------------------------------------------------
Updating asset name in SuperOps...
GraphQL Success
[ RESULT ]
--------------------------------------------------------------
Status : SUCCESS
- v8.2.1 (2024-12-01) Fixed StrictMode error checking GraphQL response for errors.
- v8.2.0 (2025-08-20) Clarified README: client segment is variable length; no "CLIENT3".
- v8.1.0 (2025-08-19) Pattern CLIENT-USERUUID, min UUID=3, maximize USER, exact 15.
- v8.0.x (2025-08-19) No separators prototype, experimental.
- v7.4.1 (2025-08-19) Fixed PS5.1 syntax issues; removed ternary shorthand.
- v7.4.0 (2025-08-19) Added benign rename error handling; canonical name check.
- v7.3.x (2025-08-19) Added full README in Style A; standardized headers.
- v7.2.x (2025-08-19) Brand segment always first word; UUID always appended.
- v7.0 (2025-08-19) Introduced manual client override ($YourCustomClientHere).
- v6.x (2025-08-19) Split branch from autoname for manual override use-case.
- v5.x (2025-08-19) CLIENT/BRAND/USER baseline pattern; SuperOps sync.
- v4.x (2025-08-19) Added GraphQL mutation to update SuperOps asset.
- v3.x (2025-08-19) Introduced sanitization helpers & diagnostics.
- v1–2.x (2025-08-19) Early rename iterations (no SuperOps sync).
- View Script Source
- Scripts - Back to script index