Hi,
I opened the entire script in ISE and had a thorough look at it this morning. OK, so I've for the time being just used one value to avoid confusion. So I've entered my variables into the powershell script, the pertinent ones being the $VMname and $VMHost
The script fails with the following message:
Code: Select all
PS C:\Windows\System32\WindowsPowerShell\v1.0> C:\scripts\DailyBackups.ps1
Find-VBRViEntity : Unable to cast object of type 'Veeam.Backup.Core.Infrastructure.CScvmmItem' to type
'Veeam.Backup.Core.Infrastructure.IViItem'.
At C:\scripts\DailyBackups.ps1:76 char:9
+ $VM = Find-VBRViEntity -Name $VMName -Server $Server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Find-VBRViEntity], InvalidCastException
+ FullyQualifiedErrorId : System.InvalidCastException,Veeam.Backup.PowerShell.Command.FindVBRViEntity
Start-VBRZip : Cannot validate argument on parameter 'Entity'. The argument is null. Provide a valid value for the argument, and
then try running the command again.
At C:\scripts\DailyBackups.ps1:86 char:40
+ $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+ ~~~
+ CategoryInfo : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Commands.Backup.StartVBRZip
I get the following info when echoing the values stored in the variables:
Code: Select all
PS C:\Windows\System32\WindowsPowerShell\v1.0> echo $server
Info : KLAL-SVR-VMM01 (Microsoft Virtual Machine Manager Server)
ParentId : 00000000-0000-0000-0000-000000000000
Id : 539fd7ff-0d83-44af-b4bf-70433fd789bd
Name : KLAL-SVR-VMM01
RealName : KLAL-SVR-VMM01
Reference :
Description : Created by KLAL\administrator at 10/08/2015 14:19:31.
IsUnavailable : False
Type : Scvmm
ApiVersion : Unknown
PhysHostId : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds : Veeam.Backup.Common.CCredentials
PS C:\Windows\System32\WindowsPowerShell\v1.0> echo $hostname
KLAL-SVR-VMM01
PS C:\Windows\System32\WindowsPowerShell\v1.0> echo $VMName
Running the problematic line now gives me
Code: Select all
PS C:\Windows\System32\WindowsPowerShell\v1.0> Find-VBRViEntity -Name $VMName -Server $Server
Find-VBRViEntity : Unable to cast object of type 'Veeam.Backup.Core.Infrastructure.CScvmmItem' to type
'Veeam.Backup.Core.Infrastructure.IViItem'.
At line:1 char:1
+ Find-VBRViEntity -Name $VMName -Server $Server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Find-VBRViEntity], InvalidCastException
+ FullyQualifiedErrorId : System.InvalidCastException,Veeam.Backup.PowerShell.Command.FindVBRViEntity
I've also included the output of Get-VBRServer for4 completeness:
Code: Select all
PS C:\Windows\System32\WindowsPowerShell\v1.0> Get-VBRServer
Info : KLAL-SVR-HV01.KLAL.GSFA.UK (Microsoft Hyper-V Server)
ParentId : 1f608259-0a1d-475e-88d5-e550067fb548
Id : 12c9640e-c45e-4ea6-8007-459d6b621077
Name : KLAL-SVR-HV01.KLAL.GSFA.UK
RealName : KLAL-SVR-HV01.KLAL.GSFA.UK
Reference : b9d5c45f-9ab9-49a8-a627-a53b6cc523d0
Description :
IsUnavailable : False
Type : HvServer
ApiVersion : Unknown
PhysHostId : ecce2075-ee35-44d9-9be7-e334b58e60b2
ProxyServicesCreds : Veeam.Backup.Common.CCredentials
Info : KLAL-SVR-VMM01 (Microsoft Virtual Machine Manager Server)
ParentId : 00000000-0000-0000-0000-000000000000
Id : 539fd7ff-0d83-44af-b4bf-70433fd789bd
Name : KLAL-SVR-VMM01
RealName : KLAL-SVR-VMM01
Reference :
Description : Created by KLAL\administrator at 10/08/2015 14:19:31.
IsUnavailable : False
Type : Scvmm
ApiVersion : Unknown
PhysHostId : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds : Veeam.Backup.Common.CCredentials
Info : This server (Microsoft Windows Server)
ParentId : 00000000-0000-0000-0000-000000000000
Id : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
Name : This server
RealName : KLAL-SVR-DPM01
Reference :
Description :
IsUnavailable : False
Type : Local
ApiVersion : Unknown
PhysHostId : d7c4ff97-b99b-4d1f-884d-283b7b6b9ee3
ProxyServicesCreds :
Info : KLAL-SVR-HV02.KLAL.GSFA.UK (Microsoft Hyper-V Server)
ParentId : 1f608259-0a1d-475e-88d5-e550067fb548
Id : 182946f6-1e8f-4cb9-bc7e-aa8b5b58d7b5
Name : KLAL-SVR-HV02.KLAL.GSFA.UK
RealName : KLAL-SVR-HV02.KLAL.GSFA.UK
Reference : d9fd8704-6dc4-4bf5-99f1-00fbe1bfa8af
Description :
IsUnavailable : False
Type : HvServer
ApiVersion : Unknown
PhysHostId : a166f94e-3c64-43e0-8928-9ac25f50fcc2
ProxyServicesCreds : Veeam.Backup.Common.CCredentials
Info : KLAL-CLUS-HYPERV.KLAL.GSFA.UK (Microsoft Hyper-V Cluster)
ParentId : 539fd7ff-0d83-44af-b4bf-70433fd789bd
Id : 1f608259-0a1d-475e-88d5-e550067fb548
Name : KLAL-CLUS-HYPERV.KLAL.GSFA.UK
RealName : KLAL-CLUS-HYPERV.KLAL.GSFA.UK
Reference : da994770-8994-4964-965f-b5b792b0e456
Description :
IsUnavailable : False
Type : HvCluster
ApiVersion : Unknown
PhysHostId : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds : Veeam.Backup.Common.CCredentials
Full script viewable here:
http://pastebin.com/SvQgfWeg