PowerShell script exchange
Post Reply
habibalby
Veteran
Posts: 392
Liked: 33 times
Joined: Jul 18, 2011 9:30 am
Full Name: Hussain Al Sayed
Location: Bahrain
Contact:

After Upgraded to 6.5 Cannot Add Windows PowerShell

Post by habibalby »

Hi,
I've just upgraded my Veeam from 6.1 to 6.5 and during the up gradation, I have selected all the components including the PowerShell, but I'm surprised that the Task Scduler doesn't start the PowerShell Scripts to start the backup jobs. I have tried to run them manually using the scripts and I'm presented with an error but the job started :)


Code: Select all

          Welcome to the Veeam Backup PowerShell Toolkit!

To find out what commands are available, type:       Get-VBRCommand
To show documentation for all available commands:    Get-VBRToolkitDocumentatio


       Copyright (C) 2012 Veeam, Inc. All rights reserved.


 Backup job session
    Job 'Critical VMs-1' '21,474,836,480' of '139,790,351,360' bytes processed,
    [oooooooooo                                                          ]
    00:18:22 remaining.

    Files remaining\total: 20.0 GB;   Avg. rate: 105 MB/s

   otFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\veeam> cd G:\Scripts
PS G:\Scripts> .\CriticalVMs-1.ps1
Add-PSSnapin : Cannot add Windows PowerShell snap-in VeeamPSSnapin because it i
s already added. Verify the name of the snap-in and try again.
At G:\Scripts\CriticalVMs-1.ps1:1 char:13
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: After Upgraded to 6.5 Cannot Add Windows PowerShell

Post by veremin »

Hi.

I'm wondering if it can be the result of using multiple scripts runing back-to-back, one after another. My point is that each script you're trying to run probably has "asnp VeeamPSSnapin" in the begging, consequently, second script and all futher scripts in a row are likely to show you this error, meanwhile continue to run.

What about implementing simple checker right in the begging of the script? By the means of which you can verify that snap-in hasn't been started already.

Code: Select all

if ( (Get-PSSnapin -Name MySnapin -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PsSnapin MySnapin
}
Hope you’ll find this useful.
Thanks.
habibalby
Veteran
Posts: 392
Liked: 33 times
Joined: Jul 18, 2011 9:30 am
Full Name: Hussain Al Sayed
Location: Bahrain
Contact:

Re: After Upgraded to 6.5 Cannot Add Windows PowerShell

Post by habibalby »

Hello,
the scripts are working fine just before upgrading to v6.5. It seems the issue is the PowerShell 3.0.. Let me install it and confirm back.

Thanks,
habibalby
Veteran
Posts: 392
Liked: 33 times
Joined: Jul 18, 2011 9:30 am
Full Name: Hussain Al Sayed
Location: Bahrain
Contact:

Re: After Upgraded to 6.5 Cannot Add Windows PowerShell

Post by habibalby »

Yes, the issue the resolved by installing PowerShell 3.0.
Thanks, to this thread for providing the solution. http://forums.veeam.com/viewtopic.php?f ... 3.0#p65635
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 14 guests