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
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:
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