Skip to content

Instantly share code, notes, and snippets.

@FH-Inway
Created June 19, 2022 11:37
Show Gist options
  • Save FH-Inway/a1eba50d65331a484ff892dc25683291 to your computer and use it in GitHub Desktop.
Save FH-Inway/a1eba50d65331a484ff892dc25683291 to your computer and use it in GitHub Desktop.
Rename-D365ComputerName with invalid -NewName issue
PS C:\> Rename-D365ComputerName -NewName d365fo.tools -ShowOriginalProgress -Verbose
VERBOSE: [03:46:00][Rename-D365ComputerName] Testing for elevated runtime
VERBOSE: [03:46:00][Rename-D365ComputerName] Renaming computer to d365fo.tools
Rename-Computer : Skip computer 'MININT-57EHFHJ' with new name 'd365fo.tools' because the new name is not valid. The
new computer name entered is not properly formatted. Standard names may contain letters (a-z, A-Z), numbers (0-9), and
hyphens (-), but no spaces or periods (.). The name may not consist entirely of digits, and may not be longer than 63
characters.
At line:109 char:5
+ Rename-Computer -NewName $NewName -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (d365fo.tools:String) [Rename-Computer], InvalidOperationException
+ FullyQualifiedErrorId : InvalidNewName,Microsoft.PowerShell.Commands.RenameComputerCommand
VERBOSE: [03:46:00][Rename-D365ComputerName] Renaming local server name inside SQL Server to d365fo.tools
VERBOSE: [03:46:00][Test-TrustedConnection] Capabilities based on the centralized logic in the psm1 file.
VERBOSE: [03:46:00][Get-SQLCommand] Building the SQL connection string.
VERBOSE: [03:46:00][Get-SQLCommand] Building the SQL connection string.
VERBOSE: [03:46:00][Rename-D365ComputerName] Setting SSRS Reporting server database server to localhost
VERBOSE: [03:46:00][Invoke-Process] Starting the rsconfig.exe
VERBOSE: [03:46:00][Invoke-Process] Waiting for the rsconfig.exe to complete
Report Server WMI Provider error:
Invalid namespace
VERBOSE: [03:46:00][Invoke-Process] Standard output was: \r\n
VERBOSE: [03:46:00][Invoke-Process] Total time spent inside the function was 00:00:00.2187554
[03:46:00][Rename-D365ComputerName] Computer has been renamed. Please restart the computer to make sure that all changes are being applied correctly.
PS C:\> Rename-D365ComputerName -NewName d365fo-tools -ShowOriginalProgress -Verbose
VERBOSE: [03:57:25][Rename-D365ComputerName] Testing for elevated runtime
VERBOSE: [03:57:25][Rename-D365ComputerName] Renaming computer to d365fo-tools
WARNING: The changes will take effect after you restart the computer MININT-57EHFHJ.
VERBOSE: [03:57:25][Rename-D365ComputerName] Renaming local server name inside SQL Server to d365fo-tools
VERBOSE: [03:57:25][Test-TrustedConnection] Capabilities based on the centralized logic in the psm1 file.
VERBOSE: [03:57:25][Get-SQLCommand] Building the SQL connection string.
[03:57:25][Rename-D365ComputerName] Something went wrong while working against the database. | Exception calling "ExecuteNonQuery" with "0" argument(s): "The server 'MININT-57EHFHJ' does not exist. Use sp_helpserver to show available servers.
The server 'd365fo-tools' already exists."
WARNING: [03:57:25][Rename-D365ComputerName] Stopping because of errors. | Something went wrong while working against
the database.
PS C:\Repositories\GitHub\FH-Inway\d365fo.tools> Rename-D365ComputerName -NewName d365fo-tools -ShowOriginalProgress -Verbose -DatabaseServer localhost
VERBOSE: [04:03:02][Rename-D365ComputerName] Testing for elevated runtime
VERBOSE: [04:03:02][Rename-D365ComputerName] Renaming computer to d365fo-tools
WARNING: The changes will take effect after you restart the computer MININT-57EHFHJ.
VERBOSE: [04:03:02][Rename-D365ComputerName] Renaming local server name inside SQL Server to d365fo-tools
VERBOSE: [04:03:02][Test-TrustedConnection] Capabilities based on the centralized logic in the psm1 file.
VERBOSE: [04:03:02][Get-SQLCommand] Building the SQL connection string.
[04:03:02][Rename-D365ComputerName] Something went wrong while working against the database. | Exception calling "ExecuteNonQuery" with "0" argument(s): "The server 'MININT-57EHFHJ' does not exist. Use sp_helpserver to show available servers.
The server 'd365fo-tools' already exists."
WARNING: [04:03:02][Rename-D365ComputerName] Stopping because of errors. | Something went wrong while working against
the database.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment