alekdavis/PlexBackup

An error: "Exit-SingleInstanceError" occurs when running script

hondajyh opened this issue · 5 comments

Hello -

I just tried running the script and am getting an error:

`F:\PlexBackup.ps1 : The term 'Exit-SingleInstance' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1

  • .\PlexBackup.ps1
  •   + CategoryInfo          : ObjectNotFound: (Exit-SingleInstance:String) [PlexBackup.ps1], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException,PlexBackup.ps1`
    
    

Thank you!

This sounds like you were not able to get and load the dependencies. Although, I'd suspect to see other errors before this one. I'd suggest rebooting and if it doesn't help, run the script with the -Verbose and -Debig flags and post the log.

Thank you. I am getting the same error after rebooting.

I ran the script using the two flags. Here is what I get:

VERBOSE: Entered SetModulePath.
VERBOSE: Exiting SetModulePath.
VERBOSE: Entered LoadModules.
VERBOSE: Installing module 'ScriptVersion'.
F:\Backup\PlexBackup.ps1 : The term 'Exit-SingleInstance' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1

  • .\PlexBackup.ps1 -debug -verbose
  •   + CategoryInfo          : ObjectNotFound: (Exit-SingleInstance:String) [PlexBackup.ps1], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException,PlexBackup.ps1
    

When you run the script, are you connected to the internet? If not, this would be a problem. If you are, there must be an issue with your version of PowerShell.

The error you see looks like a bug (I will add it to the bug list), but it is not what the actual problem is (it happens when the script already failed). It looks like you are running into issues installing the 4 external module dependencies:

https://www.powershellgallery.com/packages/ScriptVersion/1.0.0
https://www.powershellgallery.com/packages/ConfigFile/1.1.0
https://www.powershellgallery.com/packages/SingleInstance/1.1.0
https://www.powershellgallery.com/packages/StreamLogging/1.2.1

See if you can install them manually, and I suspect you will see errors, but maybe PowerShell will give you a hint how to correct, e.g. update Nuget version (I have a feeling that this is what may cause it).

Thanks for the response. I am able to confirm I am connected to the internet.
Your suggestion to try manually was helpful though. After a bit of trial and error, I discovered PS wasn't able to find the module repositories (this is the first time I'm using PowerShell). I ran "Register-PSRepository -Default" and then retried your script. It looks like it got through the installs and is now backing up my files. Will report back if I get another error. Thanks.

Sweet. Thanks for the update. Good tip on repository registration (I'm not a PowerShell expert, so this was new to me). Btw, I fixed the bug that cause the exception that you reported, but once you fixed the original issue, you can't validate it. Let me know if you run into any issues. Cheers.