After Upgraded to 6.5 Cannot Add Windows PowerShell

PowerShell script exchange

After Upgraded to 6.5 Cannot Add Windows PowerShell

Veeam Logoby habibalby » Wed Nov 21, 2012 1:00 pm

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
habibalby
Expert
 
Posts: 350
Liked: 23 times
Joined: Mon Jul 18, 2011 9:30 am
Location: Bahrain
Full Name: Hussain Al Sayed

Re: After Upgraded to 6.5 Cannot Add Windows PowerShell

Veeam Logoby v.Eremin » Wed Nov 21, 2012 1:37 pm

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.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: After Upgraded to 6.5 Cannot Add Windows PowerShell

Veeam Logoby habibalby » Wed Nov 21, 2012 1:47 pm

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
Expert
 
Posts: 350
Liked: 23 times
Joined: Mon Jul 18, 2011 9:30 am
Location: Bahrain
Full Name: Hussain Al Sayed

Re: After Upgraded to 6.5 Cannot Add Windows PowerShell

Veeam Logoby habibalby » Wed Nov 21, 2012 2:06 pm

Yes, the issue the resolved by installing PowerShell 3.0.
Thanks, to this thread for providing the solution. viewtopic.php?f=26&t=14049&p=65635&hilit=PowerShell+3.0#p65635
habibalby
Expert
 
Posts: 350
Liked: 23 times
Joined: Mon Jul 18, 2011 9:30 am
Location: Bahrain
Full Name: Hussain Al Sayed


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests