Script Overview

This PowerShell script automatically renames computers based on company standards and user information. Ideal for Entra-joined devices, as the UPN is used as a variable.

Key Components

  • Configuration: sets company prefix and log file location.
  • Logging: timestamp-based logging.
  • OS validation: checks that this is not a server OS.
  • Device type: automatically determines laptop vs desktop (battery presence).
  • Naming logic: ABC-JDOE-L## - company prefix, up to 5 UPN chars, device type (L/D), random 10–99.
  • Safety checks: verifies no pending rename operations.

Format

ABC-JDOE-L##

  • ABC - company prefix
  • JDOE - first 5 characters of the username
  • L or D - laptop or desktop
  • ## - random number 10–99