Need to Restart SSAS through SQL Agent Job remotely

  • Hi All,
    Need power shell script to restart SSAS server form another SSIS - SQL Agent job step
    We are restarting SSAS regularly, but my plan is to set up a job in SSIS, schedule the job after all our daily load job completes and make the SSAS restart remotely.
    Both SSAS & SSIS are different servers.
    Help on the script. with the examples. 🙂 Thanks

  • Oh, FFS, Got Google?
    https://www.databasejournal.com/features/mssql/managing-sql-server-services-with-powershell.html
    should give you a pretty good idea.

  • yup thanks. i have tried this and created a job in ssis.
    Through direct poweshell it works but i cant run though the sql agent job

    I have created a sql agent job to execute powershell script.
    this is to stop SSAS service in another server.

    Script :
    Get-service MSSQLServerOLAPService -ComputerName vmpid-g4uwbi02 | stop-service 
    Start-Sleep -s 60 
    Get-service MSSQLServerOLAPService -ComputerName vmpid-g4uwbi02 | start-service 

    Job completes with no action : result as :
    The job script encountered the following errors. Theseerrors did not stop the script: A job step received an error at line 1 ina PowerShell script. The corresponding line is 'Get-service MSSQLServerOLAPService-ComputerName vmpid-g4uwbi02 | stop-service '. Correct the script andreschedule the job. The error information returned by PowerShell is: 'Cannotfind any service with service name 'MSSQLServerOLAPService'

    Kindly help

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply