From 8e5099ad7a68fac11d7f4c8a74d449284fea9a19 Mon Sep 17 00:00:00 2001 From: Rob <32758963+JoeMama54@users.noreply.github.com> Date: Sat, 13 Apr 2024 00:26:32 -0600 Subject: [PATCH] Remove spaces from Computer Name --- FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 b/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 index f1b475b..1c8b81f 100644 --- a/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 +++ b/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 @@ -265,7 +265,7 @@ if ($Unattend -and $UnattendPrefix){ #Get serial number to append. This can make names longer than 15 characters. Trim any leading or trailing whitespace $serial = (Get-CimInstance -ClassName win32_bios).SerialNumber.Trim() #Combine prefix with serial - $computername = $PrefixToUse + $serial + $computername = ($PrefixToUse + $serial) -replace "\s","" # Remove spaces because windows does not support spaces in the computer names #If computername is longer than 15 characters, reduce to 15. Sysprep/unattend doesn't like ComputerName being longer than 15 characters even though Windows accepts it If ($computername.Length -gt 15){ $computername = $computername.substring(0,15)