PowerShell script exchange
Post Reply
nikods
Novice
Posts: 9
Liked: 2 times
Joined: May 25, 2015 11:46 am
Full Name: Dragan
Contact:

How to install powershell snapin Veeam B&R 9

Post by nikods »

Hi all,
I can not get power shell commands to work, there is no installation file in Backup dir on the iso file and I can not find how to install, just for B&R 8.
Any ideas?
Thanks
Niko
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by tdewin »

in v9, it is installed by default (also as part of the remote console). However you might need to load the snapin before you can use for example get-vbrbackup. Use "asnp veeampssnapin" to load it.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by veremin »

I can not get power shell commands to work
Follow the Timothy's advice or post the exact error you get while trying to access VB&R-specific cmdlets. Thanks.
nikods
Novice
Posts: 9
Liked: 2 times
Joined: May 25, 2015 11:46 am
Full Name: Dragan
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by nikods »

On the host server powershell remoting is enabled, I am executing from backup server, run as admin, admin is domain admin but I get:

Code: Select all

PS C:\Users\Administrator.xx> asnp veeampssnapin
PS C:\Users\Administrator.xx> Reset-HvVmChangeTracking -Server HOSTSrv -VMName "srvname"
Reset-HvVmChangeTracking : Failed to execute WMI Query.
At line:1 char:1
+ Reset-HvVmChangeTracking -Server HOSTSrv -VMName "srvname"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Reset-HvVmChangeTracking], CRegeneratedTraceException
    + FullyQualifiedErrorId : Veeam.Backup.Common.CRegeneratedTraceException,Veeam.Backup.PowerShell.Command.ResetHvVm
   ChangeTracking
but I keep getting this. Can I install veeam snapins on host server and execute command there?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by veremin »

Doesn't look like a PS-specific error. Therefore, you'd better open a ticket with our support team and let them investigate it directly. Thanks.
nikods
Novice
Posts: 9
Liked: 2 times
Joined: May 25, 2015 11:46 am
Full Name: Dragan
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by nikods » 1 person likes this post

OK, I will do that, thanks!
nielsengelen
Product Manager
Posts: 5619
Liked: 1177 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by nielsengelen »

Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
nikods
Novice
Posts: 9
Liked: 2 times
Joined: May 25, 2015 11:46 am
Full Name: Dragan
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by nikods »

Yes it is and all windows power shell commands work but veeam comandlets are not working. I resolved the issue via workaround but I would like power shell veeam comandlets to work :-)
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by veremin »

I'm interested what kind of a workaround you've implemented to resolve the issue; might be helpful to new comers. Thanks.
BenHolland
Novice
Posts: 5
Liked: 3 times
Joined: Oct 25, 2016 10:15 am
Full Name: Ben Holland
Contact:

[MERGED] Veeam Powershell Snapin

Post by BenHolland »

Dear forum,

In need to reset the CBT data for my backups after some server storage migrations.

However upon running the script:

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
Get-VBRLocalhost
Reset-HvVmChangeTracking -Server HostServer -VMName "VMName"
I get the following error:

Code: Select all

Reset-HvVmChangeTracking : Failed to execute WMI Query
I have checked and WMI permissions on the host servers are fine as per:
https://technet.microsoft.com/en-us/lib ... 71551.aspx

Setup:
Hypervisor - Microsoft Hyper-V.
Host Server OS - Microsoft Server 2012 R2.
Veeam B&R version - 9.0.0.1715.
Backup type - Off Host Proxy.
Storage Connectivity - Fibre Channel.
Storage repository - HP StoreOnce physical appliance.

Any help would be appreciated.

Kind regards,
Ben Holland
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by veremin »

Might be worth reaching our support team. Within a support ticket it would harm to mention that problem does not appear to be PowerShell related one, as support team typically do not assist clients with custom scripts in place. Thanks.
BenHolland
Novice
Posts: 5
Liked: 3 times
Joined: Oct 25, 2016 10:15 am
Full Name: Ben Holland
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by BenHolland »

Hi Thanks for the reply.

I will reach out to support in that case.
I'm surprised to hear that this would be classed as a custom script. Unless there is another way to reset the CBT data other than this command.

Regards,
Ben
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by veremin »

I would be surprised as well. I was just sharing with you our general support policy, according to which most of custom-written scripts are out of support scope.

Kindly, provide here a support ticket number (once you have one) for the convenience of future readers.

Thanks.
BenHolland
Novice
Posts: 5
Liked: 3 times
Joined: Oct 25, 2016 10:15 am
Full Name: Ben Holland
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by BenHolland » 1 person likes this post

Ok no problem.
My case number is 01957964.

Thanks,
Ben
BenHolland
Novice
Posts: 5
Liked: 3 times
Joined: Oct 25, 2016 10:15 am
Full Name: Ben Holland
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by BenHolland » 1 person likes this post

Just an update on this.
Support have informed me that there is a known bug running this command in 9.0.0.1715 with Hyper-V hosts and this should be resolved in the up and coming 9.5 release.

My options are until 9.5 release:
Turn off CBT - Not great as my backups are taking hours and spilling into the next working day.
Manually removing the CTDB registry values (forcing a CBT reset) as per https://www.veeam.com/kb1934 - I will attempt this today and will share my results after a couple of job runs.

Thanks,
Ben
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by veremin »

Good to know that the issue is tracked and will be fixed in the nearest future. Thanks for sharing the outcome of support investigation; appreciated.
BenHolland
Novice
Posts: 5
Liked: 3 times
Joined: Oct 25, 2016 10:15 am
Full Name: Ben Holland
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by BenHolland » 1 person likes this post

I can confirm the manual process has worked nicely to clear the CBT warnings and bring my backup windows right down.

Just FYI if anyone is interested. I have quite a few hosts and to speed up the process I was able to script this routine in PowerShell:

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue

# Connects to the Veeam Enterprise Manager server.
Connect-VBRServer -Server "Veeam EM Server"

# Gets a list of all Hyper-V hosts from the Veeam SQL database.
$Servers = ((Get-VBRServer) | where {$_.Type -eq "HvServer"}).name

# Clears the CBT data for each host resolved from the previous command.
foreach($Server in $Servers) { Write-Output "Clearing CBT on " $Server}
foreach($Server in $Servers) { Remove-Item "\\$Server\C$\Support\Veeam_Reg_Export\veeamctdb.reg" -Confirm:$false }
foreach($Server in $Servers) { (Get-Service -ComputerName $Server -Name "veeamfct").Stop() }
foreach($Server in $Servers) { Invoke-Command -ComputerName $Server {reg export "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VeeamFCT\Parameters\CTDB" "C:\Support\Veeam_Reg_Export\veeamctdb.reg"}}
foreach($Server in $Servers) { Invoke-Command -ComputerName $Server {pushd;sl HKLM:\SYSTEM\CurrentControlSet\Services\VeeamFCT\Parameters; if(test-path CTDB){Remove-Item CTDB -Recurse}ELSE{"Key Dose Not Exist"};popd}}
foreach($Server in $Servers) { (Get-Service -ComputerName $Server -Name "veeamfct").Start() }   
For this to work you just need to setup a C:\Support\Veeam_Reg_Export folder on each Hyper-V host.
Or if you want a different path, just amend the above script.

Thanks,
Ben
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to install powershell snapin Veeam B&R 9

Post by veremin »

Hopefully, we will have this issue fixed in the upcoming release, so, you won't have to clearing registry either manually or automatically any longer. Anyway, thanks again for providing our community members with the found resolution.
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests