PowerShell script exchange
Post Reply
smithjamesp55
Influencer
Posts: 15
Liked: never
Joined: Jan 27, 2011 11:09 pm
Full Name: James Smith
Contact:

SQL error when running PowerShell script

Post by smithjamesp55 »

As a corollary, when I call Powershell from a batch file and register the Veeam PSSnapin, I get a SQL error when the script tries to connect to return the data. When I run the command (and even my entire script) in the Powershell that's built in to Veeam, it works the way I want it to. Is there a switch or some parameters I need to add when I call Powershell or register the Veeam snap in? Or how would I call the Veeam-version of Powershell from my batch file?

Thanks!!
Vitaliy S.
VP, Product Management
Posts: 27325
Liked: 2778 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: SQL error when running PowerShell script

Post by Vitaliy S. »

Hello James,

Could you please clarify what type of error do you see while running PowerShell script? On top of that, please take a look at this topic which explains how to run a PS script from a batch file.

Thank you!
smithjamesp55
Influencer
Posts: 15
Liked: never
Joined: Jan 27, 2011 11:09 pm
Full Name: James Smith
Contact:

Re: SQL error when running PowerShell script

Post by smithjamesp55 »

Sorry for the delayed response, I was out of town. Here is the error I get:

Code: Select all

Get-VBRBackupSession : SQL server is not available
At c:\veeamlog\DailyLog.ps1.ps1:10 char:23
+   Get-VBRBackupSession <<<<  | where-object {$_.Info.CreationTime -gt $OneDayAgo} | ft | out-file "$Location\$File"
    + CategoryInfo          : InvalidOperation: (Veeam.Backup.Po...BRBackupSession:GetVBRBackupSession) [Get-VBRBackupSession], CAppException
    + FullyQualifiedErrorId : Backup,Veeam.Backup.PowerShell.Command.GetVBRBackupSession
Thanks!
Vitaliy S.
VP, Product Management
Posts: 27325
Liked: 2778 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: SQL error when running PowerShell script

Post by Vitaliy S. »

James, let our support team investigate that, as I haven't seen this error before. I would also appreciate if you could update this topic with the resolution you find with our technical team.
smithjamesp55
Influencer
Posts: 15
Liked: never
Joined: Jan 27, 2011 11:09 pm
Full Name: James Smith
Contact:

Re: SQL error when running PowerShell script

Post by smithjamesp55 »

Just wanted to follow up on this one. Running the batch file from a command prompt with administrator privileges works. When I configure it in Scheduled Tasks, there's a checkbox to run with the highest privileges, and it ran successfully this morning.
Gostev
Chief Product Officer
Posts: 31707
Liked: 7212 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: SQL error when running PowerShell script

Post by Gostev »

Hi James, glad to hear this. Thank you very much for taking time to update your topic with the resolution, we do appreciate it.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests