Both this stack post as well as this one looked similar but I couldn't find my solution there. I'm having an issue understanding the difference between the behaviour in reg export versus reg import.
When running reg export inside powershell, it returns "operation completed successfully" but reg import throws a terminating error saying "operation completed successfully". The registry file is correctly imported even though it is thrown as an error. An example:
PS C:\Windows\System32> reg export HKLM\Software\MySoftware C:\Scripts\MyFile.reg
The operation completed successfully.
PS C:\Windows\System32> reg import C:\Scripts\MyFile.reg
reg : The operation completed successfully.
At line:1 char:1
+ reg import C:\Scripts\MyFile.reg
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (The operation completed successfully.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Microsoft's documentation of the reg import command says that the return codes are 0 for Success and 1 for Failure. Why would Powershell return the success as a regular success message for reg export, but throw it as a terminating error for reg import?
I'm running Powershell as an Admin and the logged in user is a local administrator on the server. Any assistance is appreciated.