Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling Rename-D365ComputerName with invalid name results in error, but executes rest of script #656

Open
FH-Inway opened this issue Jun 19, 2022 · 2 comments

Comments

@FH-Inway
Copy link
Member

When running Rename-D365ComputerName with an invalid -NewName parameter (e.g. d365fo.tools), the rename fails with an error message saying "Rename-Computer : Skip computer 'MININT-57EHFHJ' with new name 'd365fo.tools' because the new name is not valid.".
Despite this, the the rest of the cmdlet is executed.

Another run of the cmdlet with a valid name renames the computer correctly, but now execution of the rest of the cmdlet causes issues: "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.""

Not sure yet if this breaks the environment.

Gist with full PowerShell session

@FH-Inway
Copy link
Member Author

Have to do some more testing, but no matter the outcome, I think the cmdlet should be modified to not execute the rest if Rename-Computer fails.

@valerymoskalenko
Copy link

Try to use -EnableException parameter to stop the execution of the script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants