Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Analysis Server 2005 Backup Powershell Script Expand / Collapse
Author
Message
Posted Monday, October 1, 2007 6:15 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, July 24, 2014 5:59 AM
Points: 70, Visits: 498
Comments posted to this topic are about the item Analysis Server 2005 Backup Powershell Script
Post #404965
Posted Tuesday, January 5, 2010 2:29 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, August 13, 2014 7:19 PM
Points: 53, Visits: 230
Ron, I like your script a lot, and tried to adjust it for SQL server backup., I load [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") and then try the following:
# Declare SQL objects with strongly typed variables
[Microsoft.SqlServer.SMO.Server]$SQLserver = New-Object ([Microsoft.SqlServer.SMO.Server])
# Connect to SQL Server with specified instance
$SQLserver.Connect($Servername)

but am getting a error:
Unable to find type [Microsoft.SqlServer.SMO.Server]:

or if I try to load just LoadWithPartialName("Microsoft.SqlServer"] that errors out too.
I attach my script here as SQLCMD_v4.ps1.txt


  Post Attachments 
SQLCMD_v4.ps1.txt (8 views, 2.70 KB)
Post #842428
Posted Tuesday, March 29, 2011 12:44 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 30, 2013 9:14 AM
Points: 1, Visits: 120
Hi Ron,

I got your script downloaded directly from Powershell Idera site. The script is working great through command prompt windows or Powershell window directly. However, it does not work when I am trying to schedule it into the sql server agent. Btw, I am new to the Powershell, so not sure what do I need to do beside putting in the job step and choose powershell. I also try to set the policy unrestricted, it still threw me the same error. Here is the error I have received.

Executed as user: The job script encountered the following errors. These errors did not stop the script: A job step received an error at line 35 in a PowerShell script. The corresponding line is ' Backup-SSAS $serverInstance $backupDestination $retentionDays $logDir '. Correct the script and reschedule the job. The error information returned by PowerShell is: 'TRAPPED: Cannot invoke this function because the current host does not implement it. ' A job step received an error at line 35 in a PowerShell script. The corresponding line is ' Backup-SSAS $serverInstance $backupDestination $retentionDays $logDir '. Correct the script and reschedule the job. The error information returned by PowerShell is: 'TRAPPED: Cannot invoke this function because the current host does not implement it. ' A job step received an error at line 35 in a PowerShell script. The corresponding line is ' Backup-SSAS $serverInstance $backupDestination $retentionDays $logDir '. Correct the script and reschedule the job. The error information returned by PowerShell is: 'TRAPPED: Cannot invoke this function because the current host does not implement it. ' A job step received an error at line 35 in a PowerShell script. The corresponding line is ' Backup-SSAS $serverInstance $backupDestination $retentionDays $logDir '. Correct the script and reschedule the job. The error information returned by PowerShell is: 'TRAPPED: Cannot invoke this function because the current host does not implement it. '.

I am running under SQL server 2008 and Powershell 1.0. It's just work without the sql server agent. Do I have to do anything before adding this script into the job steps? Can you advise? Your reply will be much appreciate as I am trying to set this up into all our SSAS environment here.

Post #1085792
Posted Monday, September 19, 2011 9:40 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, April 14, 2014 10:42 PM
Points: 185, Visits: 181
Hello,

There are some commands you cannot run from an SQL Server job because there is no console, for the example write-host cmdlet.

http://blogs.msdn.com/b/mwories/archive/2009/09/30/the-use-of-write-host-and-sql-server-agent-powershell-job-steps.aspx

Hope this helps.

Regards.
Victor.
Post #1177320
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse