Digressive / HyperV-Backup-Utility

Flexible Hyper-V Backup Utility
https://gal.vin/posts/vm-backup-for-hyper-v/
MIT License
120 stars 38 forks source link

Else : The term 'Else' is not recognized as the name of a cmdlet, function, script file, or operable program #2

Closed nicholashead closed 4 years ago

nicholashead commented 5 years ago

Running the script from a Powershell window, it appears to actually execute fully and correctly - VMs are backed up, zipped, etc, but the console is filled with:

Else : The term 'Else' 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 C:\tools\hyper-v-backup.ps1:538 char:13
+             Else
+             ~~~~
    + CategoryInfo          : ObjectNotFound: (Else:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

                ## Rename the export of each VM to include the date.
                Get-ChildItem -Path $Backup -Filter $Vm -Directory | Rename-Item -NewName ("$Backup\$Vm-{0:yyyy-MM-dd-HH-mm-ss}" -f (Get-Date))

Else : The term 'Else' 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 C:\tools\hyper-v-backup.ps1:538 char:13
+             Else
+             ~~~~
    + CategoryInfo          : ObjectNotFound: (Else:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

                ## Rename the export of each VM to include the date.
                Get-ChildItem -Path $Backup -Filter $Vm -Directory | Rename-Item -NewName ("$Backup\$Vm-{0:yyyy-MM-dd-HH-mm-ss}" -f (Get-Date))

Else : The term 'Else' 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 C:\tools\hyper-v-backup.ps1:538 char:13
+             Else
+             ~~~~
    + CategoryInfo          : ObjectNotFound: (Else:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

                ## Rename the export of each VM to include the date.
                Get-ChildItem -Path $Backup -Filter $Vm -Directory | Rename-Item -NewName ("$Backup\$Vm-{0:yyyy-MM-dd-HH-mm-ss}" -f (Get-Date))

Not quite sure what's happening here. I looked over the file for syntax errors but didn't see anything obvious. This is on Datacenter 2016, Powershell 5.1

Digressive commented 4 years ago

I've recently released a huge update. Should be ok now.