using : The term 'using' 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:2 char:1
+ using namespace System.Collections.Generic
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (using:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Unable to find type [List].
At line:4 char:14
+ $LastDay = [List[Object]]@()
I ran this on my VBR server in my homelab without issue. Are the versions of PS the same on each of the servers? Is the Veeam version the same on each of the servers? Something to check.
@g0nzo, incorporating using statement in a ps script natively requires Powershell v5.0+. Please make sure that you have it installed on the server, where you encountered this error. Thanks!
oleg.feoktistov wrote: ↑May 10, 2022 3:04 pm
@g0nzo, incorporating using statement in a ps script natively requires Powershell v5.0+. Please make sure that you have it installed on the server, where you encountered this error. Thanks!
I've seen similar weird behaviour before from PoSh where it's been upgraded by installing a WMF upgrade. It makes PoSh report the version number of the upgraded version but some (all?) of the newer commands don't exist. It's a right PITA, because if you just check the PoSh version in the script the commands will throw exceptions and whatever you do the script won't work. I never found a solution other than to handle the exceptions gracefully, report the likely cause, and exit with error.
Did one of the servers start life with an older PoSh and then get upgraded to run the same PoSh version as the other server?