SQL error when running PowerShell script

PowerShell script exchange

SQL error when running PowerShell script

Veeam Logoby smithjamesp55 » Sat Feb 26, 2011 8:29 pm

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!!
smithjamesp55
Influencer
 
Posts: 15
Liked: never
Joined: Thu Jan 27, 2011 11:09 pm
Full Name: James Smith

Re: SQL error when running PowerShell script

Veeam Logoby Vitaliy S. » Mon Feb 28, 2011 9:39 am

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!
Vitaliy S.
Veeam Software
 
Posts: 19558
Liked: 1102 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: SQL error when running PowerShell script

Veeam Logoby smithjamesp55 » Sat Mar 05, 2011 9:07 pm

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!
smithjamesp55
Influencer
 
Posts: 15
Liked: never
Joined: Thu Jan 27, 2011 11:09 pm
Full Name: James Smith

Re: SQL error when running PowerShell script

Veeam Logoby Vitaliy S. » Wed Mar 09, 2011 10:37 am

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.
Vitaliy S.
Veeam Software
 
Posts: 19558
Liked: 1102 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: SQL error when running PowerShell script

Veeam Logoby smithjamesp55 » Fri Mar 18, 2011 2:27 pm

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.
smithjamesp55
Influencer
 
Posts: 15
Liked: never
Joined: Thu Jan 27, 2011 11:09 pm
Full Name: James Smith

Re: SQL error when running PowerShell script

Veeam Logoby Gostev » Fri Mar 18, 2011 2:28 pm

Hi James, glad to hear this. Thank you very much for taking time to update your topic with the resolution, we do appreciate it.
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests